| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/cma/backend/media_pipeline_backend_wrapper.h" | 5 #include "chromecast/media/cma/backend/media_pipeline_backend_wrapper.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chromecast/media/cma/backend/media_pipeline_backend_manager.h" | 8 #include "chromecast/media/cma/backend/media_pipeline_backend_manager.h" |
| 9 | 9 |
| 10 namespace chromecast { | 10 namespace chromecast { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 MediaPipelineBackendWrapper::~MediaPipelineBackendWrapper() { | 27 MediaPipelineBackendWrapper::~MediaPipelineBackendWrapper() { |
| 28 backend_manager_->OnMediaPipelineBackendDestroyed(this); | 28 backend_manager_->OnMediaPipelineBackendDestroyed(this); |
| 29 } | 29 } |
| 30 | 30 |
| 31 MediaPipelineBackend::AudioDecoder* | 31 MediaPipelineBackend::AudioDecoder* |
| 32 MediaPipelineBackendWrapper::CreateAudioDecoder() { | 32 MediaPipelineBackendWrapper::CreateAudioDecoder() { |
| 33 DCHECK(!is_initialized_); | 33 DCHECK(!is_initialized_); |
| 34 if (audio_decoder_wrapper_) | 34 if (audio_decoder_wrapper_) |
| 35 return nullptr; | 35 return nullptr; |
| 36 | 36 |
| 37 if (!backend_manager_->CanCreateAudioDecoder(this)) |
| 38 return nullptr; |
| 39 |
| 37 audio_decoder_wrapper_.reset( | 40 audio_decoder_wrapper_.reset( |
| 38 new AudioDecoderWrapper(backend_->CreateAudioDecoder())); | 41 new AudioDecoderWrapper(backend_->CreateAudioDecoder())); |
| 39 return audio_decoder_wrapper_.get(); | 42 return audio_decoder_wrapper_.get(); |
| 40 } | 43 } |
| 41 | 44 |
| 42 MediaPipelineBackend::VideoDecoder* | 45 MediaPipelineBackend::VideoDecoder* |
| 43 MediaPipelineBackendWrapper::CreateVideoDecoder() { | 46 MediaPipelineBackendWrapper::CreateVideoDecoder() { |
| 44 DCHECK(!is_initialized_); | 47 DCHECK(!is_initialized_); |
| 48 if (!backend_manager_->CanCreateVideoDecoder(this)) |
| 49 return nullptr; |
| 50 |
| 45 return backend_->CreateVideoDecoder(); | 51 return backend_->CreateVideoDecoder(); |
| 46 } | 52 } |
| 47 | 53 |
| 48 bool MediaPipelineBackendWrapper::Initialize() { | 54 bool MediaPipelineBackendWrapper::Initialize() { |
| 49 DCHECK(!is_initialized_); | 55 DCHECK(!is_initialized_); |
| 50 is_initialized_ = backend_->Initialize(); | 56 is_initialized_ = backend_->Initialize(); |
| 51 if (is_initialized_ && audio_decoder_wrapper_) | 57 if (is_initialized_ && audio_decoder_wrapper_) |
| 52 audio_decoder_wrapper_->SetStreamTypeVolume(stream_type_volume_); | 58 audio_decoder_wrapper_->SetStreamTypeVolume(stream_type_volume_); |
| 53 | 59 |
| 54 return is_initialized_; | 60 return is_initialized_; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 84 | 90 |
| 85 void MediaPipelineBackendWrapper::SetStreamTypeVolume( | 91 void MediaPipelineBackendWrapper::SetStreamTypeVolume( |
| 86 float stream_type_volume) { | 92 float stream_type_volume) { |
| 87 stream_type_volume_ = stream_type_volume; | 93 stream_type_volume_ = stream_type_volume; |
| 88 if (is_initialized_ && audio_decoder_wrapper_) | 94 if (is_initialized_ && audio_decoder_wrapper_) |
| 89 audio_decoder_wrapper_->SetStreamTypeVolume(stream_type_volume_); | 95 audio_decoder_wrapper_->SetStreamTypeVolume(stream_type_volume_); |
| 90 } | 96 } |
| 91 | 97 |
| 92 } // namespace media | 98 } // namespace media |
| 93 } // namespace chromecast | 99 } // namespace chromecast |
| OLD | NEW |