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

Side by Side Diff: media/base/pipeline.cc

Issue 9582017: Change Clock::SetMaxTime() to be safe even in the presence of slow pipelines. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
« media/base/clock.cc ('K') | « media/base/clock.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/base/pipeline.h" 5 #include "media/base/pipeline.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 } 460 }
461 461
462 void Pipeline::OnVideoTimeUpdate(base::TimeDelta max_time) { 462 void Pipeline::OnVideoTimeUpdate(base::TimeDelta max_time) {
463 DCHECK(IsRunning()); 463 DCHECK(IsRunning());
464 base::AutoLock auto_lock(lock_); 464 base::AutoLock auto_lock(lock_);
465 465
466 if (has_audio_) 466 if (has_audio_)
467 return; 467 return;
468 468
469 DCHECK(!waiting_for_clock_update_); 469 DCHECK(!waiting_for_clock_update_);
470 DCHECK(clock_->Elapsed() <= max_time);
471 clock_->SetMaxTime(max_time); 470 clock_->SetMaxTime(max_time);
472 } 471 }
473 472
474 void Pipeline::SetDuration(base::TimeDelta duration) { 473 void Pipeline::SetDuration(base::TimeDelta duration) {
475 DCHECK(IsRunning()); 474 DCHECK(IsRunning());
476 media_log_->AddEvent( 475 media_log_->AddEvent(
477 media_log_->CreateTimeEvent( 476 media_log_->CreateTimeEvent(
478 MediaLogEvent::DURATION_SET, "duration", duration)); 477 MediaLogEvent::DURATION_SET, "duration", duration));
479 UMA_HISTOGRAM_LONG_TIMES("Media.Duration", duration); 478 UMA_HISTOGRAM_LONG_TIMES("Media.Duration", duration);
480 479
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { 1417 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() {
1419 lock_.AssertAcquired(); 1418 lock_.AssertAcquired();
1420 if (!waiting_for_clock_update_) 1419 if (!waiting_for_clock_update_)
1421 return; 1420 return;
1422 1421
1423 waiting_for_clock_update_ = false; 1422 waiting_for_clock_update_ = false;
1424 clock_->Play(); 1423 clock_->Play();
1425 } 1424 }
1426 1425
1427 } // namespace media 1426 } // namespace media
OLDNEW
« media/base/clock.cc ('K') | « media/base/clock.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698