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 16 matching lines...) Expand all Loading... |
27 | 27 |
28 explicit MediaPipelineProxyInternal( | 28 explicit MediaPipelineProxyInternal( |
29 scoped_refptr<MediaChannelProxy> media_channel_proxy); | 29 scoped_refptr<MediaChannelProxy> media_channel_proxy); |
30 virtual ~MediaPipelineProxyInternal(); | 30 virtual ~MediaPipelineProxyInternal(); |
31 | 31 |
32 void SetClient(const MediaPipelineClient& client); | 32 void SetClient(const MediaPipelineClient& client); |
33 void SetCdm(int render_frame_id, int cdm_id); | 33 void SetCdm(int render_frame_id, int cdm_id); |
34 void StartPlayingFrom(const base::TimeDelta& time); | 34 void StartPlayingFrom(const base::TimeDelta& time); |
35 void Flush(const ::media::PipelineStatusCB& status_cb); | 35 void Flush(const ::media::PipelineStatusCB& status_cb); |
36 void Stop(); | 36 void Stop(); |
37 void SetPlaybackRate(float playback_rate); | 37 void SetPlaybackRate(double playback_rate); |
38 | 38 |
39 private: | 39 private: |
40 void Shutdown(); | 40 void Shutdown(); |
41 | 41 |
42 // Callbacks for CmaMessageFilterHost::MediaDelegate. | 42 // Callbacks for CmaMessageFilterHost::MediaDelegate. |
43 void OnStateChanged(::media::PipelineStatus status); | 43 void OnStateChanged(::media::PipelineStatus status); |
44 | 44 |
45 base::ThreadChecker thread_checker_; | 45 base::ThreadChecker thread_checker_; |
46 | 46 |
47 scoped_refptr<MediaChannelProxy> media_channel_proxy_; | 47 scoped_refptr<MediaChannelProxy> media_channel_proxy_; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 void MediaPipelineProxyInternal::StartPlayingFrom(const base::TimeDelta& time) { | 129 void MediaPipelineProxyInternal::StartPlayingFrom(const base::TimeDelta& time) { |
130 DCHECK(thread_checker_.CalledOnValidThread()); | 130 DCHECK(thread_checker_.CalledOnValidThread()); |
131 bool success = media_channel_proxy_->Send(scoped_ptr<IPC::Message>( | 131 bool success = media_channel_proxy_->Send(scoped_ptr<IPC::Message>( |
132 new CmaHostMsg_StartPlayingFrom( | 132 new CmaHostMsg_StartPlayingFrom( |
133 media_channel_proxy_->GetId(), time))); | 133 media_channel_proxy_->GetId(), time))); |
134 if (!success) | 134 if (!success) |
135 client_.error_cb.Run(::media::PIPELINE_ERROR_ABORT); | 135 client_.error_cb.Run(::media::PIPELINE_ERROR_ABORT); |
136 } | 136 } |
137 | 137 |
138 void MediaPipelineProxyInternal::SetPlaybackRate(float playback_rate) { | 138 void MediaPipelineProxyInternal::SetPlaybackRate(double playback_rate) { |
139 DCHECK(thread_checker_.CalledOnValidThread()); | 139 DCHECK(thread_checker_.CalledOnValidThread()); |
140 media_channel_proxy_->Send(scoped_ptr<IPC::Message>( | 140 media_channel_proxy_->Send(scoped_ptr<IPC::Message>( |
141 new CmaHostMsg_SetPlaybackRate( | 141 new CmaHostMsg_SetPlaybackRate( |
142 media_channel_proxy_->GetId(), playback_rate))); | 142 media_channel_proxy_->GetId(), playback_rate))); |
143 } | 143 } |
144 | 144 |
145 void MediaPipelineProxyInternal::OnStateChanged( | 145 void MediaPipelineProxyInternal::OnStateChanged( |
146 ::media::PipelineStatus status) { | 146 ::media::PipelineStatus status) { |
147 DCHECK(thread_checker_.CalledOnValidThread()); | 147 DCHECK(thread_checker_.CalledOnValidThread()); |
148 DCHECK(!status_cb_.is_null()); | 148 DCHECK(!status_cb_.is_null()); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 DCHECK(has_audio_ || has_video_); | 267 DCHECK(has_audio_ || has_video_); |
268 | 268 |
269 if (has_audio_) | 269 if (has_audio_) |
270 audio_pipeline_->Stop(); | 270 audio_pipeline_->Stop(); |
271 if (has_video_) | 271 if (has_video_) |
272 video_pipeline_->Stop(); | 272 video_pipeline_->Stop(); |
273 | 273 |
274 FORWARD_ON_IO_THREAD(Stop); | 274 FORWARD_ON_IO_THREAD(Stop); |
275 } | 275 } |
276 | 276 |
277 void MediaPipelineProxy::SetPlaybackRate(float playback_rate) { | 277 void MediaPipelineProxy::SetPlaybackRate(double playback_rate) { |
278 DCHECK(thread_checker_.CalledOnValidThread()); | 278 DCHECK(thread_checker_.CalledOnValidThread()); |
279 FORWARD_ON_IO_THREAD(SetPlaybackRate, playback_rate); | 279 FORWARD_ON_IO_THREAD(SetPlaybackRate, playback_rate); |
280 } | 280 } |
281 | 281 |
282 } // namespace cma | 282 } // namespace cma |
283 } // namespace chromecast | 283 } // namespace chromecast |
OLD | NEW |