OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer/media/media_pipeline_proxy.h" | 5 #include "chromecast/renderer/media/media_pipeline_proxy.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } | 73 } |
74 | 74 |
75 void MediaPipelineProxyInternal::Shutdown() { | 75 void MediaPipelineProxyInternal::Shutdown() { |
76 DCHECK(thread_checker_.CalledOnValidThread()); | 76 DCHECK(thread_checker_.CalledOnValidThread()); |
77 | 77 |
78 // Remove any callback on VideoPipelineProxyInternal. | 78 // Remove any callback on VideoPipelineProxyInternal. |
79 media_channel_proxy_->SetMediaDelegate( | 79 media_channel_proxy_->SetMediaDelegate( |
80 CmaMessageFilterProxy::MediaDelegate()); | 80 CmaMessageFilterProxy::MediaDelegate()); |
81 } | 81 } |
82 | 82 |
83 void MediaPipelineProxyInternal::SetClient( | 83 void MediaPipelineProxyInternal::SetClient(const MediaPipelineClient& client) { |
84 const MediaPipelineClient& client) { | |
85 DCHECK(thread_checker_.CalledOnValidThread()); | 84 DCHECK(thread_checker_.CalledOnValidThread()); |
86 DCHECK(!client.error_cb.is_null()); | 85 DCHECK(!client.error_cb.is_null()); |
87 DCHECK(!client.buffering_state_cb.is_null()); | 86 DCHECK(!client.buffering_state_cb.is_null()); |
88 client_ = client; | 87 client_ = client; |
89 | 88 |
90 CmaMessageFilterProxy::MediaDelegate delegate; | 89 CmaMessageFilterProxy::MediaDelegate delegate; |
91 delegate.state_changed_cb = | 90 delegate.state_changed_cb = |
92 base::Bind(&MediaPipelineProxyInternal::OnStateChanged, | 91 base::Bind(&MediaPipelineProxyInternal::OnStateChanged, |
93 base::Unretained(this)); | 92 base::Unretained(this)); |
94 delegate.client = client; | 93 delegate.client = client; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 } | 177 } |
179 | 178 |
180 MediaPipelineProxy::~MediaPipelineProxy() { | 179 MediaPipelineProxy::~MediaPipelineProxy() { |
181 io_task_runner_->PostTask( | 180 io_task_runner_->PostTask( |
182 FROM_HERE, | 181 FROM_HERE, |
183 base::Bind(&MediaPipelineProxyInternal::Release, base::Passed(&proxy_))); | 182 base::Bind(&MediaPipelineProxyInternal::Release, base::Passed(&proxy_))); |
184 io_task_runner_->PostTask( | 183 io_task_runner_->PostTask( |
185 FROM_HERE, base::Bind(&MediaChannelProxy::Close, media_channel_proxy_)); | 184 FROM_HERE, base::Bind(&MediaChannelProxy::Close, media_channel_proxy_)); |
186 } | 185 } |
187 | 186 |
188 void MediaPipelineProxy::SetClient( | 187 void MediaPipelineProxy::SetClient(const MediaPipelineClient& client) { |
189 const MediaPipelineClient& client) { | |
190 DCHECK(thread_checker_.CalledOnValidThread()); | 188 DCHECK(thread_checker_.CalledOnValidThread()); |
191 FORWARD_ON_IO_THREAD(SetClient, client); | 189 FORWARD_ON_IO_THREAD(SetClient, client); |
192 } | 190 } |
193 | 191 |
194 void MediaPipelineProxy::SetCdm(int cdm_id) { | 192 void MediaPipelineProxy::SetCdm(int cdm_id) { |
195 DCHECK(thread_checker_.CalledOnValidThread()); | 193 DCHECK(thread_checker_.CalledOnValidThread()); |
196 FORWARD_ON_IO_THREAD(SetCdm, render_frame_id_, cdm_id); | 194 FORWARD_ON_IO_THREAD(SetCdm, render_frame_id_, cdm_id); |
197 } | 195 } |
198 | 196 |
199 AudioPipeline* MediaPipelineProxy::GetAudioPipeline() const { | 197 AudioPipelineProxy* MediaPipelineProxy::GetAudioPipeline() const { |
200 return audio_pipeline_.get(); | 198 return audio_pipeline_.get(); |
201 } | 199 } |
202 | 200 |
203 VideoPipeline* MediaPipelineProxy::GetVideoPipeline() const { | 201 VideoPipelineProxy* MediaPipelineProxy::GetVideoPipeline() const { |
204 return video_pipeline_.get(); | 202 return video_pipeline_.get(); |
205 } | 203 } |
206 | 204 |
207 void MediaPipelineProxy::InitializeAudio( | 205 void MediaPipelineProxy::InitializeAudio( |
208 const ::media::AudioDecoderConfig& config, | 206 const ::media::AudioDecoderConfig& config, |
209 scoped_ptr<CodedFrameProvider> frame_provider, | 207 scoped_ptr<CodedFrameProvider> frame_provider, |
210 const ::media::PipelineStatusCB& status_cb) { | 208 const ::media::PipelineStatusCB& status_cb) { |
211 DCHECK(thread_checker_.CalledOnValidThread()); | 209 DCHECK(thread_checker_.CalledOnValidThread()); |
212 has_audio_ = true; | 210 has_audio_ = true; |
213 audio_pipeline_->Initialize(config, frame_provider.Pass(), status_cb); | 211 audio_pipeline_->Initialize(config, frame_provider.Pass(), status_cb); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 FORWARD_ON_IO_THREAD(Stop); | 273 FORWARD_ON_IO_THREAD(Stop); |
276 } | 274 } |
277 | 275 |
278 void MediaPipelineProxy::SetPlaybackRate(double playback_rate) { | 276 void MediaPipelineProxy::SetPlaybackRate(double playback_rate) { |
279 DCHECK(thread_checker_.CalledOnValidThread()); | 277 DCHECK(thread_checker_.CalledOnValidThread()); |
280 FORWARD_ON_IO_THREAD(SetPlaybackRate, playback_rate); | 278 FORWARD_ON_IO_THREAD(SetPlaybackRate, playback_rate); |
281 } | 279 } |
282 | 280 |
283 } // namespace cma | 281 } // namespace cma |
284 } // namespace chromecast | 282 } // namespace chromecast |
OLD | NEW |