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 "media/mojo/clients/mojo_renderer.h" | 5 #include "media/mojo/clients/mojo_renderer.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 void MojoRenderer::StartPlayingFrom(base::TimeDelta time) { | 175 void MojoRenderer::StartPlayingFrom(base::TimeDelta time) { |
176 DVLOG(2) << __FUNCTION__; | 176 DVLOG(2) << __FUNCTION__; |
177 DCHECK(task_runner_->BelongsToCurrentThread()); | 177 DCHECK(task_runner_->BelongsToCurrentThread()); |
178 DCHECK(remote_renderer_.is_bound()); | 178 DCHECK(remote_renderer_.is_bound()); |
179 | 179 |
180 { | 180 { |
181 base::AutoLock auto_lock(lock_); | 181 base::AutoLock auto_lock(lock_); |
182 time_ = time; | 182 time_ = time; |
183 } | 183 } |
184 | 184 |
185 remote_renderer_->StartPlayingFrom(time.InMicroseconds()); | 185 remote_renderer_->StartPlayingFrom(time); |
186 } | 186 } |
187 | 187 |
188 void MojoRenderer::SetPlaybackRate(double playback_rate) { | 188 void MojoRenderer::SetPlaybackRate(double playback_rate) { |
189 DVLOG(2) << __FUNCTION__; | 189 DVLOG(2) << __FUNCTION__; |
190 DCHECK(task_runner_->BelongsToCurrentThread()); | 190 DCHECK(task_runner_->BelongsToCurrentThread()); |
191 DCHECK(remote_renderer_.is_bound()); | 191 DCHECK(remote_renderer_.is_bound()); |
192 | 192 |
193 remote_renderer_->SetPlaybackRate(playback_rate); | 193 remote_renderer_->SetPlaybackRate(playback_rate); |
194 } | 194 } |
195 | 195 |
(...skipping 30 matching lines...) Expand all Loading... |
226 DCHECK(remote_renderer_.is_bound()); | 226 DCHECK(remote_renderer_.is_bound()); |
227 | 227 |
228 if (demuxer_stream_provider_->GetType() == DemuxerStreamProvider::Type::URL) { | 228 if (demuxer_stream_provider_->GetType() == DemuxerStreamProvider::Type::URL) { |
229 NOTIMPLEMENTED(); | 229 NOTIMPLEMENTED(); |
230 return false; | 230 return false; |
231 } | 231 } |
232 | 232 |
233 return !!demuxer_stream_provider_->GetStream(DemuxerStream::VIDEO); | 233 return !!demuxer_stream_provider_->GetStream(DemuxerStream::VIDEO); |
234 } | 234 } |
235 | 235 |
236 void MojoRenderer::OnTimeUpdate(int64_t time_usec, int64_t max_time_usec) { | 236 void MojoRenderer::OnTimeUpdate(base::TimeDelta time, |
237 DVLOG(3) << __FUNCTION__ << ": " << time_usec << ", " << max_time_usec; | 237 base::TimeDelta max_time) { |
| 238 DVLOG(3) << __FUNCTION__ << ": " << time << ", " << max_time; |
238 DCHECK(task_runner_->BelongsToCurrentThread()); | 239 DCHECK(task_runner_->BelongsToCurrentThread()); |
239 | 240 |
240 base::AutoLock auto_lock(lock_); | 241 base::AutoLock auto_lock(lock_); |
241 time_ = base::TimeDelta::FromMicroseconds(time_usec); | 242 time_ = time; |
242 } | 243 } |
243 | 244 |
244 void MojoRenderer::OnBufferingStateChange(mojom::BufferingState state) { | 245 void MojoRenderer::OnBufferingStateChange(mojom::BufferingState state) { |
245 DVLOG(2) << __FUNCTION__; | 246 DVLOG(2) << __FUNCTION__; |
246 DCHECK(task_runner_->BelongsToCurrentThread()); | 247 DCHECK(task_runner_->BelongsToCurrentThread()); |
247 client_->OnBufferingStateChange(static_cast<media::BufferingState>(state)); | 248 client_->OnBufferingStateChange(static_cast<media::BufferingState>(state)); |
248 } | 249 } |
249 | 250 |
250 void MojoRenderer::OnEnded() { | 251 void MojoRenderer::OnEnded() { |
251 DVLOG(1) << __FUNCTION__; | 252 DVLOG(1) << __FUNCTION__; |
(...skipping 15 matching lines...) Expand all Loading... |
267 | 268 |
268 void MojoRenderer::OnVideoNaturalSizeChange(const gfx::Size& size) { | 269 void MojoRenderer::OnVideoNaturalSizeChange(const gfx::Size& size) { |
269 DVLOG(2) << __FUNCTION__ << ": " << size.ToString(); | 270 DVLOG(2) << __FUNCTION__ << ": " << size.ToString(); |
270 DCHECK(task_runner_->BelongsToCurrentThread()); | 271 DCHECK(task_runner_->BelongsToCurrentThread()); |
271 | 272 |
272 video_renderer_sink_->PaintSingleFrame( | 273 video_renderer_sink_->PaintSingleFrame( |
273 video_overlay_factory_->CreateFrame(size)); | 274 video_overlay_factory_->CreateFrame(size)); |
274 client_->OnVideoNaturalSizeChange(size); | 275 client_->OnVideoNaturalSizeChange(size); |
275 } | 276 } |
276 | 277 |
277 void MojoRenderer::OnDurationChange(int64_t duration_usec) { | 278 void MojoRenderer::OnDurationChange(base::TimeDelta duration) { |
278 DVLOG(2) << __FUNCTION__ << ": duration" << duration_usec; | 279 DVLOG(2) << __FUNCTION__ << ": duration" << duration; |
279 client_->OnDurationChange(base::TimeDelta::FromMicroseconds(duration_usec)); | 280 client_->OnDurationChange(duration); |
280 } | 281 } |
281 | 282 |
282 void MojoRenderer::OnVideoOpacityChange(bool opaque) { | 283 void MojoRenderer::OnVideoOpacityChange(bool opaque) { |
283 DVLOG(2) << __FUNCTION__ << ": " << opaque; | 284 DVLOG(2) << __FUNCTION__ << ": " << opaque; |
284 DCHECK(task_runner_->BelongsToCurrentThread()); | 285 DCHECK(task_runner_->BelongsToCurrentThread()); |
285 client_->OnVideoOpacityChange(opaque); | 286 client_->OnVideoOpacityChange(opaque); |
286 } | 287 } |
287 | 288 |
288 void MojoRenderer::OnStatisticsUpdate(const PipelineStatistics& stats) { | 289 void MojoRenderer::OnStatisticsUpdate(const PipelineStatistics& stats) { |
289 DVLOG(3) << __FUNCTION__; | 290 DVLOG(3) << __FUNCTION__; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_INITIALIZATION_FAILED); | 381 base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_INITIALIZATION_FAILED); |
381 | 382 |
382 if (!flush_cb_.is_null()) | 383 if (!flush_cb_.is_null()) |
383 base::ResetAndReturn(&flush_cb_).Run(); | 384 base::ResetAndReturn(&flush_cb_).Run(); |
384 | 385 |
385 if (!cdm_attached_cb_.is_null()) | 386 if (!cdm_attached_cb_.is_null()) |
386 base::ResetAndReturn(&cdm_attached_cb_).Run(false); | 387 base::ResetAndReturn(&cdm_attached_cb_).Run(false); |
387 } | 388 } |
388 | 389 |
389 } // namespace media | 390 } // namespace media |
OLD | NEW |