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

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

Issue 10796074: Move VideoRenderer out of Filter heirarchy. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: GetMediaTime Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « webkit/media/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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/media/webmediaplayer_impl.h" 5 #include "webkit/media/webmediaplayer_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 286
287 if (delegate_) 287 if (delegate_)
288 delegate_->DidPlay(this); 288 delegate_->DidPlay(this);
289 } 289 }
290 290
291 void WebMediaPlayerImpl::pause() { 291 void WebMediaPlayerImpl::pause() {
292 DCHECK_EQ(main_loop_, MessageLoop::current()); 292 DCHECK_EQ(main_loop_, MessageLoop::current());
293 293
294 paused_ = true; 294 paused_ = true;
295 pipeline_->SetPlaybackRate(0.0f); 295 pipeline_->SetPlaybackRate(0.0f);
296 paused_time_ = pipeline_->GetCurrentTime(); 296 paused_time_ = pipeline_->GetMediaTime();
297 297
298 media_log_->AddEvent(media_log_->CreateEvent(media::MediaLogEvent::PAUSE)); 298 media_log_->AddEvent(media_log_->CreateEvent(media::MediaLogEvent::PAUSE));
299 299
300 if (delegate_) 300 if (delegate_)
301 delegate_->DidPause(this); 301 delegate_->DidPause(this);
302 } 302 }
303 303
304 bool WebMediaPlayerImpl::supportsFullscreen() const { 304 bool WebMediaPlayerImpl::supportsFullscreen() const {
305 DCHECK_EQ(main_loop_, MessageLoop::current()); 305 DCHECK_EQ(main_loop_, MessageLoop::current());
306 return true; 306 return true;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 if (duration == media::kInfiniteDuration()) 451 if (duration == media::kInfiniteDuration())
452 return std::numeric_limits<float>::infinity(); 452 return std::numeric_limits<float>::infinity();
453 453
454 return static_cast<float>(duration.InSecondsF()); 454 return static_cast<float>(duration.InSecondsF());
455 } 455 }
456 456
457 float WebMediaPlayerImpl::currentTime() const { 457 float WebMediaPlayerImpl::currentTime() const {
458 DCHECK_EQ(main_loop_, MessageLoop::current()); 458 DCHECK_EQ(main_loop_, MessageLoop::current());
459 if (paused_) 459 if (paused_)
460 return static_cast<float>(paused_time_.InSecondsF()); 460 return static_cast<float>(paused_time_.InSecondsF());
461 return static_cast<float>(pipeline_->GetCurrentTime().InSecondsF()); 461 return static_cast<float>(pipeline_->GetMediaTime().InSecondsF());
462 } 462 }
463 463
464 int WebMediaPlayerImpl::dataRate() const { 464 int WebMediaPlayerImpl::dataRate() const {
465 DCHECK_EQ(main_loop_, MessageLoop::current()); 465 DCHECK_EQ(main_loop_, MessageLoop::current());
466 466
467 // TODO(hclam): Add this method call if pipeline has it in the interface. 467 // TODO(hclam): Add this method call if pipeline has it in the interface.
468 return 0; 468 return 0;
469 } 469 }
470 470
471 WebMediaPlayer::NetworkState WebMediaPlayerImpl::networkState() const { 471 WebMediaPlayer::NetworkState WebMediaPlayerImpl::networkState() const {
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 return; 811 return;
812 } 812 }
813 813
814 if (status != media::PIPELINE_OK) { 814 if (status != media::PIPELINE_OK) {
815 OnPipelineError(status); 815 OnPipelineError(status);
816 return; 816 return;
817 } 817 }
818 818
819 // Update our paused time. 819 // Update our paused time.
820 if (paused_) 820 if (paused_)
821 paused_time_ = pipeline_->GetCurrentTime(); 821 paused_time_ = pipeline_->GetMediaTime();
822 822
823 GetClient()->timeChanged(); 823 GetClient()->timeChanged();
824 } 824 }
825 825
826 void WebMediaPlayerImpl::OnPipelineEnded(PipelineStatus status) { 826 void WebMediaPlayerImpl::OnPipelineEnded(PipelineStatus status) {
827 DCHECK_EQ(main_loop_, MessageLoop::current()); 827 DCHECK_EQ(main_loop_, MessageLoop::current());
828 if (status != media::PIPELINE_OK) { 828 if (status != media::PIPELINE_OK) {
829 OnPipelineError(status); 829 OnPipelineError(status);
830 return; 830 return;
831 } 831 }
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 return audio_source_provider_; 1049 return audio_source_provider_;
1050 } 1050 }
1051 1051
1052 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { 1052 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() {
1053 DCHECK_EQ(main_loop_, MessageLoop::current()); 1053 DCHECK_EQ(main_loop_, MessageLoop::current());
1054 incremented_externally_allocated_memory_ = true; 1054 incremented_externally_allocated_memory_ = true;
1055 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); 1055 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory);
1056 } 1056 }
1057 1057
1058 } // namespace webkit_media 1058 } // namespace webkit_media
OLDNEW
« no previous file with comments | « webkit/media/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698