OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chromecast/media/audio/cast_audio_output_stream.h" | 5 #include "chromecast/media/audio/cast_audio_output_stream.h" |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "chromecast/base/metrics/cast_metrics_test_helper.h" | 8 #include "chromecast/base/metrics/cast_metrics_test_helper.h" |
9 #include "chromecast/media/audio/cast_audio_manager.h" | 9 #include "chromecast/media/audio/cast_audio_manager.h" |
10 #include "chromecast/public/media/cast_decoder_buffer.h" | 10 #include "chromecast/public/media/cast_decoder_buffer.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 FakeMediaPipelineBackend* GetBackend() { | 228 FakeMediaPipelineBackend* GetBackend() { |
229 return audio_manager_->media_pipeline_backend(); | 229 return audio_manager_->media_pipeline_backend(); |
230 } | 230 } |
231 | 231 |
232 FakeAudioDecoder* GetAudio() { | 232 FakeAudioDecoder* GetAudio() { |
233 FakeMediaPipelineBackend* backend = GetBackend(); | 233 FakeMediaPipelineBackend* backend = GetBackend(); |
234 return (backend ? backend->decoder() : nullptr); | 234 return (backend ? backend->decoder() : nullptr); |
235 } | 235 } |
236 | 236 |
237 ::media::AudioOutputStream* CreateStream() { | 237 ::media::AudioOutputStream* CreateStream() { |
238 return audio_manager_->MakeAudioOutputStream( | 238 return audio_manager_->MakeAudioOutputStream(GetAudioParams(), |
239 GetAudioParams(), kDefaultDeviceId, | 239 kDefaultDeviceId); |
240 ::media::AudioManager::LogCallback()); | |
241 } | 240 } |
242 | 241 |
243 // Runs the messsage loop for duration equivalent to the given number of | 242 // Runs the messsage loop for duration equivalent to the given number of |
244 // audio |frames|. | 243 // audio |frames|. |
245 void RunMessageLoopFor(int frames) { | 244 void RunMessageLoopFor(int frames) { |
246 ::media::AudioParameters audio_params = GetAudioParams(); | 245 ::media::AudioParameters audio_params = GetAudioParams(); |
247 base::TimeDelta duration = audio_params.GetBufferDuration() * frames; | 246 base::TimeDelta duration = audio_params.GetBufferDuration() * frames; |
248 | 247 |
249 base::RunLoop run_loop; | 248 base::RunLoop run_loop; |
250 message_loop_.task_runner()->PostDelayedTask( | 249 message_loop_.task_runner()->PostDelayedTask( |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 TEST_F(CastAudioOutputStreamTest, CloseWithoutStart) { | 513 TEST_F(CastAudioOutputStreamTest, CloseWithoutStart) { |
515 ::media::AudioOutputStream* stream = CreateStream(); | 514 ::media::AudioOutputStream* stream = CreateStream(); |
516 ASSERT_TRUE(stream); | 515 ASSERT_TRUE(stream); |
517 ASSERT_TRUE(stream->Open()); | 516 ASSERT_TRUE(stream->Open()); |
518 stream->Close(); | 517 stream->Close(); |
519 } | 518 } |
520 | 519 |
521 } // namespace | 520 } // namespace |
522 } // namespace media | 521 } // namespace media |
523 } // namespace chromecast | 522 } // namespace chromecast |
OLD | NEW |