summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/renderer/media/android/media_source_delegate.cc4
-rw-r--r--content/renderer/media/android/media_source_delegate.h1
-rw-r--r--content/renderer/media/android/webmediaplayer_android.cc6
-rw-r--r--content/renderer/media/android/webmediaplayer_android.h1
-rw-r--r--content/renderer/media/buffered_data_source_host_impl.cc2
-rw-r--r--content/renderer/media/buffered_data_source_host_impl.h3
-rw-r--r--content/renderer/media/webmediaplayer_impl.cc9
-rw-r--r--content/renderer/media/webmediaplayer_impl.h1
-rw-r--r--content/renderer/media/webmediaplayer_ms.cc5
-rw-r--r--content/renderer/media/webmediaplayer_ms.h1
10 files changed, 31 insertions, 2 deletions
diff --git a/content/renderer/media/android/media_source_delegate.cc b/content/renderer/media/android/media_source_delegate.cc
index 6b6523c..bd786b0 100644
--- a/content/renderer/media/android/media_source_delegate.cc
+++ b/content/renderer/media/android/media_source_delegate.cc
@@ -190,6 +190,10 @@ const blink::WebTimeRanges& MediaSourceDelegate::Buffered() {
return buffered_web_time_ranges_;
}
+blink::WebTimeRanges MediaSourceDelegate::Buffered() const {
+ return ConvertToWebTimeRanges(buffered_time_ranges_);
+}
+
size_t MediaSourceDelegate::DecodedFrameCount() const {
return statistics_.video_frames_decoded;
}
diff --git a/content/renderer/media/android/media_source_delegate.h b/content/renderer/media/android/media_source_delegate.h
index 4480a45..75de676 100644
--- a/content/renderer/media/android/media_source_delegate.h
+++ b/content/renderer/media/android/media_source_delegate.h
@@ -68,6 +68,7 @@ class MediaSourceDelegate : public media::DemuxerHost {
const DurationChangeCB& duration_change_cb);
const blink::WebTimeRanges& Buffered();
+ blink::WebTimeRanges Buffered() const;
size_t DecodedFrameCount() const;
size_t DroppedFrameCount() const;
size_t AudioDecodedByteCount() const;
diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc
index 3fe6c2e..fbee409 100644
--- a/content/renderer/media/android/webmediaplayer_android.cc
+++ b/content/renderer/media/android/webmediaplayer_android.cc
@@ -440,6 +440,12 @@ const WebTimeRanges& WebMediaPlayerAndroid::buffered() {
return buffered_;
}
+WebTimeRanges WebMediaPlayerAndroid::buffered() const {
+ if (media_source_delegate_)
+ return media_source_delegate_->Buffered();
+ return buffered_;
+}
+
double WebMediaPlayerAndroid::maxTimeSeekable() const {
// If we haven't even gotten to ReadyStateHaveMetadata yet then just
// return 0 so that the seekable range is empty.
diff --git a/content/renderer/media/android/webmediaplayer_android.h b/content/renderer/media/android/webmediaplayer_android.h
index 46142df..587e54c 100644
--- a/content/renderer/media/android/webmediaplayer_android.h
+++ b/content/renderer/media/android/webmediaplayer_android.h
@@ -99,6 +99,7 @@ class WebMediaPlayerAndroid : public blink::WebMediaPlayer,
virtual void setRate(double rate);
virtual void setVolume(double volume);
virtual const blink::WebTimeRanges& buffered();
+ virtual blink::WebTimeRanges buffered() const;
virtual double maxTimeSeekable() const;
// Poster image, as defined in the <video> element.
diff --git a/content/renderer/media/buffered_data_source_host_impl.cc b/content/renderer/media/buffered_data_source_host_impl.cc
index 03311db..45c97e6 100644
--- a/content/renderer/media/buffered_data_source_host_impl.cc
+++ b/content/renderer/media/buffered_data_source_host_impl.cc
@@ -35,7 +35,7 @@ static base::TimeDelta TimeForByteOffset(
void BufferedDataSourceHostImpl::AddBufferedTimeRanges(
media::Ranges<base::TimeDelta>* buffered_time_ranges,
- base::TimeDelta media_duration) {
+ base::TimeDelta media_duration) const {
if (total_bytes_ && buffered_byte_ranges_.size()) {
for (size_t i = 0; i < buffered_byte_ranges_.size(); ++i) {
int64 start = buffered_byte_ranges_.start(i);
diff --git a/content/renderer/media/buffered_data_source_host_impl.h b/content/renderer/media/buffered_data_source_host_impl.h
index 301b08e..d04d467 100644
--- a/content/renderer/media/buffered_data_source_host_impl.h
+++ b/content/renderer/media/buffered_data_source_host_impl.h
@@ -25,9 +25,10 @@ class CONTENT_EXPORT BufferedDataSourceHostImpl
virtual void AddBufferedByteRange(int64 start, int64 end) OVERRIDE;
// Translate the byte ranges to time ranges and append them to the list.
+ // TODO(sandersd): This is a confusing name, find something better.
void AddBufferedTimeRanges(
media::Ranges<base::TimeDelta>* buffered_time_ranges,
- base::TimeDelta media_duration);
+ base::TimeDelta media_duration) const;
bool DidLoadingProgress();
diff --git a/content/renderer/media/webmediaplayer_impl.cc b/content/renderer/media/webmediaplayer_impl.cc
index a57c67e..12509dc 100644
--- a/content/renderer/media/webmediaplayer_impl.cc
+++ b/content/renderer/media/webmediaplayer_impl.cc
@@ -523,6 +523,15 @@ const blink::WebTimeRanges& WebMediaPlayerImpl::buffered() {
return buffered_web_time_ranges_;
}
+blink::WebTimeRanges WebMediaPlayerImpl::buffered() const {
+ DCHECK(main_loop_->BelongsToCurrentThread());
+ media::Ranges<base::TimeDelta> buffered_time_ranges =
+ pipeline_.GetBufferedTimeRanges();
+ buffered_data_source_host_.AddBufferedTimeRanges(
+ &buffered_time_ranges, pipeline_.GetMediaDuration());
+ return ConvertToWebTimeRanges(buffered_time_ranges);
+}
+
double WebMediaPlayerImpl::maxTimeSeekable() const {
DCHECK(main_loop_->BelongsToCurrentThread());
diff --git a/content/renderer/media/webmediaplayer_impl.h b/content/renderer/media/webmediaplayer_impl.h
index 5a9092d..a58613e 100644
--- a/content/renderer/media/webmediaplayer_impl.h
+++ b/content/renderer/media/webmediaplayer_impl.h
@@ -88,6 +88,7 @@ class WebMediaPlayerImpl
virtual void setVolume(double volume);
virtual void setPreload(blink::WebMediaPlayer::Preload preload);
virtual const blink::WebTimeRanges& buffered();
+ virtual blink::WebTimeRanges buffered() const;
virtual double maxTimeSeekable() const;
// Methods for painting.
diff --git a/content/renderer/media/webmediaplayer_ms.cc b/content/renderer/media/webmediaplayer_ms.cc
index c46c107..64d2f3a 100644
--- a/content/renderer/media/webmediaplayer_ms.cc
+++ b/content/renderer/media/webmediaplayer_ms.cc
@@ -306,6 +306,11 @@ const blink::WebTimeRanges& WebMediaPlayerMS::buffered() {
return buffered_;
}
+blink::WebTimeRanges WebMediaPlayerMS::buffered() const {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ return buffered_;
+}
+
double WebMediaPlayerMS::maxTimeSeekable() const {
DCHECK(thread_checker_.CalledOnValidThread());
return 0.0;
diff --git a/content/renderer/media/webmediaplayer_ms.h b/content/renderer/media/webmediaplayer_ms.h
index 7fbf625..4c1cdf2 100644
--- a/content/renderer/media/webmediaplayer_ms.h
+++ b/content/renderer/media/webmediaplayer_ms.h
@@ -76,6 +76,7 @@ class WebMediaPlayerMS
virtual void setVolume(double volume);
virtual void setPreload(blink::WebMediaPlayer::Preload preload);
virtual const blink::WebTimeRanges& buffered();
+ virtual blink::WebTimeRanges buffered() const;
virtual double maxTimeSeekable() const;
// Methods for painting.