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

Unified Diff: media/base/pipeline_impl.cc

Issue 8661002: Fire CanPlayThrough immediately for local and streaming media files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase ToT Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: media/base/pipeline_impl.cc
diff --git a/media/base/pipeline_impl.cc b/media/base/pipeline_impl.cc
index 386b064a96221aa8d344c5ad5e9dd74a7d9d92d1..d4c1b8eb841b4b4fd16257818f7977f7d0566644 100644
--- a/media/base/pipeline_impl.cc
+++ b/media/base/pipeline_impl.cc
@@ -251,7 +251,7 @@ base::TimeDelta PipelineImpl::GetBufferedTime() {
base::AutoLock auto_lock(lock_);
// If media is fully loaded, then return duration.
- if (loaded_ || total_bytes_ == buffered_bytes_) {
+ if (local_source_ || total_bytes_ == buffered_bytes_) {
max_buffered_time_ = duration_;
return duration_;
}
@@ -312,9 +312,9 @@ bool PipelineImpl::IsStreaming() const {
return streaming_;
}
-bool PipelineImpl::IsLoaded() const {
+bool PipelineImpl::IsLocalSource() const {
base::AutoLock auto_lock(lock_);
- return loaded_;
+ return local_source_;
}
PipelineStatistics PipelineImpl::GetStatistics() const {
@@ -358,7 +358,7 @@ void PipelineImpl::ResetState() {
buffered_time_ = kZero;
buffered_bytes_ = 0;
streaming_ = false;
- loaded_ = false;
+ local_source_ = false;
total_bytes_ = 0;
natural_size_.SetSize(0, 0);
volume_ = 1.0f;
@@ -547,16 +547,6 @@ void PipelineImpl::SetNaturalVideoSize(const gfx::Size& size) {
natural_size_ = size;
}
-void PipelineImpl::SetStreaming(bool streaming) {
- DCHECK(IsRunning());
- media_log_->AddEvent(
- media_log_->CreateBooleanEvent(
- MediaLogEvent::STREAMING_SET, "streaming", streaming));
-
- base::AutoLock auto_lock(lock_);
- streaming_ = streaming;
-}
-
void PipelineImpl::NotifyEnded() {
DCHECK(IsRunning());
message_loop_->PostTask(FROM_HERE,
@@ -564,17 +554,6 @@ void PipelineImpl::NotifyEnded() {
media_log_->AddEvent(media_log_->CreateEvent(MediaLogEvent::ENDED));
}
-void PipelineImpl::SetLoaded(bool loaded) {
- DCHECK(IsRunning());
- media_log_->AddEvent(
- media_log_->CreateBooleanEvent(
- MediaLogEvent::LOADED_SET, "loaded", loaded));
-
- base::AutoLock auto_lock(lock_);
- loaded_ = loaded;
- download_rate_monitor_.set_loaded(loaded_);
-}
-
void PipelineImpl::SetNetworkActivity(bool is_downloading_data) {
DCHECK(IsRunning());
@@ -1044,12 +1023,16 @@ void PipelineImpl::FilterStateTransitionTask() {
// Start monitoring rate of downloading.
int bitrate = 0;
- if (demuxer_.get())
+ if (demuxer_.get()) {
bitrate = demuxer_->GetBitrate();
+ local_source_ = demuxer_->IsLocalSource();
+ streaming_ = !demuxer_->IsSeekable();
+ }
// Needs to be locked because most other calls to |download_rate_monitor_|
// occur on the renderer thread.
download_rate_monitor_.Start(
- base::Bind(&PipelineImpl::OnCanPlayThrough, this), bitrate);
+ base::Bind(&PipelineImpl::OnCanPlayThrough, this),
+ bitrate, streaming_, local_source_);
download_rate_monitor_.SetBufferedBytes(buffered_bytes_, base::Time::Now());
if (IsPipelineStopPending()) {

Powered by Google App Engine
This is Rietveld 408576698