| 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/cma/backend/video_pipeline_device_default.h" | 5 #include "chromecast/media/cma/backend/video_pipeline_device_default.h" |
| 6 | 6 |
| 7 #include "chromecast/media/cma/backend/media_component_device_default.h" | 7 #include "chromecast/media/cma/backend/media_component_device_default.h" |
| 8 | 8 |
| 9 namespace chromecast { | 9 namespace chromecast { |
| 10 namespace media { | 10 namespace media { |
| 11 | 11 |
| 12 VideoPipelineDeviceDefault::VideoPipelineDeviceDefault( | 12 VideoPipelineDeviceDefault::VideoPipelineDeviceDefault( |
| 13 const MediaPipelineDeviceParams& params, |
| 13 MediaClockDevice* media_clock_device) | 14 MediaClockDevice* media_clock_device) |
| 14 : pipeline_(new MediaComponentDeviceDefault(media_clock_device)) { | 15 : pipeline_(new MediaComponentDeviceDefault(params, media_clock_device)) { |
| 15 DetachFromThread(); | 16 thread_checker_.DetachFromThread(); |
| 16 } | 17 } |
| 17 | 18 |
| 18 VideoPipelineDeviceDefault::~VideoPipelineDeviceDefault() { | 19 VideoPipelineDeviceDefault::~VideoPipelineDeviceDefault() { |
| 19 } | 20 } |
| 20 | 21 |
| 21 void VideoPipelineDeviceDefault::SetClient(const Client& client) { | 22 void VideoPipelineDeviceDefault::SetClient(Client* client) { |
| 22 pipeline_->SetClient(client); | 23 pipeline_->SetClient(client); |
| 23 } | 24 } |
| 24 | 25 |
| 25 MediaComponentDevice::State VideoPipelineDeviceDefault::GetState() const { | 26 MediaComponentDevice::State VideoPipelineDeviceDefault::GetState() const { |
| 26 return pipeline_->GetState(); | 27 return pipeline_->GetState(); |
| 27 } | 28 } |
| 28 | 29 |
| 29 bool VideoPipelineDeviceDefault::SetState(State new_state) { | 30 bool VideoPipelineDeviceDefault::SetState(State new_state) { |
| 30 bool success = pipeline_->SetState(new_state); | 31 bool success = pipeline_->SetState(new_state); |
| 31 if (!success) | 32 if (!success) |
| 32 return false; | 33 return false; |
| 33 | 34 |
| 34 if (new_state == kStateIdle) { | 35 if (new_state == kStateIdle) { |
| 35 DCHECK(IsValidConfig(config_)); | 36 DCHECK(IsValidConfig(config_)); |
| 36 } | 37 } |
| 37 if (new_state == kStateUninitialized) { | 38 if (new_state == kStateUninitialized) { |
| 38 config_ = VideoConfig(); | 39 config_ = VideoConfig(); |
| 39 } | 40 } |
| 40 return true; | 41 return true; |
| 41 } | 42 } |
| 42 | 43 |
| 43 bool VideoPipelineDeviceDefault::SetStartPts(base::TimeDelta time) { | 44 bool VideoPipelineDeviceDefault::SetStartPts(int64_t time_microseconds) { |
| 44 return pipeline_->SetStartPts(time); | 45 return pipeline_->SetStartPts(time_microseconds); |
| 45 } | 46 } |
| 46 | 47 |
| 47 MediaComponentDevice::FrameStatus VideoPipelineDeviceDefault::PushFrame( | 48 MediaComponentDevice::FrameStatus VideoPipelineDeviceDefault::PushFrame( |
| 48 const scoped_refptr<DecryptContext>& decrypt_context, | 49 DecryptContext* decrypt_context, |
| 49 const scoped_refptr<DecoderBufferBase>& buffer, | 50 CastDecoderBuffer* buffer, |
| 50 const FrameStatusCB& completion_cb) { | 51 FrameStatusCB* completion_cb) { |
| 51 return pipeline_->PushFrame(decrypt_context, buffer, completion_cb); | 52 return pipeline_->PushFrame(decrypt_context, buffer, completion_cb); |
| 52 } | 53 } |
| 53 | 54 |
| 54 base::TimeDelta VideoPipelineDeviceDefault::GetRenderingTime() const { | 55 VideoPipelineDeviceDefault::RenderingDelay |
| 55 return pipeline_->GetRenderingTime(); | 56 VideoPipelineDeviceDefault::GetRenderingDelay() const { |
| 56 } | |
| 57 | |
| 58 base::TimeDelta VideoPipelineDeviceDefault::GetRenderingDelay() const { | |
| 59 return pipeline_->GetRenderingDelay(); | 57 return pipeline_->GetRenderingDelay(); |
| 60 } | 58 } |
| 61 | 59 |
| 62 void VideoPipelineDeviceDefault::SetVideoClient(const VideoClient& client) { | 60 void VideoPipelineDeviceDefault::SetVideoClient(VideoClient* client) { |
| 61 delete client; |
| 63 } | 62 } |
| 64 | 63 |
| 65 bool VideoPipelineDeviceDefault::SetConfig(const VideoConfig& config) { | 64 bool VideoPipelineDeviceDefault::SetConfig(const VideoConfig& config) { |
| 66 DCHECK(CalledOnValidThread()); | 65 DCHECK(thread_checker_.CalledOnValidThread()); |
| 67 if (!IsValidConfig(config)) | 66 if (!IsValidConfig(config)) |
| 68 return false; | 67 return false; |
| 69 config_ = config; | 68 config_ = config; |
| 70 if (config.extra_data_size > 0) | 69 if (config.extra_data_size > 0) |
| 71 config_extra_data_.assign(config.extra_data, | 70 config_extra_data_.assign(config.extra_data, |
| 72 config.extra_data + config.extra_data_size); | 71 config.extra_data + config.extra_data_size); |
| 73 else | 72 else |
| 74 config_extra_data_.clear(); | 73 config_extra_data_.clear(); |
| 75 return true; | 74 return true; |
| 76 } | 75 } |
| 77 | 76 |
| 78 bool VideoPipelineDeviceDefault::GetStatistics(Statistics* stats) const { | 77 bool VideoPipelineDeviceDefault::GetStatistics(Statistics* stats) const { |
| 79 return pipeline_->GetStatistics(stats); | 78 return pipeline_->GetStatistics(stats); |
| 80 } | 79 } |
| 81 | 80 |
| 82 } // namespace media | 81 } // namespace media |
| 83 } // namespace chromecast | 82 } // namespace chromecast |
| OLD | NEW |