Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: chromecast/media/cma/backend/audio_pipeline_device_default.cc

Issue 1257013003: Load CMA backend from shared library (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unit test + android fixes Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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(TimeDelta time) {
44 return pipeline_->SetStartPts(time); 45 return pipeline_->SetStartPts(time);
45 } 46 }
46 47
47 MediaComponentDevice::FrameStatus AudioPipelineDeviceDefault::PushFrame( 48 MediaComponentDevice::FrameStatus AudioPipelineDeviceDefault::PushFrame(
48 const scoped_refptr<DecryptContext>& decrypt_context, 49 CastKeySystem cast_key_system,
49 const scoped_refptr<DecoderBufferBase>& buffer, 50 DecoderBuffer* buffer,
50 const FrameStatusCB& completion_cb) { 51 FrameStatusCB* completion_cb) {
51 return pipeline_->PushFrame(decrypt_context, buffer, completion_cb); 52 return pipeline_->PushFrame(cast_key_system, buffer, completion_cb);
52 } 53 }
53 54
54 base::TimeDelta AudioPipelineDeviceDefault::GetRenderingTime() const { 55 TimeDelta AudioPipelineDeviceDefault::GetRenderingDelay() const {
55 return pipeline_->GetRenderingTime();
56 }
57
58 base::TimeDelta AudioPipelineDeviceDefault::GetRenderingDelay() const {
59 return pipeline_->GetRenderingDelay(); 56 return pipeline_->GetRenderingDelay();
60 } 57 }
61 58
62 bool AudioPipelineDeviceDefault::SetConfig(const AudioConfig& config) { 59 bool AudioPipelineDeviceDefault::SetConfig(const AudioConfig& config) {
63 DCHECK(CalledOnValidThread()); 60 DCHECK(thread_checker_.CalledOnValidThread());
64 if (!IsValidConfig(config)) 61 if (!IsValidConfig(config))
65 return false; 62 return false;
66 config_ = config; 63 config_ = config;
67 if (config.extra_data_size > 0) 64 if (config.extra_data_size > 0)
68 config_extra_data_.assign(config.extra_data, 65 config_extra_data_.assign(config.extra_data,
69 config.extra_data + config.extra_data_size); 66 config.extra_data + config.extra_data_size);
70 else 67 else
71 config_extra_data_.clear(); 68 config_extra_data_.clear();
72 return true; 69 return true;
73 } 70 }
74 71
75 void AudioPipelineDeviceDefault::SetStreamVolumeMultiplier(float multiplier) { 72 void AudioPipelineDeviceDefault::SetStreamVolumeMultiplier(float multiplier) {
76 DCHECK(CalledOnValidThread()); 73 DCHECK(thread_checker_.CalledOnValidThread());
77 } 74 }
78 75
79 bool AudioPipelineDeviceDefault::GetStatistics(Statistics* stats) const { 76 bool AudioPipelineDeviceDefault::GetStatistics(Statistics* stats) const {
80 return pipeline_->GetStatistics(stats); 77 return pipeline_->GetStatistics(stats);
81 } 78 }
82 79
83 } // namespace media 80 } // namespace media
84 } // namespace chromecast 81 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698