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

Side by Side Diff: webkit/glue/webmediaplayer_impl.cc

Issue 334002: Use a saved copy of the time when pausing media elements. (Closed)
Patch Set: Created 11 years, 2 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 | « webkit/glue/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 (c) 2008-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008-2009 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 "webkit/glue/webmediaplayer_impl.h" 5 #include "webkit/glue/webmediaplayer_impl.h"
6 6
7 #include "media/base/media_format.h" 7 #include "media/base/media_format.h"
8 #include "media/filters/ffmpeg_audio_decoder.h" 8 #include "media/filters/ffmpeg_audio_decoder.h"
9 #include "media/filters/ffmpeg_demuxer.h" 9 #include "media/filters/ffmpeg_demuxer.h"
10 #include "media/filters/ffmpeg_video_decoder.h" 10 #include "media/filters/ffmpeg_video_decoder.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 paused_ = false; 254 paused_ = false;
255 pipeline_->SetPlaybackRate(playback_rate_); 255 pipeline_->SetPlaybackRate(playback_rate_);
256 } 256 }
257 257
258 void WebMediaPlayerImpl::pause() { 258 void WebMediaPlayerImpl::pause() {
259 DCHECK(MessageLoop::current() == main_loop_); 259 DCHECK(MessageLoop::current() == main_loop_);
260 260
261 paused_ = true; 261 paused_ = true;
262 pipeline_->SetPlaybackRate(0.0f); 262 pipeline_->SetPlaybackRate(0.0f);
263 paused_time_ = pipeline_->GetCurrentTime();
263 } 264 }
264 265
265 bool WebMediaPlayerImpl::supportsFullscreen() const { 266 bool WebMediaPlayerImpl::supportsFullscreen() const {
266 DCHECK(MessageLoop::current() == main_loop_); 267 DCHECK(MessageLoop::current() == main_loop_);
267 return true; 268 return true;
268 } 269 }
269 270
270 bool WebMediaPlayerImpl::supportsSave() const { 271 bool WebMediaPlayerImpl::supportsSave() const {
271 DCHECK(MessageLoop::current() == main_loop_); 272 DCHECK(MessageLoop::current() == main_loop_);
272 return true; 273 return true;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 392
392 float WebMediaPlayerImpl::duration() const { 393 float WebMediaPlayerImpl::duration() const {
393 DCHECK(MessageLoop::current() == main_loop_); 394 DCHECK(MessageLoop::current() == main_loop_);
394 395
395 return static_cast<float>(pipeline_->GetDuration().InSecondsF()); 396 return static_cast<float>(pipeline_->GetDuration().InSecondsF());
396 } 397 }
397 398
398 float WebMediaPlayerImpl::currentTime() const { 399 float WebMediaPlayerImpl::currentTime() const {
399 DCHECK(MessageLoop::current() == main_loop_); 400 DCHECK(MessageLoop::current() == main_loop_);
400 401
402 if (paused_) {
403 return static_cast<float>(paused_time_.InSecondsF());
404 }
401 return static_cast<float>(pipeline_->GetCurrentTime().InSecondsF()); 405 return static_cast<float>(pipeline_->GetCurrentTime().InSecondsF());
402 } 406 }
403 407
404 int WebMediaPlayerImpl::dataRate() const { 408 int WebMediaPlayerImpl::dataRate() const {
405 DCHECK(MessageLoop::current() == main_loop_); 409 DCHECK(MessageLoop::current() == main_loop_);
406 410
407 // TODO(hclam): Add this method call if pipeline has it in the interface. 411 // TODO(hclam): Add this method call if pipeline has it in the interface.
408 return 0; 412 return 0;
409 } 413 }
410 414
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 } 647 }
644 } 648 }
645 649
646 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { 650 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() {
647 DCHECK(MessageLoop::current() == main_loop_); 651 DCHECK(MessageLoop::current() == main_loop_);
648 DCHECK(client_); 652 DCHECK(client_);
649 return client_; 653 return client_;
650 } 654 }
651 655
652 } // namespace webkit_glue 656 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/glue/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698