Commit 56359cbf authored by dalecurtis's avatar dalecurtis Committed by Commit bot

Revert unintended prevention of seeks on infinite duration media.

Preserves the looping behavior for 200-type sources, while reverting
the disabling of seeks for "non-streaming" type sources which report
an infinite duration. This reverts the unintended behavior change
from http://crrev.com/298565

BUG=412562,427412
TEST=live player works again. LayoutTest forthcoming.

Review URL: https://codereview.chromium.org/684473002

Cr-Commit-Position: refs/heads/master@{#301495}
parent d68b1649
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "base/callback_helpers.h" #include "base/callback_helpers.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/float_util.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/metrics/histogram.h" #include "base/metrics/histogram.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
...@@ -525,13 +524,13 @@ blink::WebTimeRanges WebMediaPlayerAndroid::buffered() const { ...@@ -525,13 +524,13 @@ blink::WebTimeRanges WebMediaPlayerAndroid::buffered() const {
} }
blink::WebTimeRanges WebMediaPlayerAndroid::seekable() const { blink::WebTimeRanges WebMediaPlayerAndroid::seekable() const {
// Media without duration are considered streaming and should not be seekable. if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata)
const double seekable_end = duration();
if (!base::IsFinite(seekable_end))
return blink::WebTimeRanges(); return blink::WebTimeRanges();
// If we have a finite duration then use [0, duration] as the seekable range. // TODO(dalecurtis): Technically this allows seeking on media which return an
blink::WebTimeRange seekable_range(0.0, seekable_end); // infinite duration. While not expected, disabling this breaks semi-live
// players, http://crbug.com/427412.
const blink::WebTimeRange seekable_range(0.0, duration());
return blink::WebTimeRanges(&seekable_range, 1); return blink::WebTimeRanges(&seekable_range, 1);
} }
......
...@@ -495,15 +495,21 @@ blink::WebTimeRanges WebMediaPlayerImpl::buffered() const { ...@@ -495,15 +495,21 @@ blink::WebTimeRanges WebMediaPlayerImpl::buffered() const {
blink::WebTimeRanges WebMediaPlayerImpl::seekable() const { blink::WebTimeRanges WebMediaPlayerImpl::seekable() const {
DCHECK(main_task_runner_->BelongsToCurrentThread()); DCHECK(main_task_runner_->BelongsToCurrentThread());
// Media without duration are considered streaming and should not be seekable. if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata)
const double seekable_end = duration();
if (!base::IsFinite(seekable_end))
return blink::WebTimeRanges(); return blink::WebTimeRanges();
// If we have a finite duration then use [0, duration] as the seekable range; const double seekable_end = duration();
// unless it's a streaming source, in which case only allow a seek to zero.
blink::WebTimeRange seekable_range( // Allow a special exception for seeks to zero for streaming sources with a
0.0, data_source_ && data_source_->IsStreaming() ? 0.0 : seekable_end); // finite duration; this allows looping to work.
const bool allow_seek_to_zero = data_source_ && data_source_->IsStreaming() &&
base::IsFinite(seekable_end);
// TODO(dalecurtis): Technically this allows seeking on media which return an
// infinite duration so long as DataSource::IsStreaming() is false. While not
// expected, disabling this breaks semi-live players, http://crbug.com/427412.
const blink::WebTimeRange seekable_range(
0.0, allow_seek_to_zero ? 0.0 : seekable_end);
return blink::WebTimeRanges(&seekable_range, 1); return blink::WebTimeRanges(&seekable_range, 1);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment