| 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" |
| 6 |
| 5 #include <stddef.h> | 7 #include <stddef.h> |
| 6 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> |
| 7 | 10 |
| 8 #include "base/bind.h" | 11 #include "base/bind.h" |
| 9 #include "base/macros.h" | 12 #include "base/macros.h" |
| 10 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
| 11 #include "chromecast/base/metrics/cast_metrics_test_helper.h" | 14 #include "chromecast/base/metrics/cast_metrics_test_helper.h" |
| 12 #include "chromecast/media/audio/cast_audio_manager.h" | 15 #include "chromecast/media/audio/cast_audio_manager.h" |
| 13 #include "chromecast/media/audio/cast_audio_output_stream.h" | |
| 14 #include "chromecast/media/base/media_message_loop.h" | 16 #include "chromecast/media/base/media_message_loop.h" |
| 15 #include "chromecast/media/cma/backend/media_pipeline_backend_default.h" | 17 #include "chromecast/media/cma/backend/media_pipeline_backend_default.h" |
| 16 #include "chromecast/public/media/cast_decoder_buffer.h" | 18 #include "chromecast/public/media/cast_decoder_buffer.h" |
| 17 #include "chromecast/public/media/decoder_config.h" | 19 #include "chromecast/public/media/decoder_config.h" |
| 18 #include "chromecast/public/media/decrypt_context.h" | 20 #include "chromecast/public/media/decrypt_context.h" |
| 19 #include "chromecast/public/media/media_pipeline_backend.h" | 21 #include "chromecast/public/media/media_pipeline_backend.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 23 |
| 22 namespace chromecast { | 24 namespace chromecast { |
| 23 namespace media { | 25 namespace media { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 // CastAudioManager overrides. | 191 // CastAudioManager overrides. |
| 190 scoped_ptr<MediaPipelineBackend> CreateMediaPipelineBackend( | 192 scoped_ptr<MediaPipelineBackend> CreateMediaPipelineBackend( |
| 191 const MediaPipelineDeviceParams& params) override { | 193 const MediaPipelineDeviceParams& params) override { |
| 192 DCHECK(media::MediaMessageLoop::GetTaskRunner()->BelongsToCurrentThread()); | 194 DCHECK(media::MediaMessageLoop::GetTaskRunner()->BelongsToCurrentThread()); |
| 193 DCHECK(!media_pipeline_backend_); | 195 DCHECK(!media_pipeline_backend_); |
| 194 | 196 |
| 195 scoped_ptr<FakeMediaPipelineBackend> backend( | 197 scoped_ptr<FakeMediaPipelineBackend> backend( |
| 196 new FakeMediaPipelineBackend()); | 198 new FakeMediaPipelineBackend()); |
| 197 // Cache the backend locally to be used by tests. | 199 // Cache the backend locally to be used by tests. |
| 198 media_pipeline_backend_ = backend.get(); | 200 media_pipeline_backend_ = backend.get(); |
| 199 return backend.Pass(); | 201 return std::move(backend); |
| 200 } | 202 } |
| 201 void ReleaseOutputStream(::media::AudioOutputStream* stream) override { | 203 void ReleaseOutputStream(::media::AudioOutputStream* stream) override { |
| 202 DCHECK(media_pipeline_backend_); | 204 DCHECK(media_pipeline_backend_); |
| 203 media_pipeline_backend_ = nullptr; | 205 media_pipeline_backend_ = nullptr; |
| 204 CastAudioManager::ReleaseOutputStream(stream); | 206 CastAudioManager::ReleaseOutputStream(stream); |
| 205 } | 207 } |
| 206 | 208 |
| 207 // Returns the MediaPipelineBackend being used by the AudioOutputStream. | 209 // Returns the MediaPipelineBackend being used by the AudioOutputStream. |
| 208 // Note: here is a valid MediaPipelineBackend only while the stream is open. | 210 // Note: here is a valid MediaPipelineBackend only while the stream is open. |
| 209 // Returns NULL at all other times. | 211 // Returns NULL at all other times. |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 TEST_F(CastAudioOutputStreamTest, CloseWithoutStart) { | 647 TEST_F(CastAudioOutputStreamTest, CloseWithoutStart) { |
| 646 ::media::AudioOutputStream* stream = CreateStream(); | 648 ::media::AudioOutputStream* stream = CreateStream(); |
| 647 ASSERT_TRUE(stream); | 649 ASSERT_TRUE(stream); |
| 648 ASSERT_TRUE(OpenStream(stream)); | 650 ASSERT_TRUE(OpenStream(stream)); |
| 649 CloseStream(stream); | 651 CloseStream(stream); |
| 650 } | 652 } |
| 651 | 653 |
| 652 } // namespace | 654 } // namespace |
| 653 } // namespace media | 655 } // namespace media |
| 654 } // namespace chromecast | 656 } // namespace chromecast |
| OLD | NEW |