| 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(GetAudioParams(), | 238 return audio_manager_->MakeAudioOutputStream( |
| 239 kDefaultDeviceId); | 239 GetAudioParams(), kDefaultDeviceId, |
| 240 ::media::AudioManager::LogCallback()); |
| 240 } | 241 } |
| 241 | 242 |
| 242 // Runs the messsage loop for duration equivalent to the given number of | 243 // Runs the messsage loop for duration equivalent to the given number of |
| 243 // audio |frames|. | 244 // audio |frames|. |
| 244 void RunMessageLoopFor(int frames) { | 245 void RunMessageLoopFor(int frames) { |
| 245 ::media::AudioParameters audio_params = GetAudioParams(); | 246 ::media::AudioParameters audio_params = GetAudioParams(); |
| 246 base::TimeDelta duration = audio_params.GetBufferDuration() * frames; | 247 base::TimeDelta duration = audio_params.GetBufferDuration() * frames; |
| 247 | 248 |
| 248 base::RunLoop run_loop; | 249 base::RunLoop run_loop; |
| 249 message_loop_.task_runner()->PostDelayedTask( | 250 message_loop_.task_runner()->PostDelayedTask( |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 TEST_F(CastAudioOutputStreamTest, CloseWithoutStart) { | 514 TEST_F(CastAudioOutputStreamTest, CloseWithoutStart) { |
| 514 ::media::AudioOutputStream* stream = CreateStream(); | 515 ::media::AudioOutputStream* stream = CreateStream(); |
| 515 ASSERT_TRUE(stream); | 516 ASSERT_TRUE(stream); |
| 516 ASSERT_TRUE(stream->Open()); | 517 ASSERT_TRUE(stream->Open()); |
| 517 stream->Close(); | 518 stream->Close(); |
| 518 } | 519 } |
| 519 | 520 |
| 520 } // namespace | 521 } // namespace |
| 521 } // namespace media | 522 } // namespace media |
| 522 } // namespace chromecast | 523 } // namespace chromecast |
| OLD | NEW |