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

Unified Diff: media/base/pipeline_impl.cc

Issue 165180: Merge 22087 - Missing buffered attribute for <video>/<audio>... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 years, 4 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/mock_filters.h ('k') | media/base/pipeline_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/pipeline_impl.cc
===================================================================
--- media/base/pipeline_impl.cc (revision 22821)
+++ media/base/pipeline_impl.cc (working copy)
@@ -211,7 +211,22 @@
base::TimeDelta PipelineImpl::GetBufferedTime() const {
AutoLock auto_lock(lock_);
- return buffered_time_;
+
+ // If buffered time was set, we report that value directly.
+ if (buffered_time_.ToInternalValue() > 0)
+ return buffered_time_;
+
+ // If buffered time was not set, we use duration and buffered bytes to
+ // estimate the buffered time.
+ // TODO(hclam): The estimation is based on linear interpolation which is
+ // not accurate enough. We should find a better way to estimate the value.
+ if (total_bytes_ == 0)
+ return base::TimeDelta();
+
+ double ratio = static_cast<double>(buffered_bytes_);
+ ratio /= total_bytes_;
+ return base::TimeDelta::FromMilliseconds(
+ static_cast<int64>(duration_.InMilliseconds() * ratio));
}
base::TimeDelta PipelineImpl::GetDuration() const {
Property changes on: media\base\pipeline_impl.cc
___________________________________________________________________
Modified: svn:mergeinfo
Merged /trunk/src/media/base/pipeline_impl.cc:r22087
« no previous file with comments | « media/base/mock_filters.h ('k') | media/base/pipeline_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698