| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 DCHECK_EQ(buffering_state_, BUFFERING_HAVE_NOTHING); | 116 DCHECK_EQ(buffering_state_, BUFFERING_HAVE_NOTHING); |
| 117 | 117 |
| 118 state_ = kPlaying; | 118 state_ = kPlaying; |
| 119 start_timestamp_ = timestamp; | 119 start_timestamp_ = timestamp; |
| 120 AttemptRead_Locked(); | 120 AttemptRead_Locked(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void VideoRendererImpl::Initialize( | 123 void VideoRendererImpl::Initialize( |
| 124 DemuxerStream* stream, | 124 DemuxerStream* stream, |
| 125 const PipelineStatusCB& init_cb, | 125 const PipelineStatusCB& init_cb, |
| 126 const SetCdmReadyCB& set_cdm_ready_cb, | 126 CdmContext* cdm_context, |
| 127 const StatisticsCB& statistics_cb, | 127 const StatisticsCB& statistics_cb, |
| 128 const BufferingStateCB& buffering_state_cb, | 128 const BufferingStateCB& buffering_state_cb, |
| 129 const base::Closure& ended_cb, | 129 const base::Closure& ended_cb, |
| 130 const PipelineStatusCB& error_cb, | 130 const PipelineStatusCB& error_cb, |
| 131 const TimeSource::WallClockTimeCB& wall_clock_time_cb, | 131 const TimeSource::WallClockTimeCB& wall_clock_time_cb, |
| 132 const base::Closure& waiting_for_decryption_key_cb) { | 132 const base::Closure& waiting_for_decryption_key_cb) { |
| 133 DCHECK(task_runner_->BelongsToCurrentThread()); | 133 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 134 base::AutoLock auto_lock(lock_); | 134 base::AutoLock auto_lock(lock_); |
| 135 DCHECK(stream); | 135 DCHECK(stream); |
| 136 DCHECK_EQ(stream->type(), DemuxerStream::VIDEO); | 136 DCHECK_EQ(stream->type(), DemuxerStream::VIDEO); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 161 | 161 |
| 162 statistics_cb_ = statistics_cb; | 162 statistics_cb_ = statistics_cb; |
| 163 ended_cb_ = ended_cb; | 163 ended_cb_ = ended_cb; |
| 164 error_cb_ = error_cb; | 164 error_cb_ = error_cb; |
| 165 wall_clock_time_cb_ = wall_clock_time_cb; | 165 wall_clock_time_cb_ = wall_clock_time_cb; |
| 166 state_ = kInitializing; | 166 state_ = kInitializing; |
| 167 | 167 |
| 168 video_frame_stream_->Initialize( | 168 video_frame_stream_->Initialize( |
| 169 stream, base::Bind(&VideoRendererImpl::OnVideoFrameStreamInitialized, | 169 stream, base::Bind(&VideoRendererImpl::OnVideoFrameStreamInitialized, |
| 170 weak_factory_.GetWeakPtr()), | 170 weak_factory_.GetWeakPtr()), |
| 171 set_cdm_ready_cb, statistics_cb, waiting_for_decryption_key_cb); | 171 cdm_context, statistics_cb, waiting_for_decryption_key_cb); |
| 172 } | 172 } |
| 173 | 173 |
| 174 scoped_refptr<VideoFrame> VideoRendererImpl::Render( | 174 scoped_refptr<VideoFrame> VideoRendererImpl::Render( |
| 175 base::TimeTicks deadline_min, | 175 base::TimeTicks deadline_min, |
| 176 base::TimeTicks deadline_max, | 176 base::TimeTicks deadline_max, |
| 177 bool background_rendering) { | 177 bool background_rendering) { |
| 178 base::AutoLock auto_lock(lock_); | 178 base::AutoLock auto_lock(lock_); |
| 179 DCHECK_EQ(state_, kPlaying); | 179 DCHECK_EQ(state_, kPlaying); |
| 180 | 180 |
| 181 size_t frames_dropped = 0; | 181 size_t frames_dropped = 0; |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 if (!wall_clock_time_cb_.Run(media_times, &wall_clock_times)) | 635 if (!wall_clock_time_cb_.Run(media_times, &wall_clock_times)) |
| 636 return base::TimeTicks(); | 636 return base::TimeTicks(); |
| 637 return wall_clock_times[0]; | 637 return wall_clock_times[0]; |
| 638 } | 638 } |
| 639 | 639 |
| 640 bool VideoRendererImpl::IsBeforeStartTime(base::TimeDelta timestamp) { | 640 bool VideoRendererImpl::IsBeforeStartTime(base::TimeDelta timestamp) { |
| 641 return timestamp + video_frame_stream_->AverageDuration() < start_timestamp_; | 641 return timestamp + video_frame_stream_->AverageDuration() < start_timestamp_; |
| 642 } | 642 } |
| 643 | 643 |
| 644 } // namespace media | 644 } // namespace media |
| OLD | NEW |