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

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: Rebase. Cleanup. Created 6 years, 2 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 | « content/renderer/media/android/webmediaplayer_android.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/webmediaplayer_impl.cc
diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc
index 6b5cadb08c5fec7dddd6bc8dc6ff6679c7108b60..16c5042363523d67dd216548db85a8a023453534 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"
@@ -487,21 +488,15 @@ blink::WebTimeRanges WebMediaPlayerImpl::buffered() const {
blink::WebTimeRanges WebMediaPlayerImpl::seekable() const {
DCHECK(main_task_runner_->BelongsToCurrentThread());
- // If we haven't even gotten to ReadyStateHaveMetadata yet then there
- // are no seekable ranges.
- 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.
+ // Media without duration are considered streaming and should not be seekable.
const double seekable_end = duration();
- if (!seekable_end)
+ if (!base::IsFinite(seekable_end))
return blink::WebTimeRanges();
- blink::WebTimeRange seekable_range(0.0, seekable_end);
+ // If we have a finite duration then use [0, duration] as the seekable range;
+ // unless it's a streaming source, in which case only allow a seek to zero.
+ blink::WebTimeRange seekable_range(
+ 0.0, data_source_ && data_source_->IsStreaming() ? 0.0 : seekable_end);
return blink::WebTimeRanges(&seekable_range, 1);
}
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698