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

Side by Side Diff: media/cast/audio_receiver/audio_decoder_unittest.cc

Issue 306783002: [Cast] Clean-up: Merge AudioReceiverConfig+VideoReceiverConfig-->FrameReceiverConfig. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed kFakeSoftwareAudio in AudioCodec enum, per hclam@. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « media/cast/audio_receiver/audio_decoder.cc ('k') | media/cast/audio_receiver/audio_receiver.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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"
11 #include "media/cast/audio_receiver/audio_decoder.h" 11 #include "media/cast/audio_receiver/audio_decoder.h"
12 #include "media/cast/cast_config.h" 12 #include "media/cast/cast_config.h"
13 #include "media/cast/test/utility/audio_utility.h" 13 #include "media/cast/test/utility/audio_utility.h"
14 #include "media/cast/test/utility/default_config.h"
14 #include "media/cast/test/utility/standalone_cast_environment.h" 15 #include "media/cast/test/utility/standalone_cast_environment.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 #include "third_party/opus/src/include/opus.h" 17 #include "third_party/opus/src/include/opus.h"
17 18
18 namespace media { 19 namespace media {
19 namespace cast { 20 namespace cast {
20 21
21 namespace { 22 namespace {
22 struct TestScenario { 23 struct TestScenario {
23 transport::AudioCodec codec; 24 transport::AudioCodec codec;
24 int num_channels; 25 int num_channels;
25 int sampling_rate; 26 int sampling_rate;
26 27
27 TestScenario(transport::AudioCodec c, int n, int s) 28 TestScenario(transport::AudioCodec c, int n, int s)
28 : codec(c), num_channels(n), sampling_rate(s) {} 29 : codec(c), num_channels(n), sampling_rate(s) {}
29 }; 30 };
30 } // namespace 31 } // namespace
31 32
32 class AudioDecoderTest : public ::testing::TestWithParam<TestScenario> { 33 class AudioDecoderTest : public ::testing::TestWithParam<TestScenario> {
33 public: 34 public:
34 AudioDecoderTest() 35 AudioDecoderTest()
35 : cast_environment_(new StandaloneCastEnvironment()), 36 : cast_environment_(new StandaloneCastEnvironment()),
36 cond_(&lock_) {} 37 cond_(&lock_) {}
37 38
38 protected: 39 protected:
39 virtual void SetUp() OVERRIDE { 40 virtual void SetUp() OVERRIDE {
40 AudioReceiverConfig decoder_config; 41 FrameReceiverConfig decoder_config = GetDefaultAudioReceiverConfig();
41 decoder_config.use_external_decoder = false;
42 decoder_config.frequency = GetParam().sampling_rate; 42 decoder_config.frequency = GetParam().sampling_rate;
43 decoder_config.channels = GetParam().num_channels; 43 decoder_config.channels = GetParam().num_channels;
44 decoder_config.codec = GetParam().codec; 44 decoder_config.codec.audio = GetParam().codec;
45 audio_decoder_.reset(new AudioDecoder(cast_environment_, decoder_config)); 45 audio_decoder_.reset(new AudioDecoder(cast_environment_, decoder_config));
46 CHECK_EQ(STATUS_AUDIO_INITIALIZED, audio_decoder_->InitializationResult()); 46 CHECK_EQ(STATUS_AUDIO_INITIALIZED, audio_decoder_->InitializationResult());
47 47
48 audio_bus_factory_.reset( 48 audio_bus_factory_.reset(
49 new TestAudioBusFactory(GetParam().num_channels, 49 new TestAudioBusFactory(GetParam().num_channels,
50 GetParam().sampling_rate, 50 GetParam().sampling_rate,
51 TestAudioBusFactory::kMiddleANoteFreq, 51 TestAudioBusFactory::kMiddleANoteFreq,
52 0.5f)); 52 0.5f));
53 last_frame_id_ = 0; 53 last_frame_id_ = 0;
54 seen_a_decoded_frame_ = false; 54 seen_a_decoded_frame_ = false;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 INSTANTIATE_TEST_CASE_P(AudioDecoderTestScenarios, 234 INSTANTIATE_TEST_CASE_P(AudioDecoderTestScenarios,
235 AudioDecoderTest, 235 AudioDecoderTest,
236 ::testing::Values( 236 ::testing::Values(
237 TestScenario(transport::kPcm16, 1, 8000), 237 TestScenario(transport::kPcm16, 1, 8000),
238 TestScenario(transport::kPcm16, 2, 48000), 238 TestScenario(transport::kPcm16, 2, 48000),
239 TestScenario(transport::kOpus, 1, 8000), 239 TestScenario(transport::kOpus, 1, 8000),
240 TestScenario(transport::kOpus, 2, 48000))); 240 TestScenario(transport::kOpus, 2, 48000)));
241 241
242 } // namespace cast 242 } // namespace cast
243 } // namespace media 243 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/audio_receiver/audio_decoder.cc ('k') | media/cast/audio_receiver/audio_receiver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698