| Index: media/filters/pipeline_controller.cc
|
| diff --git a/media/filters/pipeline_controller.cc b/media/filters/pipeline_controller.cc
|
| index 2055afb9dc08cdd3a3879434301051a1b84167c8..8b1fdbec480a13189009716259c1616d2f0b690e 100644
|
| --- a/media/filters/pipeline_controller.cc
|
| +++ b/media/filters/pipeline_controller.cc
|
| @@ -55,7 +55,7 @@ void PipelineController::Start(Demuxer* demuxer,
|
| weak_factory_.GetWeakPtr(), State::PLAYING));
|
| }
|
|
|
| -void PipelineController::Seek(base::TimeDelta time, bool time_updated) {
|
| +void PipelineController::Seek(StreamPosition position, bool time_updated) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| // It would be slightly more clear to set this in Dispatch(), but we want to
|
| @@ -67,12 +67,12 @@ void PipelineController::Seek(base::TimeDelta time, bool time_updated) {
|
| // If we are already seeking to |time|, and the media is static, elide the
|
| // seek.
|
| if ((state_ == State::SEEKING || state_ == State::RESUMING) &&
|
| - seek_time_ == time && is_static_) {
|
| + seek_position_ == position && is_static_) {
|
| pending_seek_ = false;
|
| return;
|
| }
|
|
|
| - pending_seek_time_ = time;
|
| + pending_seek_position_ = position;
|
| pending_seek_ = true;
|
| Dispatch();
|
| }
|
| @@ -157,16 +157,16 @@ void PipelineController::Dispatch() {
|
| if (pending_resume_ && state_ == State::SUSPENDED) {
|
| // If there is a pending seek, resume to that time instead...
|
| if (pending_seek_) {
|
| - seek_time_ = pending_seek_time_;
|
| + seek_position_ = StreamPosition::Precise(pending_seek_position_.time);
|
| pending_seek_ = false;
|
| } else {
|
| - seek_time_ = pipeline_->GetMediaTime();
|
| + seek_position_ = StreamPosition::Precise(pipeline_->GetMediaTime());
|
| }
|
|
|
| // ...unless the media is streaming, in which case we resume at the start
|
| // because seeking doesn't work well.
|
| - if (is_streaming_ && !seek_time_.is_zero()) {
|
| - seek_time_ = base::TimeDelta();
|
| + if (is_streaming_ && !seek_position_.time.is_zero()) {
|
| + seek_position_ = StreamPosition::Precise(base::TimeDelta());
|
|
|
| // In this case we want to make sure that the controls get updated
|
| // immediately, so we don't try to hide the seek.
|
| @@ -176,11 +176,11 @@ void PipelineController::Dispatch() {
|
| // Tell |demuxer_| to expect our resume.
|
| DCHECK(!waiting_for_seek_);
|
| waiting_for_seek_ = true;
|
| - demuxer_->StartWaitingForSeek(seek_time_);
|
| + demuxer_->StartWaitingForSeek(seek_position_.time);
|
|
|
| pending_resume_ = false;
|
| state_ = State::RESUMING;
|
| - pipeline_->Resume(renderer_factory_cb_.Run(), seek_time_,
|
| + pipeline_->Resume(renderer_factory_cb_.Run(), seek_position_.time,
|
| base::Bind(&PipelineController::OnPipelineStatus,
|
| weak_factory_.GetWeakPtr(), State::PLAYING));
|
| return;
|
| @@ -190,29 +190,29 @@ void PipelineController::Dispatch() {
|
| if ((pending_seek_ || pending_suspend_) && waiting_for_seek_) {
|
| // If there is no pending seek, return the current seek to pending status.
|
| if (!pending_seek_) {
|
| - pending_seek_time_ = seek_time_;
|
| + pending_seek_position_ = seek_position_;
|
| pending_seek_ = true;
|
| }
|
|
|
| // CancelPendingSeek() may be reentrant, so update state first and return
|
| // immediately.
|
| waiting_for_seek_ = false;
|
| - demuxer_->CancelPendingSeek(pending_seek_time_);
|
| + demuxer_->CancelPendingSeek(pending_seek_position_.time);
|
| return;
|
| }
|
|
|
| // Ordinary seeking.
|
| if (pending_seek_ && state_ == State::PLAYING) {
|
| - seek_time_ = pending_seek_time_;
|
| + seek_position_ = pending_seek_position_;
|
|
|
| // Tell |demuxer_| to expect our seek.
|
| DCHECK(!waiting_for_seek_);
|
| waiting_for_seek_ = true;
|
| - demuxer_->StartWaitingForSeek(seek_time_);
|
| + demuxer_->StartWaitingForSeek(seek_position_.time);
|
|
|
| pending_seek_ = false;
|
| state_ = State::SEEKING;
|
| - pipeline_->Seek(seek_time_,
|
| + pipeline_->Seek(seek_position_,
|
| base::Bind(&PipelineController::OnPipelineStatus,
|
| weak_factory_.GetWeakPtr(), State::PLAYING));
|
| return;
|
|
|