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/audio_pipeline_device_default.h"
7 #include "chromecast/media/cma/backend/media_component_device_default.h"
12 AudioPipelineDeviceDefault::AudioPipelineDeviceDefault(
13 MediaClockDevice
* media_clock_device
)
14 : pipeline_(new MediaComponentDeviceDefault(media_clock_device
)) {
18 AudioPipelineDeviceDefault::~AudioPipelineDeviceDefault() {
21 void AudioPipelineDeviceDefault::SetClient(const Client
& client
) {
22 pipeline_
->SetClient(client
);
25 MediaComponentDevice::State
AudioPipelineDeviceDefault::GetState() const {
26 return pipeline_
->GetState();
29 bool AudioPipelineDeviceDefault::SetState(State new_state
) {
30 bool success
= pipeline_
->SetState(new_state
);
34 if (new_state
== kStateIdle
) {
35 DCHECK(IsValidConfig(config_
));
37 if (new_state
== kStateUninitialized
) {
38 config_
= AudioConfig();
43 bool AudioPipelineDeviceDefault::SetStartPts(base::TimeDelta time
) {
44 return pipeline_
->SetStartPts(time
);
47 MediaComponentDevice::FrameStatus
AudioPipelineDeviceDefault::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
AudioPipelineDeviceDefault::GetRenderingTime() const {
55 return pipeline_
->GetRenderingTime();
58 base::TimeDelta
AudioPipelineDeviceDefault::GetRenderingDelay() const {
59 return pipeline_
->GetRenderingDelay();
62 bool AudioPipelineDeviceDefault::SetConfig(const AudioConfig
& config
) {
63 DCHECK(CalledOnValidThread());
64 if (!IsValidConfig(config
))
67 if (config
.extra_data_size
> 0)
68 config_extra_data_
.assign(config
.extra_data
,
69 config
.extra_data
+ config
.extra_data_size
);
71 config_extra_data_
.clear();
75 void AudioPipelineDeviceDefault::SetStreamVolumeMultiplier(float multiplier
) {
76 DCHECK(CalledOnValidThread());
79 bool AudioPipelineDeviceDefault::GetStatistics(Statistics
* stats
) const {
80 return pipeline_
->GetStatistics(stats
);
84 } // namespace chromecast