OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/filters/video_renderer_impl.h" | 5 #include "media/filters/video_renderer_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 last_timestamp_ = next_frame->timestamp(); | 260 last_timestamp_ = next_frame->timestamp(); |
261 | 261 |
262 paint_cb_.Run(next_frame); | 262 paint_cb_.Run(next_frame); |
263 | 263 |
264 task_runner_->PostTask( | 264 task_runner_->PostTask( |
265 FROM_HERE, | 265 FROM_HERE, |
266 base::Bind(&VideoRendererImpl::AttemptRead, weak_factory_.GetWeakPtr())); | 266 base::Bind(&VideoRendererImpl::AttemptRead, weak_factory_.GetWeakPtr())); |
267 } | 267 } |
268 | 268 |
269 void VideoRendererImpl::DropNextReadyFrame_Locked() { | 269 void VideoRendererImpl::DropNextReadyFrame_Locked() { |
| 270 DVLOG(2) << __FUNCTION__; |
270 TRACE_EVENT0("media", "VideoRendererImpl:frameDropped"); | 271 TRACE_EVENT0("media", "VideoRendererImpl:frameDropped"); |
271 | 272 |
272 lock_.AssertAcquired(); | 273 lock_.AssertAcquired(); |
273 | 274 |
274 last_timestamp_ = ready_frames_.front()->timestamp(); | 275 last_timestamp_ = ready_frames_.front()->timestamp(); |
275 ready_frames_.pop_front(); | 276 ready_frames_.pop_front(); |
276 frames_decoded_++; | 277 frames_decoded_++; |
277 frames_dropped_++; | 278 frames_dropped_++; |
278 | 279 |
279 task_runner_->PostTask( | 280 task_runner_->PostTask( |
280 FROM_HERE, | 281 FROM_HERE, |
281 base::Bind(&VideoRendererImpl::AttemptRead, weak_factory_.GetWeakPtr())); | 282 base::Bind(&VideoRendererImpl::AttemptRead, weak_factory_.GetWeakPtr())); |
282 } | 283 } |
283 | 284 |
284 void VideoRendererImpl::FrameReady(VideoFrameStream::Status status, | 285 void VideoRendererImpl::FrameReady(VideoFrameStream::Status status, |
285 const scoped_refptr<VideoFrame>& frame) { | 286 const scoped_refptr<VideoFrame>& frame) { |
| 287 DVLOG(2) << __FUNCTION__; |
286 base::AutoLock auto_lock(lock_); | 288 base::AutoLock auto_lock(lock_); |
287 DCHECK_NE(state_, kUninitialized); | 289 DCHECK_NE(state_, kUninitialized); |
288 DCHECK_NE(state_, kFlushed); | 290 DCHECK_NE(state_, kFlushed); |
289 | 291 |
290 CHECK(pending_read_); | 292 CHECK(pending_read_); |
291 pending_read_ = false; | 293 pending_read_ = false; |
292 | 294 |
293 if (status == VideoFrameStream::DECODE_ERROR || | 295 if (status == VideoFrameStream::DECODE_ERROR || |
294 status == VideoFrameStream::DECRYPT_ERROR) { | 296 status == VideoFrameStream::DECRYPT_ERROR) { |
295 DCHECK(!frame.get()); | 297 DCHECK(!frame.get()); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 task_runner_->PostTask(FROM_HERE, base::Bind(statistics_cb_, statistics)); | 461 task_runner_->PostTask(FROM_HERE, base::Bind(statistics_cb_, statistics)); |
460 | 462 |
461 frames_decoded_ = 0; | 463 frames_decoded_ = 0; |
462 frames_dropped_ = 0; | 464 frames_dropped_ = 0; |
463 } | 465 } |
464 | 466 |
465 frame_available_.TimedWait(wait_duration); | 467 frame_available_.TimedWait(wait_duration); |
466 } | 468 } |
467 | 469 |
468 } // namespace media | 470 } // namespace media |
OLD | NEW |