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

Unified Diff: media/renderers/audio_renderer_impl.cc

Issue 2366373003: Not for submission. fastSeek prototype. (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « media/renderers/audio_renderer_impl.h ('k') | media/renderers/renderer_impl.h » ('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 3d24cf6508bc8a10518b0d60f94b4658755d7579..4bb660440d54bad4b530ee900a9ad458d2737d34 100644
--- a/media/renderers/audio_renderer_impl.cc
+++ b/media/renderers/audio_renderer_impl.cc
@@ -164,7 +164,21 @@ void AudioRendererImpl::SetMediaTime(base::TimeDelta time) {
base::AutoLock auto_lock(lock_);
DCHECK(!rendering_);
- DCHECK_EQ(state_, kFlushed);
+ DCHECK(state_ == kFlushed || state_ == kPlaying);
+
+ start_timestamp_ = time;
+ ended_timestamp_ = kInfiniteDuration;
+ last_render_time_ = stop_rendering_time_ = base::TimeTicks();
+ first_packet_timestamp_ = kNoTimestamp;
+ audio_clock_.reset(new AudioClock(time, audio_parameters_.sample_rate()));
+}
+
+void AudioRendererImpl::SetMediaTime_Locked(base::TimeDelta time) {
+ DVLOG(1) << __func__ << "(" << time << ")";
+ DCHECK(task_runner_->BelongsToCurrentThread());
+
+ DCHECK(!rendering_);
+ DCHECK(state_ == kFlushed || state_ == kPlaying);
start_timestamp_ = time;
ended_timestamp_ = kInfiniteDuration;
@@ -308,7 +322,7 @@ void AudioRendererImpl::ResetDecoderDone() {
task_runner_->PostTask(FROM_HERE, base::ResetAndReturn(&flush_cb_));
}
-void AudioRendererImpl::StartPlaying() {
+void AudioRendererImpl::StartPlayingFrom(StreamPosition position) {
DVLOG(1) << __func__;
DCHECK(task_runner_->BelongsToCurrentThread());
@@ -318,6 +332,8 @@ void AudioRendererImpl::StartPlaying() {
DCHECK_EQ(buffering_state_, BUFFERING_HAVE_NOTHING);
DCHECK(!pending_read_) << "Pending read must complete before seeking";
+ start_rendering_from_first_frame_ =
+ position.kind == StreamPosition::Kind::KEY_FRAME_PRECEDING_TIME;
ChangeState_Locked(kPlaying);
AttemptRead_Locked();
}
@@ -594,6 +610,12 @@ void AudioRendererImpl::DecodedAudioReady(
return;
}
+ if (start_rendering_from_first_frame_) {
+ LOG(ERROR) << "First audio timestamp: " << buffer->timestamp();
+ SetMediaTime_Locked(buffer->timestamp());
+ start_rendering_from_first_frame_ = false;
+ }
+
if (!splicer_->AddInput(buffer)) {
HandleAbortedReadOrDecodeError(AUDIO_RENDERER_ERROR_SPLICE_FAILED);
return;
« no previous file with comments | « media/renderers/audio_renderer_impl.h ('k') | media/renderers/renderer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698