mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1097849 - Assert sane audio sample rates in MediaEncoder. r=derf
We believe the rate is constrained by the audio driver, but we should verify this assumption. 8-192 kHz covers all sample rates in general use for audio data.
This commit is contained in:
parent
03d133df88
commit
0dd30629a3
@ -158,6 +158,9 @@ OpusTrackEncoder::Init(int aChannels, int aSamplingRate)
|
||||
// let InterleaveTrackData downmix pcm data.
|
||||
mChannels = aChannels > MAX_CHANNELS ? MAX_CHANNELS : aChannels;
|
||||
|
||||
MOZ_ASSERT(aSamplingRate >= 8000 && aSamplingRate <= 192000,
|
||||
"Unreasonable sample rate for audio data.");
|
||||
|
||||
// According to www.opus-codec.org, creating an opus encoder requires the
|
||||
// sampling rate of source signal be one of 8000, 12000, 16000, 24000, or
|
||||
// 48000. If this constraint is not satisfied, we resample the input to 48kHz.
|
||||
|
@ -54,6 +54,9 @@ VorbisTrackEncoder::Init(int aChannels, int aSamplingRate)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aSamplingRate >= 8000 && aSamplingRate <= 192000,
|
||||
"Unreasonable sample rate for audio data.");
|
||||
|
||||
// This monitor is used to wake up other methods that are waiting for encoder
|
||||
// to be completely initialized.
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
|
Loading…
Reference in New Issue
Block a user