OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer_impl.h" | 5 #include "media/renderers/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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 void RendererImpl::EnableClocklessVideoPlaybackForTesting() { | 222 void RendererImpl::EnableClocklessVideoPlaybackForTesting() { |
223 DVLOG(1) << __FUNCTION__; | 223 DVLOG(1) << __FUNCTION__; |
224 DCHECK(task_runner_->BelongsToCurrentThread()); | 224 DCHECK(task_runner_->BelongsToCurrentThread()); |
225 DCHECK_EQ(state_, STATE_UNINITIALIZED); | 225 DCHECK_EQ(state_, STATE_UNINITIALIZED); |
226 DCHECK(underflow_disabled_for_testing_) | 226 DCHECK(underflow_disabled_for_testing_) |
227 << "Underflow must be disabled for clockless video playback"; | 227 << "Underflow must be disabled for clockless video playback"; |
228 | 228 |
229 clockless_video_playback_enabled_for_testing_ = true; | 229 clockless_video_playback_enabled_for_testing_ = true; |
230 } | 230 } |
231 | 231 |
232 base::TimeTicks RendererImpl::GetWallClockTime(base::TimeDelta time) { | 232 bool RendererImpl::GetWallClockTime( |
| 233 const std::vector<base::TimeDelta>& media_timestamps, |
| 234 std::vector<base::TimeTicks>* wall_clock_times) { |
233 // No BelongsToCurrentThread() checking because this can be called from other | 235 // No BelongsToCurrentThread() checking because this can be called from other |
234 // threads. | 236 // threads. |
235 // | 237 // |
236 // TODO(scherkus): Currently called from VideoRendererImpl's internal thread, | 238 // TODO(scherkus): Currently called from VideoRendererImpl's internal thread, |
237 // which should go away at some point http://crbug.com/110814 | 239 // which should go away at some point http://crbug.com/110814 |
238 if (clockless_video_playback_enabled_for_testing_) | 240 if (clockless_video_playback_enabled_for_testing_) { |
239 return base::TimeTicks::Now(); | 241 *wall_clock_times = std::vector<base::TimeTicks>(media_timestamps.size(), |
| 242 base::TimeTicks::Now()); |
| 243 return true; |
| 244 } |
240 | 245 |
241 return time_source_->GetWallClockTime(time); | 246 return time_source_->GetWallClockTime(media_timestamps, wall_clock_times); |
242 } | 247 } |
243 | 248 |
244 void RendererImpl::SetDecryptorReadyCallback( | 249 void RendererImpl::SetDecryptorReadyCallback( |
245 const DecryptorReadyCB& decryptor_ready_cb) { | 250 const DecryptorReadyCB& decryptor_ready_cb) { |
246 // Cancels the previous decryptor request. | 251 // Cancels the previous decryptor request. |
247 if (decryptor_ready_cb.is_null()) { | 252 if (decryptor_ready_cb.is_null()) { |
248 if (!decryptor_ready_cb_.is_null()) { | 253 if (!decryptor_ready_cb_.is_null()) { |
249 base::ResetAndReturn(&decryptor_ready_cb_) | 254 base::ResetAndReturn(&decryptor_ready_cb_) |
250 .Run(nullptr, base::Bind(IgnoreCdmAttached)); | 255 .Run(nullptr, base::Bind(IgnoreCdmAttached)); |
251 } | 256 } |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 } | 631 } |
627 | 632 |
628 // After OnError() returns, the pipeline may destroy |this|. | 633 // After OnError() returns, the pipeline may destroy |this|. |
629 base::ResetAndReturn(&error_cb_).Run(error); | 634 base::ResetAndReturn(&error_cb_).Run(error); |
630 | 635 |
631 if (!flush_cb_.is_null()) | 636 if (!flush_cb_.is_null()) |
632 base::ResetAndReturn(&flush_cb_).Run(); | 637 base::ResetAndReturn(&flush_cb_).Run(); |
633 } | 638 } |
634 | 639 |
635 } // namespace media | 640 } // namespace media |
OLD | NEW |