OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_base.h" | 5 #include "media/filters/video_renderer_base.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/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 | 389 |
390 // Maintain the latest frame decoded so the correct frame is displayed after | 390 // Maintain the latest frame decoded so the correct frame is displayed after |
391 // prerolling has completed. | 391 // prerolling has completed. |
392 if (state_ == kPrerolling && frame->GetTimestamp() <= preroll_timestamp_) { | 392 if (state_ == kPrerolling && frame->GetTimestamp() <= preroll_timestamp_) { |
393 ready_frames_.clear(); | 393 ready_frames_.clear(); |
394 } | 394 } |
395 | 395 |
396 AddReadyFrame_Locked(frame); | 396 AddReadyFrame_Locked(frame); |
397 | 397 |
398 if (state_ == kPrerolling) { | 398 if (state_ == kPrerolling) { |
399 if (!video_frame_stream_.HasOutputFrameAvailable() || | 399 if (!video_frame_stream_.CanReadWithoutStalling() || |
400 ready_frames_.size() >= static_cast<size_t>(limits::kMaxVideoFrames)) { | 400 ready_frames_.size() >= static_cast<size_t>(limits::kMaxVideoFrames)) { |
401 TransitionToPrerolled_Locked(); | 401 TransitionToPrerolled_Locked(); |
402 } | 402 } |
403 } else { | 403 } else { |
404 // We only count frames decoded during normal playback. | 404 // We only count frames decoded during normal playback. |
405 PipelineStatistics statistics; | 405 PipelineStatistics statistics; |
406 statistics.video_frames_decoded = 1; | 406 statistics.video_frames_decoded = 1; |
407 statistics_cb_.Run(statistics); | 407 statistics_cb_.Run(statistics); |
408 } | 408 } |
409 | 409 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 // Because we might remain in the prerolled state for an undetermined amount | 530 // Because we might remain in the prerolled state for an undetermined amount |
531 // of time (e.g., we seeked while paused), we'll paint the first prerolled | 531 // of time (e.g., we seeked while paused), we'll paint the first prerolled |
532 // frame. | 532 // frame. |
533 if (!ready_frames_.empty()) | 533 if (!ready_frames_.empty()) |
534 PaintNextReadyFrame_Locked(); | 534 PaintNextReadyFrame_Locked(); |
535 | 535 |
536 base::ResetAndReturn(&preroll_cb_).Run(PIPELINE_OK); | 536 base::ResetAndReturn(&preroll_cb_).Run(PIPELINE_OK); |
537 } | 537 } |
538 | 538 |
539 } // namespace media | 539 } // namespace media |
OLD | NEW |