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

Unified Diff: media/base/pipeline.cc

Issue 224093011: Move DataSourceHost to BufferedDataSourceHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows release build. Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/pipeline.h ('k') | media/base/pipeline_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/pipeline.cc
diff --git a/media/base/pipeline.cc b/media/base/pipeline.cc
index f2b6ea742ff28696037fcb2d0758f3f75d84777d..94fa2b561aa3794cc6e40aee4a534663e45335cd 100644
--- a/media/base/pipeline.cc
+++ b/media/base/pipeline.cc
@@ -39,7 +39,6 @@ Pipeline::Pipeline(
media_log_(media_log),
running_(false),
did_loading_progress_(false),
- total_bytes_(0),
volume_(1.0f),
playback_rate_(0.0f),
clock_(new Clock(&default_tick_clock_)),
@@ -161,22 +160,7 @@ TimeDelta Pipeline::GetMediaTime() const {
Ranges<TimeDelta> Pipeline::GetBufferedTimeRanges() {
base::AutoLock auto_lock(lock_);
- Ranges<TimeDelta> time_ranges;
- for (size_t i = 0; i < buffered_time_ranges_.size(); ++i) {
- time_ranges.Add(buffered_time_ranges_.start(i),
- buffered_time_ranges_.end(i));
- }
- if (clock_->Duration() == TimeDelta() || total_bytes_ == 0)
- return time_ranges;
- for (size_t i = 0; i < buffered_byte_ranges_.size(); ++i) {
- TimeDelta start = TimeForByteOffset_Locked(buffered_byte_ranges_.start(i));
- TimeDelta end = TimeForByteOffset_Locked(buffered_byte_ranges_.end(i));
- // Cap approximated buffered time at the length of the video.
- end = std::min(end, clock_->Duration());
- time_ranges.Add(start, end);
- }
-
- return time_ranges;
+ return buffered_time_ranges_;
}
TimeDelta Pipeline::GetMediaDuration() const {
@@ -184,11 +168,6 @@ TimeDelta Pipeline::GetMediaDuration() const {
return clock_->Duration();
}
-int64 Pipeline::GetTotalBytes() const {
- base::AutoLock auto_lock(lock_);
- return total_bytes_;
-}
-
bool Pipeline::DidLoadingProgress() const {
base::AutoLock auto_lock(lock_);
bool ret = did_loading_progress_;
@@ -373,38 +352,6 @@ void Pipeline::SetDuration(TimeDelta duration) {
duration_change_cb_.Run();
}
-void Pipeline::SetTotalBytes(int64 total_bytes) {
- media_log_->AddEvent(
- media_log_->CreateStringEvent(
- MediaLogEvent::TOTAL_BYTES_SET, "total_bytes",
- base::Int64ToString(total_bytes)));
- int64 total_mbytes = total_bytes >> 20;
- if (total_mbytes > kint32max)
- total_mbytes = kint32max;
- UMA_HISTOGRAM_CUSTOM_COUNTS(
- "Media.TotalMBytes", static_cast<int32>(total_mbytes), 1, kint32max, 50);
-
- base::AutoLock auto_lock(lock_);
- total_bytes_ = total_bytes;
-}
-
-TimeDelta Pipeline::TimeForByteOffset_Locked(int64 byte_offset) const {
- lock_.AssertAcquired();
- // Use floating point to avoid potential overflow when using 64 bit integers.
- double time_offset_in_ms = clock_->Duration().InMilliseconds() *
- (static_cast<double>(byte_offset) / total_bytes_);
- TimeDelta time_offset(TimeDelta::FromMilliseconds(
- static_cast<int64>(time_offset_in_ms)));
- // Since the byte->time calculation is approximate, fudge the beginning &
- // ending areas to look better.
- TimeDelta epsilon = clock_->Duration() / 100;
- if (time_offset < epsilon)
- return TimeDelta();
- if (time_offset + epsilon > clock_->Duration())
- return clock_->Duration();
- return time_offset;
-}
-
void Pipeline::OnStateTransition(PipelineStatus status) {
// Force post to process state transitions after current execution frame.
task_runner_->PostTask(FROM_HERE, base::Bind(
@@ -683,12 +630,6 @@ void Pipeline::OnStopCompleted(PipelineStatus status) {
}
}
-void Pipeline::AddBufferedByteRange(int64 start, int64 end) {
- base::AutoLock auto_lock(lock_);
- buffered_byte_ranges_.Add(start, end);
- did_loading_progress_ = true;
-}
-
void Pipeline::AddBufferedTimeRange(base::TimeDelta start,
base::TimeDelta end) {
DCHECK(IsRunning());
« no previous file with comments | « media/base/pipeline.h ('k') | media/base/pipeline_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698