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

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

Issue 2192001: Reporting a more accurate buffered time for the video tag (Closed)
Patch Set: Created 10 years, 7 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "media/base/limits.h" 9 #include "media/base/limits.h"
10 #include "media/base/media_format.h" 10 #include "media/base/media_format.h"
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 return static_cast<float>(pipeline_->GetCurrentTime().InSecondsF()); 433 return static_cast<float>(pipeline_->GetCurrentTime().InSecondsF());
434 } 434 }
435 435
436 int WebMediaPlayerImpl::dataRate() const { 436 int WebMediaPlayerImpl::dataRate() const {
437 DCHECK(MessageLoop::current() == main_loop_); 437 DCHECK(MessageLoop::current() == main_loop_);
438 438
439 // TODO(hclam): Add this method call if pipeline has it in the interface. 439 // TODO(hclam): Add this method call if pipeline has it in the interface.
440 return 0; 440 return 0;
441 } 441 }
442 442
443 // This will be deleted once the WebKit::WebMediaPlayer interface is updated.
443 const WebKit::WebTimeRanges& WebMediaPlayerImpl::buffered() const { 444 const WebKit::WebTimeRanges& WebMediaPlayerImpl::buffered() const {
444 DCHECK(MessageLoop::current() == main_loop_); 445 DCHECK(MessageLoop::current() == main_loop_);
445 446
446 return buffered_; 447 return buffered_;
447 } 448 }
448 449
450 const WebKit::WebTimeRanges& WebMediaPlayerImpl::buffered() {
451 DCHECK(MessageLoop::current() == main_loop_);
452
453 // Update buffered_ with the most recent buffered time.
454 buffered_[0].end = static_cast<float>(
455 pipeline_->GetBufferedTime().InSecondsF());
456
457 return buffered_;
458 }
459
449 float WebMediaPlayerImpl::maxTimeSeekable() const { 460 float WebMediaPlayerImpl::maxTimeSeekable() const {
450 DCHECK(MessageLoop::current() == main_loop_); 461 DCHECK(MessageLoop::current() == main_loop_);
451 462
452 // If we are performing streaming, we report that we cannot seek at all. 463 // If we are performing streaming, we report that we cannot seek at all.
453 // We are using this flag to indicate if the data source supports seeking 464 // We are using this flag to indicate if the data source supports seeking
454 // or not. We should be able to seek even if we are performing streaming. 465 // or not. We should be able to seek even if we are performing streaming.
455 // TODO(hclam): We need to update this when we have better caching. 466 // TODO(hclam): We need to update this when we have better caching.
456 if (pipeline_->IsStreaming()) 467 if (pipeline_->IsStreaming())
457 return 0.0f; 468 return 0.0f;
458 return static_cast<float>(pipeline_->GetMediaDuration().InSecondsF()); 469 return static_cast<float>(pipeline_->GetMediaDuration().InSecondsF());
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 } 707 }
697 } 708 }
698 709
699 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { 710 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() {
700 DCHECK(MessageLoop::current() == main_loop_); 711 DCHECK(MessageLoop::current() == main_loop_);
701 DCHECK(client_); 712 DCHECK(client_);
702 return client_; 713 return client_;
703 } 714 }
704 715
705 } // namespace webkit_glue 716 } // 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