Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: media/filters/audio_file_reader_unittest.cc

Issue 11280301: Roll FFMpeg for M26. Fix ffmpeg float audio decoding. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix hash checks on windows. Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/logging.h" 5 #include "base/logging.h"
6 #include "base/md5.h" 6 #include "base/md5.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/sys_byteorder.h" 8 #include "base/sys_byteorder.h"
9 #include "build/build_config.h"
9 #include "media/base/audio_bus.h" 10 #include "media/base/audio_bus.h"
10 #include "media/base/decoder_buffer.h" 11 #include "media/base/decoder_buffer.h"
11 #include "media/base/test_data_util.h" 12 #include "media/base/test_data_util.h"
12 #include "media/filters/audio_file_reader.h" 13 #include "media/filters/audio_file_reader.h"
13 #include "media/filters/in_memory_url_protocol.h" 14 #include "media/filters/in_memory_url_protocol.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 16
16 namespace media { 17 namespace media {
17 18
18 class AudioFileReaderTest : public testing::Test { 19 class AudioFileReaderTest : public testing::Test {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 TEST_F(AudioFileReaderTest, WithoutOpen) { 78 TEST_F(AudioFileReaderTest, WithoutOpen) {
78 Initialize("bear.ogv"); 79 Initialize("bear.ogv");
79 } 80 }
80 81
81 TEST_F(AudioFileReaderTest, InvalidFile) { 82 TEST_F(AudioFileReaderTest, InvalidFile) {
82 Initialize("ten_byte_file"); 83 Initialize("ten_byte_file");
83 ASSERT_FALSE(reader_->Open()); 84 ASSERT_FALSE(reader_->Open());
84 } 85 }
85 86
86 TEST_F(AudioFileReaderTest, WithVideo) { 87 TEST_F(AudioFileReaderTest, WithVideo) {
87 RunTest("bear.ogv", "302e1773ba2f9a194c35a0f8f0b73f15", 2, 44100, 88 // Windows produces slightly different results due to differences in floating
89 // point functions (e.g. sin(), cos(), etc).
scherkus (not reviewing) 2012/12/13 22:40:11 and this is a new thing in the latest roll? what
DaleCurtis 2012/12/13 22:51:28 This is due to the switch to float decoding. It's
DaleCurtis 2012/12/14 20:48:32 Interleaving to int16 and hashing wasn't enough to
90 #if defined(OS_WIN)
91 static const char* kExpectedHash = "6e04000d4de05f317d4c8605250a8b54";
92 #else
93 static const char* kExpectedHash = "3251faa24f300b661a38103cfabefdfe";
94 #endif
95
96 RunTest("bear.ogv", kExpectedHash, 2, 44100,
88 base::TimeDelta::FromMicroseconds(1011520), 44608, 44608); 97 base::TimeDelta::FromMicroseconds(1011520), 44608, 44608);
89 } 98 }
90 99
91 TEST_F(AudioFileReaderTest, Vorbis) { 100 TEST_F(AudioFileReaderTest, Vorbis) {
92 RunTest("sfx.ogg", "2b84ad6d605abba1125c0dacc9c8dbdd", 1, 44100, 101 // Windows produces slightly different results due to differences in floating
102 // point functions (e.g. sin(), cos(), etc).
103 #if defined(OS_WIN)
104 static const char* kExpectedHash = "2284c9a4434cc59cadad1dd781380086";
105 #else
106 static const char* kExpectedHash = "ce722bf840acc7626b66559d820aced7";
107 #endif
108
109 RunTest("sfx.ogg", kExpectedHash, 1, 44100,
93 base::TimeDelta::FromMicroseconds(350001), 15435, 15435); 110 base::TimeDelta::FromMicroseconds(350001), 15435, 15435);
94 } 111 }
95 112
96 TEST_F(AudioFileReaderTest, WaveU8) { 113 TEST_F(AudioFileReaderTest, WaveU8) {
97 RunTest("sfx_u8.wav", "d7e255a8e634fffdf9f744c5803632f8", 1, 44100, 114 RunTest("sfx_u8.wav", "d7e255a8e634fffdf9f744c5803632f8", 1, 44100,
98 base::TimeDelta::FromMicroseconds(288414), 12719, 12719); 115 base::TimeDelta::FromMicroseconds(288414), 12719, 12719);
99 } 116 }
100 TEST_F(AudioFileReaderTest, WaveS16LE) { 117 TEST_F(AudioFileReaderTest, WaveS16LE) {
101 RunTest("sfx_s16le.wav", "2a5847207fdcba1c05e52f65ad010f66", 1, 44100, 118 RunTest("sfx_s16le.wav", "2a5847207fdcba1c05e52f65ad010f66", 1, 44100,
102 base::TimeDelta::FromMicroseconds(288414), 12719, 12719); 119 base::TimeDelta::FromMicroseconds(288414), 12719, 12719);
103 } 120 }
104 TEST_F(AudioFileReaderTest, WaveS24LE) { 121 TEST_F(AudioFileReaderTest, WaveS24LE) {
105 RunTest("sfx_s24le.wav", "66296b4ec633290581f9abf3c21cd5e7", 1, 44100, 122 RunTest("sfx_s24le.wav", "66296b4ec633290581f9abf3c21cd5e7", 1, 44100,
106 base::TimeDelta::FromMicroseconds(288414), 12719, 12719); 123 base::TimeDelta::FromMicroseconds(288414), 12719, 12719);
107 } 124 }
108 125
109 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) 126 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS)
110 TEST_F(AudioFileReaderTest, MP3) { 127 TEST_F(AudioFileReaderTest, MP3) {
111 RunTest("sfx.mp3", "2a5847207fdcba1c05e52f65ad010f66", 1, 44100, 128 // Windows produces slightly different results due to differences in floating
129 // point functions (e.g. sin(), cos(), etc).
130 #if defined(OS_WIN)
131 static const char* kExpectedHash = "0e4a429ff19717bb7bf6d12771d403c9";
132 #else
133 static const char* kExpectedHash = "2a5847207fdcba1c05e52f65ad010f66";
134 #endif
135
136 RunTest("sfx.mp3", kExpectedHash, 1, 44100,
112 base::TimeDelta::FromMicroseconds(313470), 13824, 12719); 137 base::TimeDelta::FromMicroseconds(313470), 13824, 12719);
113 } 138 }
114 139
115 TEST_F(AudioFileReaderTest, AAC) { 140 TEST_F(AudioFileReaderTest, AAC) {
116 RunTest("sfx.m4a", "d4d3207758d1e8cb0aa176ff77fa6932", 1, 44100, 141 // Windows produces slightly different results due to differences in floating
142 // point functions (e.g. sin(), cos(), etc).
143 #if defined(OS_WIN)
144 static const char* kExpectedHash = "c990c7b6979ea8fc3a0b7f6f4b3d5cf2";
145 #else
146 static const char* kExpectedHash = "0ce73ca393bb45672d2daec56979aa3d";
147 #endif
148
149 RunTest("sfx.m4a", kExpectedHash, 1, 44100,
117 base::TimeDelta::FromMicroseconds(312001), 13759, 13312); 150 base::TimeDelta::FromMicroseconds(312001), 13759, 13312);
118 } 151 }
119 #endif 152 #endif
120 153
121 } // namespace media 154 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698