Bug 867174 - Part 1: Deliver the correct channel count the to the resampler the first time that we see a buffer; r=padenot

This commit is contained in:
Ehsan Akhgari 2013-04-30 16:36:19 -04:00
parent 954cd4dfaa
commit 74ef44fd2d

View File

@ -304,7 +304,7 @@ public:
mSampleRate == IdealAudioRate());
}
void UpdateSampleRateIfNeeded(AudioNodeStream* aStream)
void UpdateSampleRateIfNeeded(AudioNodeStream* aStream, uint32_t aChannels)
{
if (mPlaybackRateTimeline.HasSimpleValue()) {
mPlaybackRate = mPlaybackRateTimeline.GetValue();
@ -319,7 +319,7 @@ public:
uint32_t currentOutSampleRate, currentInSampleRate;
if (ShouldResample()) {
SpeexResamplerState* resampler = Resampler(mChannels);
SpeexResamplerState* resampler = Resampler(aChannels);
speex_resampler_get_rate(resampler, &currentInSampleRate, &currentOutSampleRate);
uint32_t finalSampleRate = ComputeFinalOutSampleRate();
if (currentOutSampleRate != finalSampleRate) {
@ -345,7 +345,7 @@ public:
// WebKit treats the playbackRate as a k-rate parameter in their code,
// despite the spec saying that it should be an a-rate parameter. We treat
// it as k-rate. Spec bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=21592
UpdateSampleRateIfNeeded(aStream);
UpdateSampleRateIfNeeded(aStream, channels);
uint32_t written = 0;
TrackTicks currentPosition = GetPosition(aStream);