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/audio_pipeline_device_default.h" | 5 #include "chromecast/media/cma/backend/audio_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 AudioPipelineDeviceDefault::AudioPipelineDeviceDefault( | 12 AudioPipelineDeviceDefault::AudioPipelineDeviceDefault( |
| 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 AudioPipelineDeviceDefault::~AudioPipelineDeviceDefault() { | 19 AudioPipelineDeviceDefault::~AudioPipelineDeviceDefault() { |
19 } | 20 } |
20 | 21 |
21 void AudioPipelineDeviceDefault::SetClient(const Client& client) { | 22 void AudioPipelineDeviceDefault::SetClient(Client* client) { |
22 pipeline_->SetClient(client); | 23 pipeline_->SetClient(client); |
23 } | 24 } |
24 | 25 |
25 MediaComponentDevice::State AudioPipelineDeviceDefault::GetState() const { | 26 MediaComponentDevice::State AudioPipelineDeviceDefault::GetState() const { |
26 return pipeline_->GetState(); | 27 return pipeline_->GetState(); |
27 } | 28 } |
28 | 29 |
29 bool AudioPipelineDeviceDefault::SetState(State new_state) { | 30 bool AudioPipelineDeviceDefault::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_ = AudioConfig(); | 39 config_ = AudioConfig(); |
39 } | 40 } |
40 return true; | 41 return true; |
41 } | 42 } |
42 | 43 |
43 bool AudioPipelineDeviceDefault::SetStartPts(base::TimeDelta time) { | 44 bool AudioPipelineDeviceDefault::SetStartPts(int64_t time_microseconds) { |
44 return pipeline_->SetStartPts(time); | 45 return pipeline_->SetStartPts(time_microseconds); |
45 } | 46 } |
46 | 47 |
47 MediaComponentDevice::FrameStatus AudioPipelineDeviceDefault::PushFrame( | 48 MediaComponentDevice::FrameStatus AudioPipelineDeviceDefault::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 AudioPipelineDeviceDefault::GetRenderingTime() const { | 55 AudioPipelineDeviceDefault::RenderingDelay |
55 return pipeline_->GetRenderingTime(); | 56 AudioPipelineDeviceDefault::GetRenderingDelay() const { |
56 } | |
57 | |
58 base::TimeDelta AudioPipelineDeviceDefault::GetRenderingDelay() const { | |
59 return pipeline_->GetRenderingDelay(); | 57 return pipeline_->GetRenderingDelay(); |
60 } | 58 } |
61 | 59 |
62 bool AudioPipelineDeviceDefault::SetConfig(const AudioConfig& config) { | 60 bool AudioPipelineDeviceDefault::SetConfig(const AudioConfig& config) { |
63 DCHECK(CalledOnValidThread()); | 61 DCHECK(thread_checker_.CalledOnValidThread()); |
64 if (!IsValidConfig(config)) | 62 if (!IsValidConfig(config)) |
65 return false; | 63 return false; |
66 config_ = config; | 64 config_ = config; |
67 if (config.extra_data_size > 0) | 65 if (config.extra_data_size > 0) |
68 config_extra_data_.assign(config.extra_data, | 66 config_extra_data_.assign(config.extra_data, |
69 config.extra_data + config.extra_data_size); | 67 config.extra_data + config.extra_data_size); |
70 else | 68 else |
71 config_extra_data_.clear(); | 69 config_extra_data_.clear(); |
72 return true; | 70 return true; |
73 } | 71 } |
74 | 72 |
75 void AudioPipelineDeviceDefault::SetStreamVolumeMultiplier(float multiplier) { | 73 void AudioPipelineDeviceDefault::SetStreamVolumeMultiplier(float multiplier) { |
76 DCHECK(CalledOnValidThread()); | 74 DCHECK(thread_checker_.CalledOnValidThread()); |
77 } | 75 } |
78 | 76 |
79 bool AudioPipelineDeviceDefault::GetStatistics(Statistics* stats) const { | 77 bool AudioPipelineDeviceDefault::GetStatistics(Statistics* stats) const { |
80 return pipeline_->GetStatistics(stats); | 78 return pipeline_->GetStatistics(stats); |
81 } | 79 } |
82 | 80 |
83 } // namespace media | 81 } // namespace media |
84 } // namespace chromecast | 82 } // namespace chromecast |
OLD | NEW |