Commit cda1b8dd authored by Dale Curtis's avatar Dale Curtis Committed by Commit Bot

Add unit test to ensure mp3 with trailing garbage decodes okay.

The mp3 bitstream is not well-formed, it's essentially just an
aggergation of raw mp3 packets. Common practice (including our
own MP3 demuxer in MSE) is to scan the input bitstream for things
that look like mp3 packets and decode only those while discarding
the rest.

ffmpeg had a bug where they did not properly discard junk from
the end of the file (despite discarding it everywhere else), this
adds a test to ensure it does not regress.

BUG=794782
TEST=new unittest

Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I322e22fef3ebfa585369edb9d2c5d2ae2bb3afb4
Reviewed-on: https://chromium-review.googlesource.com/935143Reviewed-by: default avatarXiaohan Wang <xhwang@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539263}
parent d95d4804
...@@ -445,13 +445,20 @@ const TestParams kMediaCodecTestParams[] = { ...@@ -445,13 +445,20 @@ const TestParams kMediaCodecTestParams[] = {
#endif // defined(OS_ANDROID) #endif // defined(OS_ANDROID)
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
const DecodedBufferExpectations kSfxMp3Expectations[] = { const DecodedBufferExpectations kSfxMp3Expectations[] = {
{0, 1065, "2.81,3.99,4.53,4.10,3.08,2.46,"}, {0, 1065, "2.81,3.99,4.53,4.10,3.08,2.46,"},
{1065, 26122, "-3.81,-4.14,-3.90,-3.36,-3.03,-3.23,"}, {1065, 26122, "-3.81,-4.14,-3.90,-3.36,-3.03,-3.23,"},
{27188, 26122, "4.24,3.95,4.22,4.78,5.13,4.93,"}, {27188, 26122, "4.24,3.95,4.22,4.78,5.13,4.93,"},
}; };
// File has trailing garbage, but should still decode without error.
const DecodedBufferExpectations kTrailingGarbageMp3Expectations[] = {
{0, 26122, "-0.57,-0.77,-0.39,0.27,0.74,0.65,"},
{26122, 26122, "-0.57,-0.77,-0.39,0.27,0.74,0.65,"},
{52244, 26122, "-0.57,-0.77,-0.39,0.27,0.74,0.65,"},
};
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
const DecodedBufferExpectations kSfxAdtsExpectations[] = { const DecodedBufferExpectations kSfxAdtsExpectations[] = {
{0, 23219, "-1.90,-1.53,-0.15,1.28,1.23,-0.33,"}, {0, 23219, "-1.90,-1.53,-0.15,1.28,1.23,-0.33,"},
{23219, 23219, "0.54,0.88,2.19,3.54,3.24,1.63,"}, {23219, 23219, "0.54,0.88,2.19,3.54,3.24,1.63,"},
...@@ -504,13 +511,15 @@ const DecodedBufferExpectations kSfxOpusExpectations[] = { ...@@ -504,13 +511,15 @@ const DecodedBufferExpectations kSfxOpusExpectations[] = {
#endif #endif
const TestParams kFFmpegTestParams[] = { const TestParams kFFmpegTestParams[] = {
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
{kCodecMP3, "sfx.mp3", kSfxMp3Expectations, 0, 44100, CHANNEL_LAYOUT_MONO}, {kCodecMP3, "sfx.mp3", kSfxMp3Expectations, 0, 44100, CHANNEL_LAYOUT_MONO},
{kCodecMP3, "trailing-garbage.mp3", kTrailingGarbageMp3Expectations, 0,
44100, CHANNEL_LAYOUT_MONO},
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
{kCodecAAC, "sfx.adts", kSfxAdtsExpectations, 0, 44100, {kCodecAAC, "sfx.adts", kSfxAdtsExpectations, 0, 44100,
CHANNEL_LAYOUT_MONO}, CHANNEL_LAYOUT_MONO},
#endif
{kCodecFLAC, "sfx-flac.mp4", kSfxFlacExpectations, 0, 44100, {kCodecFLAC, "sfx-flac.mp4", kSfxFlacExpectations, 0, 44100,
CHANNEL_LAYOUT_MONO}, CHANNEL_LAYOUT_MONO},
#endif
{kCodecFLAC, "sfx.flac", kSfxFlacExpectations, 0, 44100, {kCodecFLAC, "sfx.flac", kSfxFlacExpectations, 0, 44100,
CHANNEL_LAYOUT_MONO}, CHANNEL_LAYOUT_MONO},
{kCodecPCM, "sfx_f32le.wav", kSfxWaveExpectations, 0, 44100, {kCodecPCM, "sfx_f32le.wav", kSfxWaveExpectations, 0, 44100,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment