| 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 "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 Loading... |
| 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 | |
| 179 statistics_cb_ = statistics_cb; | 174 statistics_cb_ = statistics_cb; |
| 175 buffering_state_cb_ = buffering_state_cb; |
| 180 paint_cb_ = base::Bind(&VideoRendererSink::PaintFrameUsingOldRenderingPath, | 176 paint_cb_ = base::Bind(&VideoRendererSink::PaintFrameUsingOldRenderingPath, |
| 181 base::Unretained(sink_)); | 177 base::Unretained(sink_)); |
| 182 ended_cb_ = ended_cb; | 178 ended_cb_ = ended_cb; |
| 183 error_cb_ = error_cb; | 179 error_cb_ = error_cb; |
| 184 wall_clock_time_cb_ = wall_clock_time_cb; | 180 wall_clock_time_cb_ = wall_clock_time_cb; |
| 185 state_ = kInitializing; | 181 state_ = kInitializing; |
| 186 | 182 |
| 187 video_frame_stream_->Initialize( | 183 video_frame_stream_->Initialize( |
| 188 stream, base::Bind(&VideoRendererImpl::OnVideoFrameStreamInitialized, | 184 stream, base::Bind(&VideoRendererImpl::OnVideoFrameStreamInitialized, |
| 189 weak_factory_.GetWeakPtr()), | 185 weak_factory_.GetWeakPtr()), |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 base::TimeTicks VideoRendererImpl::ConvertMediaTimestamp( | 743 base::TimeTicks VideoRendererImpl::ConvertMediaTimestamp( |
| 748 base::TimeDelta media_time) { | 744 base::TimeDelta media_time) { |
| 749 std::vector<base::TimeDelta> media_times(1, media_time); | 745 std::vector<base::TimeDelta> media_times(1, media_time); |
| 750 std::vector<base::TimeTicks> wall_clock_times; | 746 std::vector<base::TimeTicks> wall_clock_times; |
| 751 if (!wall_clock_time_cb_.Run(media_times, &wall_clock_times)) | 747 if (!wall_clock_time_cb_.Run(media_times, &wall_clock_times)) |
| 752 return base::TimeTicks(); | 748 return base::TimeTicks(); |
| 753 return wall_clock_times[0]; | 749 return wall_clock_times[0]; |
| 754 } | 750 } |
| 755 | 751 |
| 756 } // namespace media | 752 } // namespace media |
| OLD | NEW |