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

Side by Side Diff: media/filters/audio_renderer_impl_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: ... rebase Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « media/filters/audio_file_reader_unittest.cc ('k') | media/filters/chunk_demuxer_unittest.cc » ('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 (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/bind.h" 5 #include "base/bind.h"
6 #include "base/callback_helpers.h" 6 #include "base/callback_helpers.h"
7 #include "base/gtest_prod_util.h" 7 #include "base/gtest_prod_util.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "media/base/audio_timestamp_helper.h" 10 #include "media/base/audio_timestamp_helper.h"
(...skipping 21 matching lines...) Expand all
32 static uint8 kPlayingAudio = 0x99; 32 static uint8 kPlayingAudio = 0x99;
33 33
34 class AudioRendererImplTest : public ::testing::Test { 34 class AudioRendererImplTest : public ::testing::Test {
35 public: 35 public:
36 // Give the decoder some non-garbage media properties. 36 // Give the decoder some non-garbage media properties.
37 AudioRendererImplTest() 37 AudioRendererImplTest()
38 : renderer_(new AudioRendererImpl(new NiceMock<MockAudioRendererSink>(), 38 : renderer_(new AudioRendererImpl(new NiceMock<MockAudioRendererSink>(),
39 SetDecryptorReadyCB())), 39 SetDecryptorReadyCB())),
40 demuxer_stream_(new MockDemuxerStream()), 40 demuxer_stream_(new MockDemuxerStream()),
41 decoder_(new MockAudioDecoder()), 41 decoder_(new MockAudioDecoder()),
42 audio_config_(kCodecVorbis, 16, CHANNEL_LAYOUT_STEREO, 42 audio_config_(kCodecVorbis, kSampleFormatPlanarF32,
43 44100, NULL, 0, false) { 43 CHANNEL_LAYOUT_STEREO, 44100, NULL, 0, false) {
44 EXPECT_CALL(*demuxer_stream_, type()) 44 EXPECT_CALL(*demuxer_stream_, type())
45 .WillRepeatedly(Return(DemuxerStream::AUDIO)); 45 .WillRepeatedly(Return(DemuxerStream::AUDIO));
46 EXPECT_CALL(*demuxer_stream_, audio_decoder_config()) 46 EXPECT_CALL(*demuxer_stream_, audio_decoder_config())
47 .WillRepeatedly(ReturnRef(audio_config_)); 47 .WillRepeatedly(ReturnRef(audio_config_));
48 48
49 // Queue all reads from the decoder by default. 49 // Queue all reads from the decoder by default.
50 ON_CALL(*decoder_, Read(_)) 50 ON_CALL(*decoder_, Read(_))
51 .WillByDefault(Invoke(this, &AudioRendererImplTest::SaveReadCallback)); 51 .WillByDefault(Invoke(this, &AudioRendererImplTest::SaveReadCallback));
52 52
53 // Set up audio properties. 53 // Set up audio properties.
54 SetSupportedAudioDecoderProperties(); 54 SetSupportedAudioDecoderProperties();
55 EXPECT_CALL(*decoder_, bits_per_channel()) 55 EXPECT_CALL(*decoder_, bits_per_channel())
56 .Times(AnyNumber()); 56 .Times(AnyNumber());
57 EXPECT_CALL(*decoder_, channel_layout()) 57 EXPECT_CALL(*decoder_, channel_layout())
58 .Times(AnyNumber()); 58 .Times(AnyNumber());
59 EXPECT_CALL(*decoder_, samples_per_second()) 59 EXPECT_CALL(*decoder_, samples_per_second())
60 .Times(AnyNumber()); 60 .Times(AnyNumber());
61 61
62 decoders_.push_back(decoder_); 62 decoders_.push_back(decoder_);
63 } 63 }
64 64
65 virtual ~AudioRendererImplTest() { 65 virtual ~AudioRendererImplTest() {
66 message_loop_.RunUntilIdle(); 66 message_loop_.RunUntilIdle();
67 renderer_->Stop(NewExpectedClosure()); 67 renderer_->Stop(NewExpectedClosure());
68 } 68 }
69 69
70 void SetSupportedAudioDecoderProperties() { 70 void SetSupportedAudioDecoderProperties() {
71 ON_CALL(*decoder_, bits_per_channel()) 71 ON_CALL(*decoder_, bits_per_channel())
72 .WillByDefault(Return(16)); 72 .WillByDefault(Return(audio_config_.bits_per_channel()));
73 ON_CALL(*decoder_, channel_layout()) 73 ON_CALL(*decoder_, channel_layout())
74 .WillByDefault(Return(CHANNEL_LAYOUT_MONO)); 74 .WillByDefault(Return(CHANNEL_LAYOUT_MONO));
75 ON_CALL(*decoder_, samples_per_second()) 75 ON_CALL(*decoder_, samples_per_second())
76 .WillByDefault(Return(44100)); 76 .WillByDefault(Return(audio_config_.samples_per_second()));
77 } 77 }
78 78
79 void SetUnsupportedAudioDecoderProperties() { 79 void SetUnsupportedAudioDecoderProperties() {
80 ON_CALL(*decoder_, bits_per_channel()) 80 ON_CALL(*decoder_, bits_per_channel())
81 .WillByDefault(Return(3)); 81 .WillByDefault(Return(3));
82 ON_CALL(*decoder_, channel_layout()) 82 ON_CALL(*decoder_, channel_layout())
83 .WillByDefault(Return(CHANNEL_LAYOUT_UNSUPPORTED)); 83 .WillByDefault(Return(CHANNEL_LAYOUT_UNSUPPORTED));
84 ON_CALL(*decoder_, samples_per_second()) 84 ON_CALL(*decoder_, samples_per_second())
85 .WillByDefault(Return(0)); 85 .WillByDefault(Return(0));
86 } 86 }
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 EXPECT_TRUE(ConsumeBufferedData(bytes_buffered() / 2, NULL)); 482 EXPECT_TRUE(ConsumeBufferedData(bytes_buffered() / 2, NULL));
483 483
484 renderer_->Pause(NewExpectedClosure()); 484 renderer_->Pause(NewExpectedClosure());
485 485
486 AbortPendingRead(); 486 AbortPendingRead();
487 487
488 Preroll(base::TimeDelta::FromSeconds(1)); 488 Preroll(base::TimeDelta::FromSeconds(1));
489 } 489 }
490 490
491 } // namespace media 491 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/audio_file_reader_unittest.cc ('k') | media/filters/chunk_demuxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698