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

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

Issue 1241923003: Work around unreliable metadata for HLS in WebMediaPlayerAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also check has_size_info_ Created 5 years, 5 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 d9a4414500f45e5a4ca020c1acc91f891b85a8a5..65fe21bf4f598dfa0a22360dd0334d65a52d074e 100644
--- a/content/renderer/media/android/webmediaplayer_android.cc
+++ b/content/renderer/media/android/webmediaplayer_android.cc
@@ -756,13 +756,18 @@ unsigned WebMediaPlayerAndroid::videoDecodedByteCount() const {
}
void WebMediaPlayerAndroid::OnMediaMetadataChanged(
- const base::TimeDelta& duration, int width, int height, bool success) {
+ base::TimeDelta duration, int width, int height, bool success) {
DCHECK(main_thread_checker_.CalledOnValidThread());
bool need_to_signal_duration_changed = false;
if (is_local_resource_)
UpdateNetworkState(WebMediaPlayer::NetworkStateLoaded);
+ // For HLS streams, the reported duration may be zero for infinite streams.
+ // See http://crbug.com/501213.
+ if (duration.is_zero() && IsHLSStream())
+ duration = media::kInfiniteDuration();
+
// Update duration, if necessary, prior to ready state updates that may
// cause duration() query.
if (!ignore_metadata_duration_change_ && duration_ != duration) {
@@ -854,6 +859,12 @@ void WebMediaPlayerAndroid::OnMediaError(int error_type) {
void WebMediaPlayerAndroid::OnVideoSizeChanged(int width, int height) {
DCHECK(main_thread_checker_.CalledOnValidThread());
+
+ // For HLS streams, a bogus empty size may be reported at first, followed by
+ // the actual size only once playback begins. See http://crbug.com/509972.
+ if (!has_size_info_ && width == 0 && height == 0 && IsHLSStream())
+ return;
+
has_size_info_ = true;
if (natural_size_.width == width && natural_size_.height == height)
return;
« 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