Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / chromecast / media / cma / backend / video_pipeline_device_default.cc
blob90970cbdbd15b955a279fad8ef0ed41f4c1b62ba
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
3 // found in the LICENSE file.
5 #include "chromecast/media/cma/backend/video_pipeline_device_default.h"
7 #include "chromecast/media/cma/backend/media_component_device_default.h"
9 namespace chromecast {
10 namespace media {
12 VideoPipelineDeviceDefault::VideoPipelineDeviceDefault(
13 MediaClockDevice* media_clock_device)
14 : pipeline_(new MediaComponentDeviceDefault(media_clock_device)) {
15 DetachFromThread();
18 VideoPipelineDeviceDefault::~VideoPipelineDeviceDefault() {
21 void VideoPipelineDeviceDefault::SetClient(const Client& client) {
22 pipeline_->SetClient(client);
25 MediaComponentDevice::State VideoPipelineDeviceDefault::GetState() const {
26 return pipeline_->GetState();
29 bool VideoPipelineDeviceDefault::SetState(State new_state) {
30 bool success = pipeline_->SetState(new_state);
31 if (!success)
32 return false;
34 if (new_state == kStateIdle) {
35 DCHECK(IsValidConfig(config_));
37 if (new_state == kStateUninitialized) {
38 config_ = VideoConfig();
40 return true;
43 bool VideoPipelineDeviceDefault::SetStartPts(base::TimeDelta time) {
44 return pipeline_->SetStartPts(time);
47 MediaComponentDevice::FrameStatus VideoPipelineDeviceDefault::PushFrame(
48 const scoped_refptr<DecryptContext>& decrypt_context,
49 const scoped_refptr<DecoderBufferBase>& buffer,
50 const FrameStatusCB& completion_cb) {
51 return pipeline_->PushFrame(decrypt_context, buffer, completion_cb);
54 base::TimeDelta VideoPipelineDeviceDefault::GetRenderingTime() const {
55 return pipeline_->GetRenderingTime();
58 base::TimeDelta VideoPipelineDeviceDefault::GetRenderingDelay() const {
59 return pipeline_->GetRenderingDelay();
62 void VideoPipelineDeviceDefault::SetVideoClient(const VideoClient& client) {
65 bool VideoPipelineDeviceDefault::SetConfig(const VideoConfig& config) {
66 DCHECK(CalledOnValidThread());
67 if (!IsValidConfig(config))
68 return false;
69 config_ = config;
70 if (config.extra_data_size > 0)
71 config_extra_data_.assign(config.extra_data,
72 config.extra_data + config.extra_data_size);
73 else
74 config_extra_data_.clear();
75 return true;
78 bool VideoPipelineDeviceDefault::GetStatistics(Statistics* stats) const {
79 return pipeline_->GetStatistics(stats);
82 } // namespace media
83 } // namespace chromecast