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..550fac530fbbe694a18f9e6ca7bd2b2e58bf70a5 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 0 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 (width == 0 && height == 0 && IsHLSStream()) |
qinmin
2015/07/16 03:20:07
do we need to check whether natural_size_ is non e
philipj_slow
2015/07/16 08:16:40
I also wasn't sure about this. I think it's pretty
|
+ return; |
+ |
has_size_info_ = true; |
if (natural_size_.width == width && natural_size_.height == height) |
return; |