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

Side by Side Diff: media/blink/webmediaplayer_impl.cc

Issue 843863002: Revert current time clamp on ended; clamp paused time instead. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup. Created 5 years, 11 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
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/blink/webmediaplayer_impl.h" 5 #include "media/blink/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 284
285 void WebMediaPlayerImpl::pause() { 285 void WebMediaPlayerImpl::pause() {
286 DVLOG(1) << __FUNCTION__; 286 DVLOG(1) << __FUNCTION__;
287 DCHECK(main_task_runner_->BelongsToCurrentThread()); 287 DCHECK(main_task_runner_->BelongsToCurrentThread());
288 288
289 const bool was_already_paused = paused_ || playback_rate_ == 0; 289 const bool was_already_paused = paused_ || playback_rate_ == 0;
290 paused_ = true; 290 paused_ = true;
291 pipeline_.SetPlaybackRate(0.0f); 291 pipeline_.SetPlaybackRate(0.0f);
292 if (data_source_) 292 if (data_source_)
293 data_source_->MediaIsPaused(); 293 data_source_->MediaIsPaused();
294 paused_time_ = pipeline_.GetMediaTime(); 294 UpdatePausedTime();
295 295
296 media_log_->AddEvent(media_log_->CreateEvent(MediaLogEvent::PAUSE)); 296 media_log_->AddEvent(media_log_->CreateEvent(MediaLogEvent::PAUSE));
297 297
298 if (!was_already_paused && delegate_) 298 if (!was_already_paused && delegate_)
299 delegate_->DidPause(this); 299 delegate_->DidPause(this);
300 } 300 }
301 301
302 bool WebMediaPlayerImpl::supportsSave() const { 302 bool WebMediaPlayerImpl::supportsSave() const {
303 DCHECK(main_task_runner_->BelongsToCurrentThread()); 303 DCHECK(main_task_runner_->BelongsToCurrentThread());
304 return supports_save_; 304 return supports_save_;
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 seek(pending_seek_seconds_); 742 seek(pending_seek_seconds_);
743 return; 743 return;
744 } 744 }
745 745
746 if (status != PIPELINE_OK) { 746 if (status != PIPELINE_OK) {
747 OnPipelineError(status); 747 OnPipelineError(status);
748 return; 748 return;
749 } 749 }
750 750
751 // Update our paused time. 751 // Update our paused time.
752 if (paused_) 752 UpdatePausedTime();
753 paused_time_ = pipeline_.GetMediaTime();
754 753
755 should_notify_time_changed_ = time_changed; 754 should_notify_time_changed_ = time_changed;
756 } 755 }
757 756
758 void WebMediaPlayerImpl::OnPipelineEnded() { 757 void WebMediaPlayerImpl::OnPipelineEnded() {
759 DVLOG(1) << __FUNCTION__; 758 DVLOG(1) << __FUNCTION__;
760 DCHECK(main_task_runner_->BelongsToCurrentThread()); 759 DCHECK(main_task_runner_->BelongsToCurrentThread());
761 760
762 // Ignore state changes until we've completed all outstanding seeks. 761 // Ignore state changes until we've completed all outstanding seeks.
763 if (seeking_ || pending_seek_) 762 if (seeking_ || pending_seek_)
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 base::WaitableEvent event(false, false); 1022 base::WaitableEvent event(false, false);
1024 compositor_task_runner_->PostTask(FROM_HERE, 1023 compositor_task_runner_->PostTask(FROM_HERE,
1025 base::Bind(&GetCurrentFrameAndSignal, 1024 base::Bind(&GetCurrentFrameAndSignal,
1026 base::Unretained(compositor_), 1025 base::Unretained(compositor_),
1027 &video_frame, 1026 &video_frame,
1028 &event)); 1027 &event));
1029 event.Wait(); 1028 event.Wait();
1030 return video_frame; 1029 return video_frame;
1031 } 1030 }
1032 1031
1032 void WebMediaPlayerImpl::UpdatePausedTime() {
1033 DCHECK(main_task_runner_->BelongsToCurrentThread());
1034 if (paused_) {
xhwang 2015/01/08 22:44:50 I felt it more clear to keep the |paused_| check o
DaleCurtis 2015/01/08 23:16:41 Done.
1035 paused_time_ =
1036 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime();
xhwang 2015/01/08 22:44:50 Hmm, please remind me in what case can |ended_| be
DaleCurtis 2015/01/08 23:16:41 pause() is always called upon ended from HTMLMedia
xhwang 2015/01/08 23:26:19 Thanks for the info! Maybe add a comment to make t
DaleCurtis 2015/01/08 23:41:53 Done.
1037 }
1038 }
1039
1033 } // namespace media 1040 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698