| 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/location.h" | 10 #include "base/location.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 DCHECK_EQ(buffering_state_, BUFFERING_HAVE_NOTHING); | 113 DCHECK_EQ(buffering_state_, BUFFERING_HAVE_NOTHING); |
| 114 | 114 |
| 115 state_ = kPlaying; | 115 state_ = kPlaying; |
| 116 start_timestamp_ = timestamp; | 116 start_timestamp_ = timestamp; |
| 117 AttemptRead_Locked(); | 117 AttemptRead_Locked(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void VideoRendererImpl::Initialize( | 120 void VideoRendererImpl::Initialize( |
| 121 DemuxerStream* stream, | 121 DemuxerStream* stream, |
| 122 const PipelineStatusCB& init_cb, | 122 const PipelineStatusCB& init_cb, |
| 123 const SetDecryptorReadyCB& set_decryptor_ready_cb, | 123 const SetCdmReadyCB& set_cdm_ready_cb, |
| 124 const StatisticsCB& statistics_cb, | 124 const StatisticsCB& statistics_cb, |
| 125 const BufferingStateCB& buffering_state_cb, | 125 const BufferingStateCB& buffering_state_cb, |
| 126 const base::Closure& ended_cb, | 126 const base::Closure& ended_cb, |
| 127 const PipelineStatusCB& error_cb, | 127 const PipelineStatusCB& error_cb, |
| 128 const TimeSource::WallClockTimeCB& wall_clock_time_cb, | 128 const TimeSource::WallClockTimeCB& wall_clock_time_cb, |
| 129 const base::Closure& waiting_for_decryption_key_cb) { | 129 const base::Closure& waiting_for_decryption_key_cb) { |
| 130 DCHECK(task_runner_->BelongsToCurrentThread()); | 130 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 131 base::AutoLock auto_lock(lock_); | 131 base::AutoLock auto_lock(lock_); |
| 132 DCHECK(stream); | 132 DCHECK(stream); |
| 133 DCHECK_EQ(stream->type(), DemuxerStream::VIDEO); | 133 DCHECK_EQ(stream->type(), DemuxerStream::VIDEO); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 158 | 158 |
| 159 statistics_cb_ = statistics_cb; | 159 statistics_cb_ = statistics_cb; |
| 160 ended_cb_ = ended_cb; | 160 ended_cb_ = ended_cb; |
| 161 error_cb_ = error_cb; | 161 error_cb_ = error_cb; |
| 162 wall_clock_time_cb_ = wall_clock_time_cb; | 162 wall_clock_time_cb_ = wall_clock_time_cb; |
| 163 state_ = kInitializing; | 163 state_ = kInitializing; |
| 164 | 164 |
| 165 video_frame_stream_->Initialize( | 165 video_frame_stream_->Initialize( |
| 166 stream, base::Bind(&VideoRendererImpl::OnVideoFrameStreamInitialized, | 166 stream, base::Bind(&VideoRendererImpl::OnVideoFrameStreamInitialized, |
| 167 weak_factory_.GetWeakPtr()), | 167 weak_factory_.GetWeakPtr()), |
| 168 set_decryptor_ready_cb, statistics_cb, waiting_for_decryption_key_cb); | 168 set_cdm_ready_cb, statistics_cb, waiting_for_decryption_key_cb); |
| 169 } | 169 } |
| 170 | 170 |
| 171 scoped_refptr<VideoFrame> VideoRendererImpl::Render( | 171 scoped_refptr<VideoFrame> VideoRendererImpl::Render( |
| 172 base::TimeTicks deadline_min, | 172 base::TimeTicks deadline_min, |
| 173 base::TimeTicks deadline_max, | 173 base::TimeTicks deadline_max, |
| 174 bool background_rendering) { | 174 bool background_rendering) { |
| 175 base::AutoLock auto_lock(lock_); | 175 base::AutoLock auto_lock(lock_); |
| 176 DCHECK_EQ(state_, kPlaying); | 176 DCHECK_EQ(state_, kPlaying); |
| 177 | 177 |
| 178 size_t frames_dropped = 0; | 178 size_t frames_dropped = 0; |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 base::TimeTicks VideoRendererImpl::ConvertMediaTimestamp( | 630 base::TimeTicks VideoRendererImpl::ConvertMediaTimestamp( |
| 631 base::TimeDelta media_time) { | 631 base::TimeDelta media_time) { |
| 632 std::vector<base::TimeDelta> media_times(1, media_time); | 632 std::vector<base::TimeDelta> media_times(1, media_time); |
| 633 std::vector<base::TimeTicks> wall_clock_times; | 633 std::vector<base::TimeTicks> wall_clock_times; |
| 634 if (!wall_clock_time_cb_.Run(media_times, &wall_clock_times)) | 634 if (!wall_clock_time_cb_.Run(media_times, &wall_clock_times)) |
| 635 return base::TimeTicks(); | 635 return base::TimeTicks(); |
| 636 return wall_clock_times[0]; | 636 return wall_clock_times[0]; |
| 637 } | 637 } |
| 638 | 638 |
| 639 } // namespace media | 639 } // namespace media |
| OLD | NEW |