Chromium Code Reviews| Index: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
| diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
| index bff62e7bfdb250473405fbd5bc2215a8d99b8bf2..a7a7914e5b1edadc0b15d364035c0f0d809dcafe 100644 |
| --- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
| +++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
| @@ -1031,21 +1031,17 @@ void HTMLMediaElement::loadResource(const WebMediaPlayerSource& source, const Co |
| bool attemptLoad = true; |
| + // MediaSource is a blob URL that is not a media stream. |
|
foolip
2016/06/28 15:28:51
This comment doesn't seem quite accurate, if it's
whywhat
2016/06/28 16:13:50
Done. I inlined |isObject| since it made the expre
whywhat
2016/06/28 18:06:34
So loadType() doesn't catch corrupt or revoked med
foolip
2016/06/29 09:30:27
Actually I think that it's the test that should ch
|
| bool isStreamOrBlobUrl = source.isMediaStream() || url.protocolIs(mediaSourceBlobProtocol); |
|
foolip
2016/06/28 15:28:51
While you're here, may I suggest replacing mediaSo
whywhat
2016/06/28 16:13:50
Done.
|
| - if (isStreamOrBlobUrl) { |
| - bool isMediaStream = source.isMediaStream() || (source.isURL() && isMediaStreamURL(url.getString())); |
| - if (isMediaStream) { |
| - m_autoplayHelper->unlockUserGesture(GesturelessPlaybackEnabledByStream); |
| - } else { |
| - m_mediaSource = HTMLMediaSource::lookup(url.getString()); |
| - |
| - if (m_mediaSource) { |
| - if (!m_mediaSource->attachToElement(this)) { |
| - // Forget our reference to the MediaSource, so we leave it alone |
| - // while processing remainder of load failure. |
| - m_mediaSource = nullptr; |
| - attemptLoad = false; |
| - } |
| + if (isStreamOrBlobUrl && !source.isMediaStream() && (!source.isURL() || !isMediaStreamURL(url.getString()))) { |
|
sof
2016/06/27 19:28:48
Can (at least) be reduced to
if (url.protocolIs(m
whywhat
2016/06/28 16:13:50
I believe now it's even simpler.
|
| + m_mediaSource = HTMLMediaSource::lookup(url.getString()); |
| + |
| + if (m_mediaSource) { |
| + if (!m_mediaSource->attachToElement(this)) { |
|
sof
2016/06/27 19:28:48
nit: the two ifs could be fused.
whywhat
2016/06/28 16:13:50
Ditto.
whywhat
2016/06/28 18:06:34
Actually fused these diffs :)
|
| + // Forget our reference to the MediaSource, so we leave it alone |
| + // while processing remainder of load failure. |
| + m_mediaSource = nullptr; |
| + attemptLoad = false; |
| } |
| } |
| } |
| @@ -1223,7 +1219,7 @@ WebMediaPlayer::LoadType HTMLMediaElement::loadType() const |
| if (m_mediaSource) |
| return WebMediaPlayer::LoadTypeMediaSource; |
| - if (m_srcObject || isMediaStreamURL(m_currentSrc.getString())) |
| + if (m_srcObject || (!m_currentSrc.isNull() && isMediaStreamURL(m_currentSrc.getString()))) |
|
foolip
2016/06/28 15:28:51
Did this assert somewhere before?
whywhat
2016/06/28 16:13:50
isMediaStreamURL is using a hash map that eventual
|
| return WebMediaPlayer::LoadTypeMediaStream; |
| return WebMediaPlayer::LoadTypeURL; |
| @@ -3725,6 +3721,9 @@ bool HTMLMediaElement::isGestureNeededForPlayback() const |
| if (!m_lockedPendingUserGesture) |
| return false; |
| + if (loadType() == WebMediaPlayer::LoadTypeMediaStream) |
| + return false; |
| + |
| // We want to allow muted video to autoplay if: |
| // - the flag is enabled; |
| // - Data Saver is not enabled; |