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

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

Issue 136523002: WebMediaPlayerAndroid - handling unseekable durations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dividing by 1000 to convert from millisecond to second Created 6 years, 11 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 | « no previous file | 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 af0d25b27bd433d216335118bc5fad3ad8d7f163..bd97df8d7f0f0a14b2e6373e24c4c05956e3dd92 100644
--- a/content/renderer/media/android/webmediaplayer_android.cc
+++ b/content/renderer/media/android/webmediaplayer_android.cc
@@ -461,9 +461,9 @@ double WebMediaPlayerAndroid::duration() const {
if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing)
return std::numeric_limits<double>::quiet_NaN();
- // TODO(wolenetz): Correctly handle durations that MediaSourcePlayer
- // considers unseekable, including kInfiniteDuration().
- // See http://crbug.com/248396
+ if (duration_ == media::kInfiniteDuration())
+ return std::numeric_limits<double>::infinity();
+
return duration_.InSecondsF();
}
@@ -502,8 +502,10 @@ double WebMediaPlayerAndroid::maxTimeSeekable() const {
if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata)
return 0.0;
- // TODO(hclam): If this stream is not seekable this should return 0.
- return duration();
+ if (duration() == std::numeric_limits<double>::infinity())
+ return 0.0;
+
+ return std::min(std::numeric_limits<int32>max() / 1000, duration());
acolwell GONE FROM CHROMIUM 2014/01/16 18:17:47 nit:s/1000/1000.0/ so that we get the full range a
amogh.bihani 2014/01/17 03:54:21 Done.
}
bool WebMediaPlayerAndroid::didLoadingProgress() const {
@@ -619,9 +621,6 @@ void WebMediaPlayerAndroid::OnMediaMetadataChanged(
// Update duration, if necessary, prior to ready state updates that may
// cause duration() query.
- // TODO(wolenetz): Correctly handle durations that MediaSourcePlayer
- // considers unseekable, including kInfiniteDuration().
- // See http://crbug.com/248396
if (!ignore_metadata_duration_change_ && duration_ != duration) {
duration_ = duration;
@@ -830,9 +829,6 @@ void WebMediaPlayerAndroid::OnDurationChanged(const base::TimeDelta& duration) {
// Cache the new duration value and trust it over any subsequent duration
// values received in OnMediaMetadataChanged().
- // TODO(wolenetz): Correctly handle durations that MediaSourcePlayer
- // considers unseekable, including kInfiniteDuration().
- // See http://crbug.com/248396
duration_ = duration;
ignore_metadata_duration_change_ = true;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698