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

Side by Side Diff: media/base/pipeline.cc

Issue 9269027: Revert 118546 because it caused PrerenderHTML5VideoNetwork to timeout on windows and linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « media/base/download_rate_monitor_unittest.cc ('k') | webkit/media/buffered_data_source.cc » ('j') | 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 "media/base/pipeline.h" 5 #include "media/base/pipeline.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 1013
1014 base::AutoLock auto_lock(lock_); 1014 base::AutoLock auto_lock(lock_);
1015 // We use audio stream to update the clock. So if there is such a stream, 1015 // We use audio stream to update the clock. So if there is such a stream,
1016 // we pause the clock until we receive a valid timestamp. 1016 // we pause the clock until we receive a valid timestamp.
1017 waiting_for_clock_update_ = true; 1017 waiting_for_clock_update_ = true;
1018 if (!has_audio_) 1018 if (!has_audio_)
1019 StartClockIfWaitingForTimeUpdate_Locked(); 1019 StartClockIfWaitingForTimeUpdate_Locked();
1020 1020
1021 // Start monitoring rate of downloading. 1021 // Start monitoring rate of downloading.
1022 int bitrate = 0; 1022 int bitrate = 0;
1023 if (demuxer_.get()) 1023 if (demuxer_.get()) {
1024 bitrate = demuxer_->GetBitrate(); 1024 bitrate = demuxer_->GetBitrate();
1025 local_source_ = demuxer_->IsLocalSource();
1026 streaming_ = !demuxer_->IsSeekable();
1027 }
1025 // Needs to be locked because most other calls to |download_rate_monitor_| 1028 // Needs to be locked because most other calls to |download_rate_monitor_|
1026 // occur on the renderer thread. 1029 // occur on the renderer thread.
1027 download_rate_monitor_.Start( 1030 download_rate_monitor_.Start(
1028 base::Bind(&Pipeline::OnCanPlayThrough, this), 1031 base::Bind(&Pipeline::OnCanPlayThrough, this),
1029 bitrate, streaming_, local_source_); 1032 bitrate, streaming_, local_source_);
1030 download_rate_monitor_.SetBufferedBytes(buffered_bytes_, base::Time::Now()); 1033 download_rate_monitor_.SetBufferedBytes(buffered_bytes_, base::Time::Now());
1031 1034
1032 if (IsPipelineStopPending()) { 1035 if (IsPipelineStopPending()) {
1033 // We had a pending stop request need to be honored right now. 1036 // We had a pending stop request need to be honored right now.
1034 TearDownPipeline(); 1037 TearDownPipeline();
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 SetError(status); 1132 SetError(status);
1130 return; 1133 return;
1131 } 1134 }
1132 1135
1133 if (!demuxer) { 1136 if (!demuxer) {
1134 SetError(PIPELINE_ERROR_REQUIRED_FILTER_MISSING); 1137 SetError(PIPELINE_ERROR_REQUIRED_FILTER_MISSING);
1135 return; 1138 return;
1136 } 1139 }
1137 1140
1138 demuxer_ = demuxer; 1141 demuxer_ = demuxer;
1139 // Set fields obtained from demuxer.
1140 local_source_ = demuxer_->IsLocalSource();
1141 streaming_ = !demuxer_->IsSeekable();
1142 demuxer_->set_host(this); 1142 demuxer_->set_host(this);
1143 1143
1144 { 1144 {
1145 base::AutoLock auto_lock(lock_); 1145 base::AutoLock auto_lock(lock_);
1146 // We do not want to start the clock running. We only want to set the base 1146 // We do not want to start the clock running. We only want to set the base
1147 // media time so our timestamp calculations will be correct. 1147 // media time so our timestamp calculations will be correct.
1148 clock_->SetTime(demuxer_->GetStartTime()); 1148 clock_->SetTime(demuxer_->GetStartTime());
1149 } 1149 }
1150 1150
1151 OnFilterInitialize(PIPELINE_OK); 1151 OnFilterInitialize(PIPELINE_OK);
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { 1413 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() {
1414 lock_.AssertAcquired(); 1414 lock_.AssertAcquired();
1415 if (!waiting_for_clock_update_) 1415 if (!waiting_for_clock_update_)
1416 return; 1416 return;
1417 1417
1418 waiting_for_clock_update_ = false; 1418 waiting_for_clock_update_ = false;
1419 clock_->Play(); 1419 clock_->Play();
1420 } 1420 }
1421 1421
1422 } // namespace media 1422 } // namespace media
OLDNEW
« no previous file with comments | « media/base/download_rate_monitor_unittest.cc ('k') | webkit/media/buffered_data_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698