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 const MediaPipelineDeviceParams
& params
,
14 MediaClockDevice
* media_clock_device
)
15 : pipeline_(new MediaComponentDeviceDefault(params
, media_clock_device
)) {
16 thread_checker_
.DetachFromThread();
19 AudioPipelineDeviceDefault::~AudioPipelineDeviceDefault() {
22 void AudioPipelineDeviceDefault::SetClient(Client
* client
) {
23 pipeline_
->SetClient(client
);
26 MediaComponentDevice::State
AudioPipelineDeviceDefault::GetState() const {
27 return pipeline_
->GetState();
30 bool AudioPipelineDeviceDefault::SetState(State new_state
) {
31 bool success
= pipeline_
->SetState(new_state
);
35 if (new_state
== kStateIdle
) {
36 DCHECK(IsValidConfig(config_
));
38 if (new_state
== kStateUninitialized
) {
39 config_
= AudioConfig();
44 bool AudioPipelineDeviceDefault::SetStartPts(int64_t time_microseconds
) {
45 return pipeline_
->SetStartPts(time_microseconds
);
48 MediaComponentDevice::FrameStatus
AudioPipelineDeviceDefault::PushFrame(
49 DecryptContext
* decrypt_context
,
50 CastDecoderBuffer
* buffer
,
51 FrameStatusCB
* completion_cb
) {
52 return pipeline_
->PushFrame(decrypt_context
, buffer
, completion_cb
);
55 AudioPipelineDeviceDefault::RenderingDelay
56 AudioPipelineDeviceDefault::GetRenderingDelay() const {
57 return pipeline_
->GetRenderingDelay();
60 bool AudioPipelineDeviceDefault::SetConfig(const AudioConfig
& config
) {
61 DCHECK(thread_checker_
.CalledOnValidThread());
62 if (!IsValidConfig(config
))
65 if (config
.extra_data_size
> 0)
66 config_extra_data_
.assign(config
.extra_data
,
67 config
.extra_data
+ config
.extra_data_size
);
69 config_extra_data_
.clear();
73 void AudioPipelineDeviceDefault::SetStreamVolumeMultiplier(float multiplier
) {
74 DCHECK(thread_checker_
.CalledOnValidThread());
77 bool AudioPipelineDeviceDefault::GetStatistics(Statistics
* stats
) const {
78 return pipeline_
->GetStatistics(stats
);
82 } // namespace chromecast