From beb9fe2e9a750afee1f7068b58cd64fe742f9876 Mon Sep 17 00:00:00 2001 From: Andreas Pehrson Date: Thu, 24 Sep 2020 13:43:50 +0000 Subject: [PATCH] Bug 1663662 - Use the actual samplerate when OpusTrackEncoder init fails. r=bryce Null data has already been appended, and is clocked in the track rate. Differential Revision: https://phabricator.services.mozilla.com/D91137 --- dom/media/encoder/TrackEncoder.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dom/media/encoder/TrackEncoder.cpp b/dom/media/encoder/TrackEncoder.cpp index 2bf1d882774e..6ce3852739e8 100644 --- a/dom/media/encoder/TrackEncoder.cpp +++ b/dom/media/encoder/TrackEncoder.cpp @@ -20,7 +20,6 @@ LazyLogModule gTrackEncoderLog("TrackEncoder"); #define TRACK_LOG(type, msg) MOZ_LOG(gTrackEncoderLog, type, msg) static const int DEFAULT_CHANNELS = 1; -static const int DEFAULT_SAMPLING_RATE = 16000; static const int DEFAULT_FRAME_WIDTH = 640; static const int DEFAULT_FRAME_HEIGHT = 480; // 1 second threshold if the audio encoder cannot be initialized. @@ -232,8 +231,8 @@ void AudioTrackEncoder::NotifyEndOfStream() { if (!mCanceled && !mInitialized) { // If source audio track is completely silent till the end of encoding, - // initialize the encoder with default channel counts and sampling rate. - Init(DEFAULT_CHANNELS, DEFAULT_SAMPLING_RATE); + // initialize the encoder with a default channel count. + Init(DEFAULT_CHANNELS, mTrackRate); } mEndOfStream = true;