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

Unified Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 580673002: Revert "If duration of media source is unknown then return NaN." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/android/webmediaplayer_android.cc
diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc
index 27e2c1d8e698bd11d66049ff033363b72e5f3011..47da91c5ec22cdae047748f41701d2d2452411af 100644
--- a/content/renderer/media/android/webmediaplayer_android.cc
+++ b/content/renderer/media/android/webmediaplayer_android.cc
@@ -141,7 +141,6 @@ WebMediaPlayerAndroid::WebMediaPlayerAndroid(
RenderThreadImpl::current()->compositor_message_loop_proxy()),
stream_texture_factory_(factory),
needs_external_surface_(false),
- has_valid_metadata_(false),
video_frame_provider_client_(NULL),
pending_playback_(false),
player_type_(MEDIA_PLAYER_TYPE_URL),
@@ -448,8 +447,7 @@ bool WebMediaPlayerAndroid::seeking() const {
double WebMediaPlayerAndroid::duration() const {
DCHECK(main_thread_checker_.CalledOnValidThread());
// HTML5 spec requires duration to be NaN if readyState is HAVE_NOTHING
- if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing ||
- !has_valid_metadata_)
+ if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing)
return std::numeric_limits<double>::quiet_NaN();
if (duration_ == media::kInfiniteDuration())
@@ -505,8 +503,7 @@ WebTimeRanges WebMediaPlayerAndroid::buffered() const {
double WebMediaPlayerAndroid::maxTimeSeekable() const {
// If we haven't even gotten to ReadyStateHaveMetadata yet then just
// return 0 so that the seekable range is empty.
- if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata ||
- !has_valid_metadata_)
+ if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata)
return 0.0;
return duration();
@@ -747,10 +744,6 @@ void WebMediaPlayerAndroid::OnMediaMetadataChanged(
}
}
- // UpdateReadyState(WebMediaPlayer::ReadyStateHaveMetadata) will trigger a
- // call to duration(), which checks |has_valid_metadata_|. so
- // |has_valid_metadata_| has to be updated before calling UpdateReadyState().
- has_valid_metadata_ = success;
if (ready_state_ != WebMediaPlayer::ReadyStateHaveEnoughData) {
UpdateReadyState(WebMediaPlayer::ReadyStateHaveMetadata);
UpdateReadyState(WebMediaPlayer::ReadyStateHaveEnoughData);
@@ -784,7 +777,7 @@ void WebMediaPlayerAndroid::OnPlaybackComplete() {
}
void WebMediaPlayerAndroid::OnBufferingUpdate(int percentage) {
- buffered_[0].end = has_valid_metadata_ ? duration() * percentage / 100 : 0;
+ buffered_[0].end = duration() * percentage / 100;
did_loading_progress_ = true;
}
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698