Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(647)

Side by Side Diff: media/renderers/video_renderer_impl.cc

Issue 1246033008: media: In low delay mode, do not accumulate frames earlier than the start time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "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/command_line.h" 10 #include "base/command_line.h"
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 return; 483 return;
484 484
485 DCHECK_EQ(state_, kPlaying); 485 DCHECK_EQ(state_, kPlaying);
486 486
487 // Can happen when demuxers are preparing for a new Seek(). 487 // Can happen when demuxers are preparing for a new Seek().
488 if (!frame.get()) { 488 if (!frame.get()) {
489 DCHECK_EQ(status, VideoFrameStream::DEMUXER_READ_ABORTED); 489 DCHECK_EQ(status, VideoFrameStream::DEMUXER_READ_ABORTED);
490 return; 490 return;
491 } 491 }
492 492
493 // In low delay mode, don't accumulate frames that's earlier than the start
494 // time. Otherwise we could declare HAVE_ENOUGH_DATA and start playback
495 // prematurely.
496 if (low_delay_ &&
497 !frame->metadata()->IsTrue(VideoFrameMetadata::END_OF_STREAM) &&
498 frame->timestamp() < start_timestamp_) {
499 AttemptRead_Locked();
500 return;
501 }
502
493 if (frame->metadata()->IsTrue(VideoFrameMetadata::END_OF_STREAM)) { 503 if (frame->metadata()->IsTrue(VideoFrameMetadata::END_OF_STREAM)) {
494 DCHECK(!received_end_of_stream_); 504 DCHECK(!received_end_of_stream_);
495 received_end_of_stream_ = true; 505 received_end_of_stream_ = true;
496 506
497 // See if we can fire EOS immediately instead of waiting for Render(). 507 // See if we can fire EOS immediately instead of waiting for Render().
498 if (use_new_video_renderering_path_) 508 if (use_new_video_renderering_path_)
499 MaybeFireEndedCallback(); 509 MaybeFireEndedCallback();
500 } else { 510 } else {
501 // Maintain the latest frame decoded so the correct frame is displayed 511 // Maintain the latest frame decoded so the correct frame is displayed
502 // after prerolling has completed. 512 // after prerolling has completed.
xhwang 2015/07/21 20:30:26 Is this mostly for the old rendering path? Can we
DaleCurtis 2015/07/21 21:16:50 Well, consider what happens if T=1s and the frames
xhwang 2015/07/21 21:53:37 I see your point. Things would be much simpler if
503 if (frame->timestamp() <= start_timestamp_) { 513 if (frame->timestamp() <= start_timestamp_) {
504 if (use_new_video_renderering_path_) 514 if (use_new_video_renderering_path_)
505 algorithm_->Reset(); 515 algorithm_->Reset();
506 ready_frames_.clear(); 516 ready_frames_.clear();
507 } 517 }
508 AddReadyFrame_Locked(frame); 518 AddReadyFrame_Locked(frame);
509 } 519 }
510 520
511 // Background rendering updates may not be ticking fast enough by itself to 521 // Background rendering updates may not be ticking fast enough by itself to
512 // remove expired frames, so give it a boost here by ensuring we don't exit 522 // remove expired frames, so give it a boost here by ensuring we don't exit
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 base::TimeTicks VideoRendererImpl::ConvertMediaTimestamp( 787 base::TimeTicks VideoRendererImpl::ConvertMediaTimestamp(
778 base::TimeDelta media_time) { 788 base::TimeDelta media_time) {
779 std::vector<base::TimeDelta> media_times(1, media_time); 789 std::vector<base::TimeDelta> media_times(1, media_time);
780 std::vector<base::TimeTicks> wall_clock_times; 790 std::vector<base::TimeTicks> wall_clock_times;
781 if (!wall_clock_time_cb_.Run(media_times, &wall_clock_times)) 791 if (!wall_clock_time_cb_.Run(media_times, &wall_clock_times))
782 return base::TimeTicks(); 792 return base::TimeTicks();
783 return wall_clock_times[0]; 793 return wall_clock_times[0];
784 } 794 }
785 795
786 } // namespace media 796 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/renderers/video_renderer_impl_unittest.cc » ('j') | media/renderers/video_renderer_impl_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698