OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/synchronization/condition_variable.h" | 7 #include "base/synchronization/condition_variable.h" |
8 #include "base/synchronization/lock.h" | 8 #include "base/synchronization/lock.h" |
9 #include "base/sys_byteorder.h" | 9 #include "base/sys_byteorder.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 scoped_ptr<uint8[]> opus_encoder_memory_; | 183 scoped_ptr<uint8[]> opus_encoder_memory_; |
184 | 184 |
185 base::Lock lock_; | 185 base::Lock lock_; |
186 base::ConditionVariable cond_; | 186 base::ConditionVariable cond_; |
187 base::TimeDelta total_audio_feed_in_; | 187 base::TimeDelta total_audio_feed_in_; |
188 base::TimeDelta total_audio_decoded_; | 188 base::TimeDelta total_audio_decoded_; |
189 | 189 |
190 DISALLOW_COPY_AND_ASSIGN(AudioDecoderTest); | 190 DISALLOW_COPY_AND_ASSIGN(AudioDecoderTest); |
191 }; | 191 }; |
192 | 192 |
193 #if !defined(OS_LINUX) | |
194 // http://crbug.com/396480 | |
193 TEST_P(AudioDecoderTest, DecodesFramesWithSameDuration) { | 195 TEST_P(AudioDecoderTest, DecodesFramesWithSameDuration) { |
viettrungluu
2014/07/23 15:26:42
You can't disable a parametrized test (TEST_P) usi
jam
2014/07/23 16:02:06
ah i wasn't sure, just tested and done
| |
194 const base::TimeDelta kTenMilliseconds = | 196 const base::TimeDelta kTenMilliseconds = |
195 base::TimeDelta::FromMilliseconds(10); | 197 base::TimeDelta::FromMilliseconds(10); |
196 const int kNumFrames = 10; | 198 const int kNumFrames = 10; |
197 for (int i = 0; i < kNumFrames; ++i) | 199 for (int i = 0; i < kNumFrames; ++i) |
198 FeedMoreAudio(kTenMilliseconds, 0); | 200 FeedMoreAudio(kTenMilliseconds, 0); |
199 WaitForAllAudioToBeDecoded(); | 201 WaitForAllAudioToBeDecoded(); |
200 } | 202 } |
201 | 203 |
202 TEST_P(AudioDecoderTest, DecodesFramesWithVaryingDuration) { | 204 TEST_P(AudioDecoderTest, DecodesFramesWithVaryingDuration) { |
203 // These are the set of frame durations supported by the Opus encoder. | 205 // These are the set of frame durations supported by the Opus encoder. |
204 const int kFrameDurationMs[] = { 5, 10, 20, 40, 60 }; | 206 const int kFrameDurationMs[] = { 5, 10, 20, 40, 60 }; |
205 | 207 |
206 const int kNumFrames = 10; | 208 const int kNumFrames = 10; |
207 for (size_t i = 0; i < arraysize(kFrameDurationMs); ++i) | 209 for (size_t i = 0; i < arraysize(kFrameDurationMs); ++i) |
208 for (int j = 0; j < kNumFrames; ++j) | 210 for (int j = 0; j < kNumFrames; ++j) |
209 FeedMoreAudio(base::TimeDelta::FromMilliseconds(kFrameDurationMs[i]), 0); | 211 FeedMoreAudio(base::TimeDelta::FromMilliseconds(kFrameDurationMs[i]), 0); |
210 WaitForAllAudioToBeDecoded(); | 212 WaitForAllAudioToBeDecoded(); |
211 } | 213 } |
214 #endif | |
212 | 215 |
213 TEST_P(AudioDecoderTest, RecoversFromDroppedFrames) { | 216 TEST_P(AudioDecoderTest, RecoversFromDroppedFrames) { |
214 const base::TimeDelta kTenMilliseconds = | 217 const base::TimeDelta kTenMilliseconds = |
215 base::TimeDelta::FromMilliseconds(10); | 218 base::TimeDelta::FromMilliseconds(10); |
216 const int kNumFrames = 100; | 219 const int kNumFrames = 100; |
217 int next_drop_at = 3; | 220 int next_drop_at = 3; |
218 int next_num_dropped = 1; | 221 int next_num_dropped = 1; |
219 for (int i = 0; i < kNumFrames; ++i) { | 222 for (int i = 0; i < kNumFrames; ++i) { |
220 if (i == next_drop_at) { | 223 if (i == next_drop_at) { |
221 const int num_dropped = next_num_dropped++; | 224 const int num_dropped = next_num_dropped++; |
(...skipping 11 matching lines...) Expand all Loading... | |
233 AudioDecoderTestScenarios, | 236 AudioDecoderTestScenarios, |
234 AudioDecoderTest, | 237 AudioDecoderTest, |
235 ::testing::Values( | 238 ::testing::Values( |
236 TestScenario(CODEC_AUDIO_PCM16, 1, 8000), | 239 TestScenario(CODEC_AUDIO_PCM16, 1, 8000), |
237 TestScenario(CODEC_AUDIO_PCM16, 2, 48000), | 240 TestScenario(CODEC_AUDIO_PCM16, 2, 48000), |
238 TestScenario(CODEC_AUDIO_OPUS, 1, 8000), | 241 TestScenario(CODEC_AUDIO_OPUS, 1, 8000), |
239 TestScenario(CODEC_AUDIO_OPUS, 2, 48000))); | 242 TestScenario(CODEC_AUDIO_OPUS, 2, 48000))); |
240 | 243 |
241 } // namespace cast | 244 } // namespace cast |
242 } // namespace media | 245 } // namespace media |
OLD | NEW |