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

Unified Diff: media/base/android/media_source_player.cc

Issue 376013003: Rename media::Clock to media::TimeDeltaInterpolator and update API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: media/base/android/media_source_player.cc
diff --git a/media/base/android/media_source_player.cc b/media/base/android/media_source_player.cc
index 611c31338358e2098525ce20cea4e05df41c900b..56f8e318bd67dfc99db09a69f1f316e494ec21d5 100644
--- a/media/base/android/media_source_player.cc
+++ b/media/base/android/media_source_player.cc
@@ -38,7 +38,7 @@ MediaSourcePlayer::MediaSourcePlayer(
demuxer_(demuxer.Pass()),
pending_event_(NO_EVENT_PENDING),
playing_(false),
- clock_(&default_tick_clock_),
+ interpolator_(&default_tick_clock_),
doing_browser_seek_(false),
pending_seek_(false),
drm_bridge_(NULL),
@@ -62,7 +62,7 @@ MediaSourcePlayer::MediaSourcePlayer(
base::Bind(&MediaSourcePlayer::OnDemuxerConfigsChanged,
weak_factory_.GetWeakPtr())));
demuxer_->Initialize(this);
- clock_.SetMaxTime(base::TimeDelta());
+ interpolator_.SetMaxTime(base::TimeDelta());
weak_this_ = weak_factory_.GetWeakPtr();
}
@@ -90,7 +90,7 @@ void MediaSourcePlayer::ScheduleSeekEventAndStopDecoding(
pending_seek_ = false;
- clock_.SetTime(seek_time, seek_time);
+ interpolator_.SetTime(seek_time, seek_time);
if (audio_decoder_job_->is_decoding())
audio_decoder_job_->StopDecode();
@@ -173,7 +173,7 @@ void MediaSourcePlayer::SeekTo(base::TimeDelta timestamp) {
}
base::TimeDelta MediaSourcePlayer::GetCurrentTime() {
- return std::min(clock_.Elapsed(), duration_);
+ return std::min(interpolator_.GetInterpolatedTime(), duration_);
}
base::TimeDelta MediaSourcePlayer::GetDuration() {
@@ -328,7 +328,7 @@ void MediaSourcePlayer::OnDemuxerSeekDone(
DCHECK(seek_time >= GetCurrentTime());
DVLOG(1) << __FUNCTION__ << " : setting clock to actual browser seek time: "
<< seek_time.InSecondsF();
- clock_.SetTime(seek_time, seek_time);
+ interpolator_.SetTime(seek_time, seek_time);
audio_decoder_job_->SetBaseTimestamp(seek_time);
} else {
DCHECK(actual_browser_seek_time == kNoTimestamp());
@@ -354,7 +354,8 @@ void MediaSourcePlayer::OnDemuxerSeekDone(
void MediaSourcePlayer::UpdateTimestamps(
base::TimeDelta current_presentation_timestamp,
base::TimeDelta max_presentation_timestamp) {
- clock_.SetTime(current_presentation_timestamp, max_presentation_timestamp);
+ interpolator_.SetTime(current_presentation_timestamp,
+ max_presentation_timestamp);
manager()->OnTimeUpdate(player_id(), GetCurrentTime());
}
@@ -489,7 +490,7 @@ void MediaSourcePlayer::MediaDecoderCallback(
if (!playing_) {
if (is_clock_manager)
- clock_.Pause();
+ interpolator_.StopInterpolating();
return;
}
@@ -571,7 +572,7 @@ void MediaSourcePlayer::PlaybackCompleted(bool is_audio) {
if (AudioFinished() && VideoFinished()) {
playing_ = false;
- clock_.Pause();
+ interpolator_.StopInterpolating();
start_time_ticks_ = base::TimeTicks();
manager()->OnPlaybackComplete(player_id());
}
@@ -670,8 +671,8 @@ void MediaSourcePlayer::OnPrefetchDone() {
start_time_ticks_ = base::TimeTicks::Now();
start_presentation_timestamp_ = GetCurrentTime();
- if (!clock_.IsPlaying())
- clock_.Play();
+ if (!interpolator_.interpolating())
+ interpoatlor_.StartInterpolating();
acolwell GONE FROM CHROMIUM 2014/07/09 00:42:46 s/poatl/polat/
scherkus (not reviewing) 2014/07/09 01:54:31 Done.
if (!AudioFinished())
DecodeMoreAudio();

Powered by Google App Engine
This is Rietveld 408576698