Handle encoder_ == nullptr in VideoStreamEncoder::EncodeVideoFrame.
This is to address a test failure seen on the msan bot(s).
Tbr: handellm@webrtc.org
Bug: webrtc:12857
Change-Id: I77cbe158e3d0aae62d4a4c0783d5ee6d74edcc22
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221362
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34233}
diff --git a/video/video_stream_encoder.cc b/video/video_stream_encoder.cc
index 39409a3..68aae28 100644
--- a/video/video_stream_encoder.cc
+++ b/video/video_stream_encoder.cc
@@ -1616,6 +1616,12 @@
if (encoder_failed_)
return;
+ // It's possible that EncodeVideoFrame can be called after we've completed
+ // a Stop() operation. Check if the encoder_ is set before continuing.
+ // See: bugs.webrtc.org/12857
+ if (!encoder_)
+ return;
+
TraceFrameDropEnd();
// Encoder metadata needs to be updated before encode complete callback.