• Lambros Lambrou's avatar
    [remoting host] Use correct encoder after SDP is restarted. · b158c3a9
    Lambros Lambrou authored
    This CL fixes the host process so that the client can successfully
    select a different codec after SDP offer/answer exchange is restarted
    during an active connection. This comes in 2 parts:
    
    1. The current encoder in WebrtcVideoStream is reset, so that
    captured frames are routed to the new encoder.
    
    2. The WebrtcVideoEncoderSelector logic is slightly tweaked so that a
    call to SetPreferredCodec() resets the cycle of encoders returned by
    repeated calls to CreateEncoder(). This is done so that the correct
    encoder is returned after WebrtcVideoStream changes the preferred codec.
    This tweak does not break any existing unittests.
    
    This CL fixes crashes which occur when the host tries to use a different
    encoder than what WebRTC created via the WebrtcDummyVideoEncoderFactory
    class. These crashes can only be triggered when SDP (or ICE) is
    restarted via the recently-implemented control messages, which are not
    supported in older versions of the host.
    
    Bug: 1113499
    Change-Id: Idd1e388252c4359e1edc62ac4a51d71be0ae77cc
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2353672
    Auto-Submit: Lambros Lambrou <lambroslambrou@chromium.org>
    Commit-Queue: Jamie Walch <jamiewalch@chromium.org>
    Reviewed-by: default avatarJamie Walch <jamiewalch@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#797705}
    b158c3a9
webrtc_video_encoder_selector.cc 2.67 KB