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

Unified Diff: media/blink/webmediaplayer_impl.cc

Issue 621573002: Expose a seekable range at 0 for streaming sources with duration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@io
Patch Set: Created 6 years, 3 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
Index: media/blink/webmediaplayer_impl.cc
diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc
index cd80f3ab4a568cb32eb59f4aedf8b0bdb818135d..68fab8b311e55ca2cfa925d6c1df188c635a9e0b 100644
--- a/media/blink/webmediaplayer_impl.cc
+++ b/media/blink/webmediaplayer_impl.cc
@@ -15,6 +15,7 @@
#include "base/debug/alias.h"
#include "base/debug/crash_logging.h"
#include "base/debug/trace_event.h"
+#include "base/float_util.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/metrics/histogram.h"
#include "base/single_thread_task_runner.h"
@@ -492,14 +493,14 @@ blink::WebTimeRanges WebMediaPlayerImpl::seekable() const {
if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata)
return blink::WebTimeRanges();
- // We don't support seeking in streaming media.
- if (data_source_ && data_source_->IsStreaming())
- return blink::WebTimeRanges();
-
- // If we have a duration then use [0, duration] as the seekable range.
- const double seekable_end = duration();
- if (!seekable_end)
- return blink::WebTimeRanges();
+ // We don't support seeking in streaming media except for a seek to zero when
+ // the source has a known duration.
+ double seekable_end = duration();
+ if (data_source_ && data_source_->IsStreaming()) {
philipj_slow 2014/10/01 09:37:50 Can you DCHECK(base::IsFinite(seekable_end) && see
DaleCurtis 2014/10/06 23:55:42 I've reworked this to look more like the android c
+ if (!base::IsFinite(seekable_end))
+ return blink::WebTimeRanges();
+ seekable_end = 0.0;
+ }
blink::WebTimeRange seekable_range(0.0, seekable_end);
return blink::WebTimeRanges(&seekable_range, 1);

Powered by Google App Engine
This is Rietveld 408576698