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

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

Issue 1146913008: Revert of media: Simplify {Audio|Video}Decoder initialization callback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months 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
« no previous file with comments | « media/filters/audio_decoder_selector_unittest.cc ('k') | media/filters/decoder_selector.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <deque> 5 #include <deque>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/md5.h" 9 #include "base/md5.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 reader_->codec_context_for_testing(), false, &config, false); 154 reader_->codec_context_for_testing(), false, &config, false);
155 155
156 EXPECT_EQ(GetParam().codec, config.codec()); 156 EXPECT_EQ(GetParam().codec, config.codec());
157 EXPECT_EQ(GetParam().samples_per_second, config.samples_per_second()); 157 EXPECT_EQ(GetParam().samples_per_second, config.samples_per_second());
158 EXPECT_EQ(GetParam().channel_layout, config.channel_layout()); 158 EXPECT_EQ(GetParam().channel_layout, config.channel_layout());
159 159
160 InitializeDecoder(config); 160 InitializeDecoder(config);
161 } 161 }
162 162
163 void InitializeDecoder(const AudioDecoderConfig& config) { 163 void InitializeDecoder(const AudioDecoderConfig& config) {
164 InitializeDecoderWithResult(config, true); 164 InitializeDecoderWithStatus(config, PIPELINE_OK);
165 } 165 }
166 166
167 void InitializeDecoderWithResult(const AudioDecoderConfig& config, 167 void InitializeDecoderWithStatus(const AudioDecoderConfig& config,
168 bool success) { 168 PipelineStatus status) {
169 decoder_->Initialize( 169 decoder_->Initialize(
170 config, NewExpectedBoolCB(success), 170 config,
171 NewExpectedStatusCB(status),
171 base::Bind(&AudioDecoderTest::OnDecoderOutput, base::Unretained(this))); 172 base::Bind(&AudioDecoderTest::OnDecoderOutput, base::Unretained(this)));
172 base::RunLoop().RunUntilIdle(); 173 base::RunLoop().RunUntilIdle();
173 } 174 }
174 175
175 void Decode() { 176 void Decode() {
176 AVPacket packet; 177 AVPacket packet;
177 ASSERT_TRUE(reader_->ReadPacketForTesting(&packet)); 178 ASSERT_TRUE(reader_->ReadPacketForTesting(&packet));
178 179
179 // Split out packet metadata before making a copy. 180 // Split out packet metadata before making a copy.
180 av_packet_split_side_data(&packet); 181 av_packet_split_side_data(&packet);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 kSampleFormatF32, 396 kSampleFormatF32,
396 CHANNEL_LAYOUT_STEREO, 397 CHANNEL_LAYOUT_STEREO,
397 48000, 398 48000,
398 kOpusExtraData, 399 kOpusExtraData,
399 arraysize(kOpusExtraData), 400 arraysize(kOpusExtraData),
400 false, 401 false,
401 false, 402 false,
402 base::TimeDelta::FromMilliseconds(80), 403 base::TimeDelta::FromMilliseconds(80),
403 // Use a different codec delay than in the extradata. 404 // Use a different codec delay than in the extradata.
404 100); 405 100);
405 InitializeDecoderWithResult(decoder_config, false); 406 InitializeDecoderWithStatus(decoder_config, DECODER_ERROR_NOT_SUPPORTED);
406 } 407 }
407 408
408 TEST_P(FFmpegAudioDecoderBehavioralTest, InitializeWithBadConfig) { 409 TEST_P(FFmpegAudioDecoderBehavioralTest, InitializeWithBadConfig) {
409 const AudioDecoderConfig decoder_config(kCodecVorbis, 410 const AudioDecoderConfig decoder_config(kCodecVorbis,
410 kSampleFormatF32, 411 kSampleFormatF32,
411 CHANNEL_LAYOUT_STEREO, 412 CHANNEL_LAYOUT_STEREO,
412 // Invalid sample rate of zero. 413 // Invalid sample rate of zero.
413 0, 414 0,
414 NULL, 415 NULL,
415 0, 416 0,
416 false); 417 false);
417 InitializeDecoderWithResult(decoder_config, false); 418 InitializeDecoderWithStatus(decoder_config, DECODER_ERROR_NOT_SUPPORTED);
418 } 419 }
419 420
420 const DecodedBufferExpectations kSfxOpusExpectations[] = { 421 const DecodedBufferExpectations kSfxOpusExpectations[] = {
421 {0, 13500, "-2.70,-1.41,-0.78,-1.27,-2.56,-3.73,"}, 422 {0, 13500, "-2.70,-1.41,-0.78,-1.27,-2.56,-3.73,"},
422 {13500, 20000, "5.48,5.93,6.04,5.83,5.54,5.45,"}, 423 {13500, 20000, "5.48,5.93,6.04,5.83,5.54,5.45,"},
423 {33500, 20000, "-3.45,-3.35,-3.57,-4.12,-4.74,-5.14,"}, 424 {33500, 20000, "-3.45,-3.35,-3.57,-4.12,-4.74,-5.14,"},
424 }; 425 };
425 426
426 const DecodedBufferExpectations kBearOpusExpectations[] = { 427 const DecodedBufferExpectations kBearOpusExpectations[] = {
427 {500, 3500, "-0.26,0.87,1.36,0.84,-0.30,-1.22,"}, 428 {500, 3500, "-0.26,0.87,1.36,0.84,-0.30,-1.22,"},
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 }; 524 };
524 525
525 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderTest, 526 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderTest,
526 AudioDecoderTest, 527 AudioDecoderTest,
527 testing::ValuesIn(kFFmpegTests)); 528 testing::ValuesIn(kFFmpegTests));
528 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderBehavioralTest, 529 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderBehavioralTest,
529 FFmpegAudioDecoderBehavioralTest, 530 FFmpegAudioDecoderBehavioralTest,
530 testing::ValuesIn(kFFmpegBehavioralTest)); 531 testing::ValuesIn(kFFmpegBehavioralTest));
531 532
532 } // namespace media 533 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/audio_decoder_selector_unittest.cc ('k') | media/filters/decoder_selector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698