From d2f2ea20bbc9e1e7bc6858ea19d689624f27055a Mon Sep 17 00:00:00 2001 From: Chun-Min Chang Date: Tue, 8 Jun 2021 00:48:20 +0000 Subject: [PATCH] Bug 1702646 - Fix TestAudioInputProcessing tests r=padenot The AudioInputProcessing now needs to call ProcessInput to process the given input data instead of processing them in NotifyInputData Differential Revision: https://phabricator.services.mozilla.com/D116673 --- dom/media/gtest/TestAudioInputProcessing.cpp | 2 ++ dom/media/webrtc/MediaEngineWebRTCAudio.cpp | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dom/media/gtest/TestAudioInputProcessing.cpp b/dom/media/gtest/TestAudioInputProcessing.cpp index 8fcf6bacce32..ed5d14fcb84f 100644 --- a/dom/media/gtest/TestAudioInputProcessing.cpp +++ b/dom/media/gtest/TestAudioInputProcessing.cpp @@ -74,6 +74,7 @@ TEST(TestAudioInputProcessing, UnaccountedPacketizerBuffering) AudioInputProcessing::BufferInfo{ buffer.Elements(), nrFrames, channels, rate}, nextTime - nrFrames); + aip->ProcessInput(graph, nullptr); aip->Pull(graph, processedTime, nextTime, segment.GetDuration(), &segment, true, &ended); EXPECT_EQ(aip->NumBufferedFrames(graph), 24U); @@ -93,6 +94,7 @@ TEST(TestAudioInputProcessing, UnaccountedPacketizerBuffering) AudioInputProcessing::BufferInfo{ buffer.Elements(), nrFrames, channels, rate}, nextTime - (2 * nrFrames)); + aip->ProcessInput(graph, nullptr); aip->Pull(graph, processedTime, nextTime, segment.GetDuration(), &segment, true, &ended); EXPECT_EQ(aip->NumBufferedFrames(graph), 120U); diff --git a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp index 7bfd745ccad2..b2fa23f37f88 100644 --- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp +++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp @@ -1083,7 +1083,7 @@ void AudioInputProcessing::ProcessInput(MediaTrackGraphImpl* aGraph, MOZ_ASSERT(aGraph); MOZ_ASSERT(aGraph->OnGraphThread()); - if (mEnded || !mEnabled || !mLiveFramesAppended || !mInputData || !aSegment) { + if (mEnded || !mEnabled || !mLiveFramesAppended || !mInputData) { return; } @@ -1095,7 +1095,12 @@ void AudioInputProcessing::ProcessInput(MediaTrackGraphImpl* aGraph, // code. Otherwise, directly insert the mic data in the MTG, bypassing all // processing. if (PassThrough(aGraph)) { - mSegment.AppendSegment(aSegment, mPrincipal); + if (aSegment) { + mSegment.AppendSegment(aSegment, mPrincipal); + } else { + InsertInGraph(aGraph, inputInfo.mBuffer, inputInfo.mFrames, + inputInfo.mChannels); + } } else { MOZ_ASSERT(aGraph->GraphRate() == inputInfo.mRate); PacketizeAndProcess(aGraph, inputInfo.mBuffer, inputInfo.mFrames,