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

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

Issue 1157573009: Revert of Revert of Always post buffering state updates since they may change sink state. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@underflow
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 DCHECK(!posted_maybe_stop_after_first_paint_); 164 DCHECK(!posted_maybe_stop_after_first_paint_);
165 DCHECK(!was_background_rendering_); 165 DCHECK(!was_background_rendering_);
166 DCHECK(!time_progressing_); 166 DCHECK(!time_progressing_);
167 167
168 low_delay_ = (stream->liveness() == DemuxerStream::LIVENESS_LIVE); 168 low_delay_ = (stream->liveness() == DemuxerStream::LIVENESS_LIVE);
169 169
170 // Always post |init_cb_| because |this| could be destroyed if initialization 170 // Always post |init_cb_| because |this| could be destroyed if initialization
171 // failed. 171 // failed.
172 init_cb_ = BindToCurrentLoop(init_cb); 172 init_cb_ = BindToCurrentLoop(init_cb);
173 173
174 // Always post |buffering_state_cb_| because it may otherwise invoke reentrant
175 // calls to OnTimeStateChanged() under lock, which can deadlock the compositor
176 // and media threads.
177 buffering_state_cb_ = BindToCurrentLoop(buffering_state_cb);
178
174 statistics_cb_ = statistics_cb; 179 statistics_cb_ = statistics_cb;
175 buffering_state_cb_ = buffering_state_cb;
176 paint_cb_ = base::Bind(&VideoRendererSink::PaintFrameUsingOldRenderingPath, 180 paint_cb_ = base::Bind(&VideoRendererSink::PaintFrameUsingOldRenderingPath,
177 base::Unretained(sink_)); 181 base::Unretained(sink_));
178 ended_cb_ = ended_cb; 182 ended_cb_ = ended_cb;
179 error_cb_ = error_cb; 183 error_cb_ = error_cb;
180 wall_clock_time_cb_ = wall_clock_time_cb; 184 wall_clock_time_cb_ = wall_clock_time_cb;
181 state_ = kInitializing; 185 state_ = kInitializing;
182 186
183 video_frame_stream_->Initialize( 187 video_frame_stream_->Initialize(
184 stream, base::Bind(&VideoRendererImpl::OnVideoFrameStreamInitialized, 188 stream, base::Bind(&VideoRendererImpl::OnVideoFrameStreamInitialized,
185 weak_factory_.GetWeakPtr()), 189 weak_factory_.GetWeakPtr()),
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 base::TimeTicks VideoRendererImpl::ConvertMediaTimestamp( 747 base::TimeTicks VideoRendererImpl::ConvertMediaTimestamp(
744 base::TimeDelta media_time) { 748 base::TimeDelta media_time) {
745 std::vector<base::TimeDelta> media_times(1, media_time); 749 std::vector<base::TimeDelta> media_times(1, media_time);
746 std::vector<base::TimeTicks> wall_clock_times; 750 std::vector<base::TimeTicks> wall_clock_times;
747 if (!wall_clock_time_cb_.Run(media_times, &wall_clock_times)) 751 if (!wall_clock_time_cb_.Run(media_times, &wall_clock_times))
748 return base::TimeTicks(); 752 return base::TimeTicks();
749 return wall_clock_times[0]; 753 return wall_clock_times[0];
750 } 754 }
751 755
752 } // namespace media 756 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698