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

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

Issue 1136513004: Switch GetWallClockTime to using vectors for input and output. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comments. Created 5 years, 7 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 | « media/renderers/renderer_impl.h ('k') | media/renderers/video_renderer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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::GetWallClockTimes(
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_->GetWallClockTimes(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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 } 334 }
330 335
331 video_renderer_->Initialize( 336 video_renderer_->Initialize(
332 demuxer_stream_provider_->GetStream(DemuxerStream::VIDEO), done_cb, 337 demuxer_stream_provider_->GetStream(DemuxerStream::VIDEO), done_cb,
333 base::Bind(&RendererImpl::SetDecryptorReadyCallback, weak_this_), 338 base::Bind(&RendererImpl::SetDecryptorReadyCallback, weak_this_),
334 base::Bind(&RendererImpl::OnUpdateStatistics, weak_this_), 339 base::Bind(&RendererImpl::OnUpdateStatistics, weak_this_),
335 base::Bind(&RendererImpl::OnBufferingStateChanged, weak_this_, 340 base::Bind(&RendererImpl::OnBufferingStateChanged, weak_this_,
336 &video_buffering_state_), 341 &video_buffering_state_),
337 base::Bind(&RendererImpl::OnVideoRendererEnded, weak_this_), 342 base::Bind(&RendererImpl::OnVideoRendererEnded, weak_this_),
338 base::Bind(&RendererImpl::OnError, weak_this_), 343 base::Bind(&RendererImpl::OnError, weak_this_),
339 base::Bind(&RendererImpl::GetWallClockTime, base::Unretained(this)), 344 base::Bind(&RendererImpl::GetWallClockTimes, base::Unretained(this)),
340 waiting_for_decryption_key_cb_); 345 waiting_for_decryption_key_cb_);
341 } 346 }
342 347
343 void RendererImpl::OnVideoRendererInitializeDone(PipelineStatus status) { 348 void RendererImpl::OnVideoRendererInitializeDone(PipelineStatus status) {
344 DVLOG(1) << __FUNCTION__ << ": " << status; 349 DVLOG(1) << __FUNCTION__ << ": " << status;
345 DCHECK(task_runner_->BelongsToCurrentThread()); 350 DCHECK(task_runner_->BelongsToCurrentThread());
346 351
347 // OnError() may be fired at any time by the renderers, even if they thought 352 // OnError() may be fired at any time by the renderers, even if they thought
348 // they initialized successfully (due to delayed output device setup). 353 // they initialized successfully (due to delayed output device setup).
349 if (state_ != STATE_INITIALIZING) { 354 if (state_ != STATE_INITIALIZING) {
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « media/renderers/renderer_impl.h ('k') | media/renderers/video_renderer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698