Bug 1677520 - Clear the packetizer after an input stopped to avoid using its buffered data later. r=padenot
authorAndreas Pehrson <apehrson@mozilla.com>
Wed, 18 Nov 2020 09:20:56 +0000
changeset 557787 aa0b71302d8a8008437e2554b3c50dee275d5b5f
parent 557786 fbc4d44a65c4ec6b9d1946f214d66d52a0b25373
child 557788 d9e19325c7c7065822a0bed016d05c556f93fbb3
push id37961
push userccoroiu@mozilla.com
push dateWed, 18 Nov 2020 16:05:35 +0000
treeherdermozilla-central@2f08ec7e57c3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1677520
milestone85.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1677520 - Clear the packetizer after an input stopped to avoid using its buffered data later. r=padenot If an audio input is closed and then re-opened for the same AudioInputProcessing listener, we end up re-using the same input packetizer. This would lead to the data buffered in the input packetizer to be unaccounted for, inadvertently triggering an assert. This patch makes us clear the input packetizer when stopping an audio input such that we have no state that can be unaccounted for. Differential Revision: https://phabricator.services.mozilla.com/D97309
dom/media/webrtc/MediaEngineWebRTCAudio.cpp
--- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
+++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
@@ -1150,16 +1150,19 @@ void AudioInputProcessing::InsertInGraph
 void AudioInputProcessing::NotifyInputStopped(MediaTrackGraphImpl* aGraph) {
   MOZ_ASSERT(aGraph->OnGraphThread());
   // This is called when an AudioCallbackDriver switch has happened for any
   // reason, including other reasons than starting this audio input stream. We
   // reset state when this happens, as a fallback driver may have fiddled with
   // the amount of buffered silence during the switch.
   mLiveFramesAppended = false;
   mSegment.Clear();
+  if (mPacketizerInput) {
+    mPacketizerInput->Clear();
+  }
 }
 
 // Called back on GraphDriver thread!
 // Note this can be called back after ::Shutdown()
 void AudioInputProcessing::NotifyInputData(MediaTrackGraphImpl* aGraph,
                                            const AudioDataValue* aBuffer,
                                            size_t aFrames, TrackRate aRate,
                                            uint32_t aChannels,