| 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/renderers/video_renderer_impl.h" | 5 #include "media/renderers/video_renderer_impl.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.h" | 10 #include "base/callback.h" |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 | 385 |
| 386 AddReadyFrame_Locked(frame); | 386 AddReadyFrame_Locked(frame); |
| 387 } | 387 } |
| 388 | 388 |
| 389 // Attempt to purge bad frames in case of underflow or backgrounding. | 389 // Attempt to purge bad frames in case of underflow or backgrounding. |
| 390 RemoveFramesForUnderflowOrBackgroundRendering(); | 390 RemoveFramesForUnderflowOrBackgroundRendering(); |
| 391 | 391 |
| 392 // We may have removed all frames above and have reached end of stream. | 392 // We may have removed all frames above and have reached end of stream. |
| 393 MaybeFireEndedCallback_Locked(time_progressing_); | 393 MaybeFireEndedCallback_Locked(time_progressing_); |
| 394 | 394 |
| 395 // Update statistics here instead of during Render() when the sink is stopped. |
| 396 if (!sink_started_) |
| 397 UpdateStats_Locked(); |
| 398 |
| 395 // Paint the first frame if possible and necessary. PaintSingleFrame() will | 399 // Paint the first frame if possible and necessary. PaintSingleFrame() will |
| 396 // ignore repeated calls for the same frame. Paint ahead of HAVE_ENOUGH_DATA | 400 // ignore repeated calls for the same frame. Paint ahead of HAVE_ENOUGH_DATA |
| 397 // to ensure the user sees the frame as early as possible. | 401 // to ensure the user sees the frame as early as possible. |
| 398 if (!sink_started_ && algorithm_->frames_queued()) { | 402 if (!sink_started_ && algorithm_->frames_queued()) { |
| 399 // We want to paint the first frame under two conditions: Either (1) we have | 403 // We want to paint the first frame under two conditions: Either (1) we have |
| 400 // enough frames to know it's definitely the first frame or (2) there may be | 404 // enough frames to know it's definitely the first frame or (2) there may be |
| 401 // no more frames coming (sometimes unless we paint one of them). | 405 // no more frames coming (sometimes unless we paint one of them). |
| 402 // | 406 // |
| 403 // For the first condition, we need at least two frames or the first frame | 407 // For the first condition, we need at least two frames or the first frame |
| 404 // must have a timestamp >= |start_timestamp_|, since otherwise we may be | 408 // must have a timestamp >= |start_timestamp_|, since otherwise we may be |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 | 694 |
| 691 void VideoRendererImpl::AttemptReadAndCheckForMetadataChanges( | 695 void VideoRendererImpl::AttemptReadAndCheckForMetadataChanges( |
| 692 VideoPixelFormat pixel_format, | 696 VideoPixelFormat pixel_format, |
| 693 const gfx::Size& natural_size) { | 697 const gfx::Size& natural_size) { |
| 694 base::AutoLock auto_lock(lock_); | 698 base::AutoLock auto_lock(lock_); |
| 695 CheckForMetadataChanges(pixel_format, natural_size); | 699 CheckForMetadataChanges(pixel_format, natural_size); |
| 696 AttemptRead_Locked(); | 700 AttemptRead_Locked(); |
| 697 } | 701 } |
| 698 | 702 |
| 699 } // namespace media | 703 } // namespace media |
| OLD | NEW |