• posciak@chromium.org's avatar
    Fix webrtc HW encode deadlock scenarios. · 89f5a178
    posciak@chromium.org authored
        
    Webrtc unfortunately likes to sleep in BaseChannel::Send on the renderer's
    ChildThread while directly or indirectly calling into HW encoder and we end 
    up in a number of deadlocks of varying complexity in one way or another,
    while trying to also use the ChildThread to allocate shared memory to service 
    those calls.
    The only way to avoid this is to not get onto the ChildThread while servicing
    webrtc requests, so we use the static ChildThread::AllocateSharedMemory()
    to send the request directly from the current thread.
        
    Also add VEA::RequireBitstreamBuffers() to the initialization sequence, so that
    RTCVideoEncoder::InitEncode() will only return after we've allocated requested
    buffers. VEA::RequireBitstreamBuffers() is effectively a part of initialization
    sequence anyway, because we can't really call VEA::Encode() without knowing the
    VEA impl's coded size requirements. This could also potentially reduce
    the latency of the first Encode() call.
    
    And separately, zero out header structures sent to the client.
    
    TEST=apprtc.appspot.com with HW encoding
    BUG=260210
    
    Review URL: https://chromiumcodereview.appspot.com/23440015
    
    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221395 0039d316-1c4b-4281-b951-d872f2087c98
    89f5a178
rtc_video_encoder.cc 24 KB