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

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: 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..76b0fc4a06bedd6792d81ee6b5afe962f2cbbb3a 100644
--- a/content/renderer/media/android/webmediaplayer_android.cc
+++ b/content/renderer/media/android/webmediaplayer_android.cc
@@ -386,6 +386,11 @@ void WebMediaPlayerAndroid::seek(double seconds) {
return;
}
+ if (new_seek_time >=
acolwell GONE FROM CHROMIUM 2014/01/13 16:32:07 This should not be needed if maxTimeSeekable() nev
amogh.bihani 2014/01/14 08:03:09 Done.
+ base::TimeDelta::FromMilliseconds(std::numeric_limits<int32>max())) {
+ return;
+ }
+
seeking_ = true;
seek_time_ = new_seek_time;
@@ -502,7 +507,6 @@ double WebMediaPlayerAndroid::maxTimeSeekable() const {
if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata)
return 0.0;
- // TODO(hclam): If this stream is not seekable this should return 0.
amogh.bihani 2014/01/13 11:43:14 This is handled in this patch automatically
return duration();
acolwell GONE FROM CHROMIUM 2014/01/13 16:32:07 This does not see right to me. I believe this shou
amogh.bihani 2014/01/14 08:03:09 Done.
}
@@ -619,9 +623,14 @@ 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().
amogh.bihani 2014/01/13 11:43:14 kInfiniteDuration is 2^63, so this is automaticall
- // See http://crbug.com/248396
+
+ // MediaSourcePlayer assumes duration more than 2^31 as unseekable
+ // because java player uses 32-bit integer for time at millisecond resolution
+ if (duration >=
acolwell GONE FROM CHROMIUM 2014/01/13 16:32:07 This does not seem right. The clip duration and th
amogh.bihani 2014/01/14 08:03:09 Done.
+ base::TimeDelta::FromMilliseconds(std::numeric_limits<int32>max())) {
+ return;
+ }
+
if (!ignore_metadata_duration_change_ && duration_ != duration) {
duration_ = duration;
@@ -828,11 +837,15 @@ void WebMediaPlayerAndroid::OnDurationChanged(const base::TimeDelta& duration) {
// Only MSE |player_type_| registers this callback.
DCHECK_EQ(player_type_, MEDIA_PLAYER_TYPE_MEDIA_SOURCE);
+ // MediaSourcePlayer assumes duration more than 2^31 as unseekable
+ // because java player uses 32-bit integer for time at millisecond resolution
+ if (duration >=
+ base::TimeDelta::FromMilliseconds(std::numeric_limits<int32>max())) {
+ return;
+ }
+
// 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