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

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

Issue 1786733004: Revert of media config: expand is_encrypted to a struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 EXPECT_EQ(GetParam().first_packet_pts, packet.pts); 187 EXPECT_EQ(GetParam().first_packet_pts, packet.pts);
188 start_timestamp_ = ConvertFromTimeBase( 188 start_timestamp_ = ConvertFromTimeBase(
189 reader_->GetAVStreamForTesting()->time_base, packet.pts); 189 reader_->GetAVStreamForTesting()->time_base, packet.pts);
190 av_packet_unref(&packet); 190 av_packet_unref(&packet);
191 191
192 // Seek back to the beginning. 192 // Seek back to the beginning.
193 ASSERT_TRUE(reader_->SeekForTesting(start_timestamp_)); 193 ASSERT_TRUE(reader_->SeekForTesting(start_timestamp_));
194 194
195 AudioDecoderConfig config; 195 AudioDecoderConfig config;
196 ASSERT_TRUE(AVCodecContextToAudioDecoderConfig( 196 ASSERT_TRUE(AVCodecContextToAudioDecoderConfig(
197 reader_->codec_context_for_testing(), Unencrypted(), &config)); 197 reader_->codec_context_for_testing(), false, &config));
198 198
199 EXPECT_EQ(GetParam().codec, config.codec()); 199 EXPECT_EQ(GetParam().codec, config.codec());
200 EXPECT_EQ(GetParam().samples_per_second, config.samples_per_second()); 200 EXPECT_EQ(GetParam().samples_per_second, config.samples_per_second());
201 EXPECT_EQ(GetParam().channel_layout, config.channel_layout()); 201 EXPECT_EQ(GetParam().channel_layout, config.channel_layout());
202 202
203 InitializeDecoder(config); 203 InitializeDecoder(config);
204 } 204 }
205 205
206 void InitializeDecoder(const AudioDecoderConfig& config) { 206 void InitializeDecoder(const AudioDecoderConfig& config) {
207 InitializeDecoderWithResult(config, true); 207 InitializeDecoderWithResult(config, true);
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 DecodeBuffer(buffer); 426 DecodeBuffer(buffer);
427 EXPECT_EQ(AudioDecoder::kDecodeError, last_decode_status()); 427 EXPECT_EQ(AudioDecoder::kDecodeError, last_decode_status());
428 } 428 }
429 429
430 TEST_P(OpusAudioDecoderBehavioralTest, InitializeWithNoCodecDelay) { 430 TEST_P(OpusAudioDecoderBehavioralTest, InitializeWithNoCodecDelay) {
431 ASSERT_EQ(GetParam().decoder_type, OPUS); 431 ASSERT_EQ(GetParam().decoder_type, OPUS);
432 std::vector<uint8_t> extra_data( 432 std::vector<uint8_t> extra_data(
433 kOpusExtraData, 433 kOpusExtraData,
434 kOpusExtraData + arraysize(kOpusExtraData)); 434 kOpusExtraData + arraysize(kOpusExtraData));
435 AudioDecoderConfig decoder_config; 435 AudioDecoderConfig decoder_config;
436 decoder_config.Initialize(kCodecOpus, kSampleFormatF32, CHANNEL_LAYOUT_STEREO, 436 decoder_config.Initialize(kCodecOpus,
437 48000, extra_data, Unencrypted(), 437 kSampleFormatF32,
438 base::TimeDelta::FromMilliseconds(80), 0); 438 CHANNEL_LAYOUT_STEREO,
439 48000,
440 extra_data,
441 false,
442 base::TimeDelta::FromMilliseconds(80),
443 0);
439 InitializeDecoder(decoder_config); 444 InitializeDecoder(decoder_config);
440 } 445 }
441 446
442 TEST_P(OpusAudioDecoderBehavioralTest, InitializeWithBadCodecDelay) { 447 TEST_P(OpusAudioDecoderBehavioralTest, InitializeWithBadCodecDelay) {
443 ASSERT_EQ(GetParam().decoder_type, OPUS); 448 ASSERT_EQ(GetParam().decoder_type, OPUS);
444 std::vector<uint8_t> extra_data( 449 std::vector<uint8_t> extra_data(
445 kOpusExtraData, 450 kOpusExtraData,
446 kOpusExtraData + arraysize(kOpusExtraData)); 451 kOpusExtraData + arraysize(kOpusExtraData));
447 AudioDecoderConfig decoder_config; 452 AudioDecoderConfig decoder_config;
448 decoder_config.Initialize( 453 decoder_config.Initialize(
449 kCodecOpus, kSampleFormatF32, CHANNEL_LAYOUT_STEREO, 48000, extra_data, 454 kCodecOpus,
450 Unencrypted(), base::TimeDelta::FromMilliseconds(80), 455 kSampleFormatF32,
456 CHANNEL_LAYOUT_STEREO,
457 48000,
458 extra_data,
459 false,
460 base::TimeDelta::FromMilliseconds(80),
451 // Use a different codec delay than in the extradata. 461 // Use a different codec delay than in the extradata.
452 100); 462 100);
453 InitializeDecoderWithResult(decoder_config, true); 463 InitializeDecoderWithResult(decoder_config, true);
454 } 464 }
455 465
456 #if defined(OPUS_FIXED_POINT) 466 #if defined(OPUS_FIXED_POINT)
457 const DecodedBufferExpectations kSfxOpusExpectations[] = { 467 const DecodedBufferExpectations kSfxOpusExpectations[] = {
458 {0, 13500, "-2.70,-1.41,-0.78,-1.27,-2.56,-3.73,"}, 468 {0, 13500, "-2.70,-1.41,-0.78,-1.27,-2.56,-3.73,"},
459 {13500, 20000, "5.48,5.93,6.05,5.83,5.54,5.46,"}, 469 {13500, 20000, "5.48,5.93,6.05,5.83,5.54,5.46,"},
460 {33500, 20000, "-3.44,-3.34,-3.57,-4.11,-4.74,-5.13,"}, 470 {33500, 20000, "-3.44,-3.34,-3.57,-4.11,-4.74,-5.13,"},
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 }; 588 };
579 589
580 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderTest, 590 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderTest,
581 AudioDecoderTest, 591 AudioDecoderTest,
582 testing::ValuesIn(kFFmpegTests)); 592 testing::ValuesIn(kFFmpegTests));
583 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderBehavioralTest, 593 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderBehavioralTest,
584 FFmpegAudioDecoderBehavioralTest, 594 FFmpegAudioDecoderBehavioralTest,
585 testing::ValuesIn(kFFmpegBehavioralTest)); 595 testing::ValuesIn(kFFmpegBehavioralTest));
586 596
587 } // namespace media 597 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/audio_decoder_selector_unittest.cc ('k') | media/filters/decrypting_audio_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698