diff --git a/content/media/webaudio/MediaBufferDecoder.cpp b/content/media/webaudio/MediaBufferDecoder.cpp index f20c7426ec0b..d3a5af5f7f18 100644 --- a/content/media/webaudio/MediaBufferDecoder.cpp +++ b/content/media/webaudio/MediaBufferDecoder.cpp @@ -538,11 +538,11 @@ MediaDecodeTask::CopyBuffer() uint32_t outSamples = expectedOutSamples; #ifdef MOZ_SAMPLE_TYPE_S16 - speex_resampler_process_int(resampler, i, bufferData, &inSamples, + speex_resampler_process_int(resampler, i, &bufferData[i * audioData->mFrames], &inSamples, &resampledBuffer[i * expectedOutSamples], &outSamples); #else - speex_resampler_process_float(resampler, i, bufferData, &inSamples, + speex_resampler_process_float(resampler, i, &bufferData[i * audioData->mFrames], &inSamples, &resampledBuffer[i * expectedOutSamples], &outSamples); #endif diff --git a/content/media/webaudio/test/Makefile.in b/content/media/webaudio/test/Makefile.in index 5bc37735a44e..bbd8c39b81d9 100644 --- a/content/media/webaudio/test/Makefile.in +++ b/content/media/webaudio/test/Makefile.in @@ -29,6 +29,10 @@ MOCHITEST_FILES := \ test_singleSourceDest.html \ ting.ogg \ ting-expected.wav \ + ting-dualchannel44.1.ogg \ + ting-dualchannel44.1-expected.wav \ + ting-dualchannel48.ogg \ + ting-dualchannel48-expected.wav \ small-shot.ogg \ small-shot-expected.wav \ invalid.txt \ diff --git a/content/media/webaudio/test/test_decodeAudioData.html b/content/media/webaudio/test/test_decodeAudioData.html index e44284ba4ca2..de30365339b4 100644 --- a/content/media/webaudio/test/test_decodeAudioData.html +++ b/content/media/webaudio/test/test_decodeAudioData.html @@ -123,6 +123,28 @@ var tests = [ fuzzTolerance: 12, fuzzToleranceMobile: 15826 }, + // An ogg file with two different channels, 44.1khz + { + url: "ting-dualchannel44.1.ogg", + valid: true, + expected: "ting-dualchannel44.1-expected.wav", + numberOfChannels: 2, + duration: 0.6936, + length: 33297, + fuzzTolerance: 16, + fuzzToleranceMobile: 16713 + }, + // An ogg file with two different channels, 48khz + { + url: "ting-dualchannel48.ogg", + valid: true, + expected: "ting-dualchannel48-expected.wav", + numberOfChannels: 2, + duration: 0.6373, + length: 30592, + fuzzTolerance: 9, + fuzzToleranceMobile: 2703 + }, // An ogg file which needs to be resampled { url: "small-shot.ogg", @@ -148,8 +170,8 @@ var tests = [ numberOfChannels: 2, duration: 1.0811, length: 51896, - fuzzTolerance: 132, - fuzzToleranceMobile: 56580 + fuzzTolerance: 91427, + fuzzToleranceMobile: 119684 }, // Make sure decoding a wave file results in the same buffer { diff --git a/content/media/webaudio/test/ting-dualchannel44.1-expected.wav b/content/media/webaudio/test/ting-dualchannel44.1-expected.wav new file mode 100644 index 000000000000..e08f8e8b4c43 Binary files /dev/null and b/content/media/webaudio/test/ting-dualchannel44.1-expected.wav differ diff --git a/content/media/webaudio/test/ting-dualchannel44.1.ogg b/content/media/webaudio/test/ting-dualchannel44.1.ogg new file mode 100644 index 000000000000..882400a7fd12 Binary files /dev/null and b/content/media/webaudio/test/ting-dualchannel44.1.ogg differ diff --git a/content/media/webaudio/test/ting-dualchannel48-expected.wav b/content/media/webaudio/test/ting-dualchannel48-expected.wav new file mode 100644 index 000000000000..6005f2a8896c Binary files /dev/null and b/content/media/webaudio/test/ting-dualchannel48-expected.wav differ diff --git a/content/media/webaudio/test/ting-dualchannel48.ogg b/content/media/webaudio/test/ting-dualchannel48.ogg new file mode 100644 index 000000000000..a5306ba9a5eb Binary files /dev/null and b/content/media/webaudio/test/ting-dualchannel48.ogg differ