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

Unified Diff: media/renderers/audio_renderer_impl.cc

Issue 2425463002: Improve HTMLMediaElement::currentTime() (Closed)
Patch Set: Merge Created 4 years, 1 month 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
« no previous file with comments | « media/renderers/audio_renderer_impl.h ('k') | media/renderers/audio_renderer_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/renderers/audio_renderer_impl.cc
diff --git a/media/renderers/audio_renderer_impl.cc b/media/renderers/audio_renderer_impl.cc
index 379c9570b114175ad358f3c31ec1e0f9af0f2759..12d53f7a1837aec3c125446b09b8fd4639e0acb1 100644
--- a/media/renderers/audio_renderer_impl.cc
+++ b/media/renderers/audio_renderer_impl.cc
@@ -57,7 +57,6 @@ AudioRendererImpl::AudioRendererImpl(
received_end_of_stream_(false),
rendered_end_of_stream_(false),
is_suspending_(false),
- last_reported_media_time_(kNoTimestamp),
weak_factory_(this) {
audio_buffer_stream_->set_splice_observer(base::Bind(
&AudioRendererImpl::OnNewSpliceBuffer, weak_factory_.GetWeakPtr()));
@@ -176,27 +175,11 @@ void AudioRendererImpl::SetMediaTime(base::TimeDelta time) {
last_render_time_ = stop_rendering_time_ = base::TimeTicks();
first_packet_timestamp_ = kNoTimestamp;
audio_clock_.reset(new AudioClock(time, audio_parameters_.sample_rate()));
- last_reported_media_time_ = kNoTimestamp;
}
base::TimeDelta AudioRendererImpl::CurrentMediaTime() {
base::AutoLock auto_lock(lock_);
- // Re-use last reported time if rendering has stopped to avoid confusing blink
- // layer (avoid currentTime advancing after signaling buffer underflow).
- // TODO(chcunningham): Do this in blink instead. Patching it here for now
- // because HTMLMediaElement's currentTime is a mess.
- if (!rendering_ && last_reported_media_time_ != kNoTimestamp) {
- // If rendering stops, be sure to at least report the front time of the most
- // recently rendered audio buffer.
- if (last_reported_media_time_ < audio_clock_->front_timestamp())
- last_reported_media_time_ = audio_clock_->front_timestamp();
-
- DVLOG(3) << __func__ << " Returning cached time while rendering stopped:"
- << last_reported_media_time_.InMicroseconds();
- return last_reported_media_time_;
- }
-
// Return the current time based on the known extents of the rendered audio
// data plus an estimate based on the last time those values were calculated.
base::TimeDelta current_media_time = audio_clock_->front_timestamp();
@@ -207,7 +190,6 @@ base::TimeDelta AudioRendererImpl::CurrentMediaTime() {
current_media_time = audio_clock_->back_timestamp();
}
- last_reported_media_time_ = current_media_time;
return current_media_time;
}
@@ -452,7 +434,6 @@ void AudioRendererImpl::Initialize(DemuxerStream* stream,
audio_clock_.reset(
new AudioClock(base::TimeDelta(), audio_parameters_.sample_rate()));
- last_reported_media_time_ = kNoTimestamp;
audio_buffer_stream_->Initialize(
stream, base::Bind(&AudioRendererImpl::OnAudioBufferStreamInitialized,
« no previous file with comments | « media/renderers/audio_renderer_impl.h ('k') | media/renderers/audio_renderer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698