| 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 "content/renderer/media/webmediaplayer_ms_compositor.h" | 5 #include "content/renderer/media/webmediaplayer_ms_compositor.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/hash.h" | 10 #include "base/hash.h" |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 void WebMediaPlayerMSCompositor::PutCurrentFrame() { | 265 void WebMediaPlayerMSCompositor::PutCurrentFrame() { |
| 266 DVLOG(3) << __FUNCTION__; | 266 DVLOG(3) << __FUNCTION__; |
| 267 base::AutoLock auto_lock(current_frame_lock_); | 267 base::AutoLock auto_lock(current_frame_lock_); |
| 268 current_frame_used_by_compositor_ = true; | 268 current_frame_used_by_compositor_ = true; |
| 269 } | 269 } |
| 270 | 270 |
| 271 void WebMediaPlayerMSCompositor::StartRendering() { | 271 void WebMediaPlayerMSCompositor::StartRendering() { |
| 272 DCHECK(thread_checker_.CalledOnValidThread()); | 272 DCHECK(thread_checker_.CalledOnValidThread()); |
| 273 compositor_task_runner_->PostTask( | 273 compositor_task_runner_->PostTask( |
| 274 FROM_HERE, base::Bind(&WebMediaPlayerMSCompositor::StartRenderingInternal, | 274 FROM_HERE, base::Bind(&WebMediaPlayerMSCompositor::StartRenderingInternal, |
| 275 base::Unretained(this))); | 275 AsWeakPtr())); |
| 276 } | 276 } |
| 277 | 277 |
| 278 void WebMediaPlayerMSCompositor::StartRenderingInternal() { | 278 void WebMediaPlayerMSCompositor::StartRenderingInternal() { |
| 279 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); | 279 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); |
| 280 stopped_ = false; | 280 stopped_ = false; |
| 281 | 281 |
| 282 if (video_frame_provider_client_) | 282 if (video_frame_provider_client_) |
| 283 video_frame_provider_client_->StartRendering(); | 283 video_frame_provider_client_->StartRendering(); |
| 284 } | 284 } |
| 285 | 285 |
| 286 void WebMediaPlayerMSCompositor::StopRendering() { | 286 void WebMediaPlayerMSCompositor::StopRendering() { |
| 287 DCHECK(thread_checker_.CalledOnValidThread()); | 287 DCHECK(thread_checker_.CalledOnValidThread()); |
| 288 compositor_task_runner_->PostTask( | 288 compositor_task_runner_->PostTask( |
| 289 FROM_HERE, base::Bind(&WebMediaPlayerMSCompositor::StopRenderingInternal, | 289 FROM_HERE, base::Bind(&WebMediaPlayerMSCompositor::StopRenderingInternal, |
| 290 base::Unretained(this))); | 290 AsWeakPtr())); |
| 291 } | 291 } |
| 292 | 292 |
| 293 void WebMediaPlayerMSCompositor::StopRenderingInternal() { | 293 void WebMediaPlayerMSCompositor::StopRenderingInternal() { |
| 294 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); | 294 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); |
| 295 stopped_ = true; | 295 stopped_ = true; |
| 296 | 296 |
| 297 // It is possible that the video gets paused and then resumed. We need to | 297 // It is possible that the video gets paused and then resumed. We need to |
| 298 // reset VideoRendererAlgorithm, otherwise, VideoRendererAlgorithm will think | 298 // reset VideoRendererAlgorithm, otherwise, VideoRendererAlgorithm will think |
| 299 // there is a very long frame in the queue and then make totally wrong | 299 // there is a very long frame in the queue and then make totally wrong |
| 300 // frame selection. | 300 // frame selection. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 } | 383 } |
| 384 | 384 |
| 385 if (!rendering_frame_buffer_) { | 385 if (!rendering_frame_buffer_) { |
| 386 rendering_frame_buffer_.reset(new media::VideoRendererAlgorithm( | 386 rendering_frame_buffer_.reset(new media::VideoRendererAlgorithm( |
| 387 base::Bind(&WebMediaPlayerMSCompositor::MapTimestampsToRenderTimeTicks, | 387 base::Bind(&WebMediaPlayerMSCompositor::MapTimestampsToRenderTimeTicks, |
| 388 base::Unretained(this)))); | 388 base::Unretained(this)))); |
| 389 } | 389 } |
| 390 } | 390 } |
| 391 | 391 |
| 392 } // namespace content | 392 } // namespace content |
| OLD | NEW |