[InsertableStreams] Ensure encoder queue is valid in OnTransformedFrame

In RTPSenderVideoFrameTransformerDelegate::TransformFrame(), the encoder
queue might still be null when a frame queued by a previous delegate
arrives. This could happen in the context of renegotiation that results
in a codec reset. In this case, the frame should be dropped.

Bug: webrtc:12691
Change-Id: Ib738ce31738cffc7e01053dbc82237f457fc2286
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/216393
Commit-Queue: Guido Urdaneta <guidou@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33866}
This commit is contained in:
Guido Urdaneta 2021-04-28 14:42:10 +00:00 committed by WebRTC LUCI CQ
parent 1a5f36b9b9
commit bd27adb714

View file

@ -129,9 +129,10 @@ void RTPSenderVideoFrameTransformerDelegate::OnTransformedFrame(
std::unique_ptr<TransformableFrameInterface> frame) {
MutexLock lock(&sender_lock_);
// The encoder queue gets destroyed after the sender; as long as the sender is
// alive, it's safe to post.
if (!sender_)
// The encoder queue normally gets destroyed after the sender;
// however, it might still be null by the time a previously queued frame
// arrives.
if (!sender_ || !encoder_queue_)
return;
rtc::scoped_refptr<RTPSenderVideoFrameTransformerDelegate> delegate = this;
encoder_queue_->PostTask(ToQueuedTask(