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

Unified Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 2046253002: When HLS redirects are encountered recreate WebMediaPlayer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup. Created 4 years, 6 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
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 ed596d00d9df66b3052914fec0e6c9c47b0352e2..551216bfcae7d1bcabaa650fed684ff35fef95c7 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -916,6 +916,20 @@ void HTMLMediaElement::selectMediaResource()
// 8 - Queue a task to fire a simple event named loadstart at the media element.
scheduleEvent(EventTypeNames::loadstart);
+ // Reload a post-redirect URL from a previous WebMediaPlayer instance. This provides a
hubbe 2016/06/15 21:07:56 line length?
DaleCurtis 2016/06/15 23:11:31 Blink uses longer line lengths unfortunately, so I
+ // workaround for WebMediaPlayer instances which discover they can't play a URL after
+ // redirects have been followed.
+ // TODO(tguilbert): Remove once http://crbug.com/580626 is fixed.
+ if (webMediaPlayer()) {
+ WebURL alternativeSourceURL = webMediaPlayer()->alternativeSourceURL();
+ if (!alternativeSourceURL.isEmpty()) {
+ resetMediaPlayerAndMediaSource();
+ ContentType contentType((String()));
+ loadResource(WebMediaPlayerSource(alternativeSourceURL), contentType);
+ return;
+ }
+ }
+
// 9 - Run the appropriate steps...
switch (mode) {
case Object:
@@ -1428,6 +1442,13 @@ void HTMLMediaElement::mediaLoadingFailed(WebMediaPlayer::NetworkState error)
{
stopPeriodicTimers();
+ // WebMediaPlayer encountered a resource it can't play, retry the loading with a new WebMediaPlayer instance using the post-redirect URL.
+ // TODO(tguilbert): Remove once http://crbug.com/580626 is fixed.
+ if (m_readyState < HAVE_METADATA && error == WebMediaPlayer::NetworkStateFormatError && webMediaPlayer() && !webMediaPlayer()->alternativeSourceURL().isEmpty()) {
+ scheduleNextSourceChild();
+ return;
+ }
+
// If we failed while trying to load a <source> element, the movie was never parsed, and there are more
// <source> children, schedule the next one
if (m_readyState < HAVE_METADATA && m_loadState == LoadingFromSourceElement) {

Powered by Google App Engine
This is Rietveld 408576698