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

Side by Side 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: Rename. 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 unified diff | Download patch
« no previous file with comments | « media/blink/webmediaplayer_impl.cc ('k') | third_party/WebKit/public/platform/WebMediaPlayer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 DVLOG(MEDIA_LOG_LEVEL) << "selectMediaResource(" << (void*)this << "), n othing to load"; 909 DVLOG(MEDIA_LOG_LEVEL) << "selectMediaResource(" << (void*)this << "), n othing to load";
910 return; 910 return;
911 } 911 }
912 912
913 // 7 - Set the media element's networkState to NETWORK_LOADING. 913 // 7 - Set the media element's networkState to NETWORK_LOADING.
914 setNetworkState(NETWORK_LOADING); 914 setNetworkState(NETWORK_LOADING);
915 915
916 // 8 - Queue a task to fire a simple event named loadstart at the media elem ent. 916 // 8 - Queue a task to fire a simple event named loadstart at the media elem ent.
917 scheduleEvent(EventTypeNames::loadstart); 917 scheduleEvent(EventTypeNames::loadstart);
918 918
919 // Reload a post-redirect URL from a previous WebMediaPlayer instance. This provides a
920 // workaround for WebMediaPlayer instances which discover they can't play a URL after
921 // redirects have been followed.
922 // TODO(tguilbert): Remove once http://crbug.com/580626 is fixed.
923 if (webMediaPlayer()) {
924 WebURL alternativeSourceURL = webMediaPlayer()->alternativeSourceURL();
925 if (!alternativeSourceURL.isEmpty()) {
926 resetMediaPlayerAndMediaSource();
927 ContentType contentType((String()));
928 loadResource(WebMediaPlayerSource(alternativeSourceURL), contentType );
929 return;
930 }
931 }
932
919 // 9 - Run the appropriate steps... 933 // 9 - Run the appropriate steps...
920 switch (mode) { 934 switch (mode) {
921 case Object: 935 case Object:
922 loadSourceFromObject(); 936 loadSourceFromObject();
923 DVLOG(MEDIA_LOG_LEVEL) << "selectMediaResource(" << (void*)this << ", us ing 'srcObject' attribute"; 937 DVLOG(MEDIA_LOG_LEVEL) << "selectMediaResource(" << (void*)this << ", us ing 'srcObject' attribute";
924 break; 938 break;
925 case Attribute: 939 case Attribute:
926 loadSourceFromAttribute(); 940 loadSourceFromAttribute();
927 DVLOG(MEDIA_LOG_LEVEL) << "selectMediaResource(" << (void*)this << "), u sing 'src' attribute url"; 941 DVLOG(MEDIA_LOG_LEVEL) << "selectMediaResource(" << (void*)this << "), u sing 'src' attribute url";
928 break; 942 break;
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 1435
1422 void HTMLMediaElement::networkStateChanged() 1436 void HTMLMediaElement::networkStateChanged()
1423 { 1437 {
1424 setNetworkState(webMediaPlayer()->getNetworkState()); 1438 setNetworkState(webMediaPlayer()->getNetworkState());
1425 } 1439 }
1426 1440
1427 void HTMLMediaElement::mediaLoadingFailed(WebMediaPlayer::NetworkState error) 1441 void HTMLMediaElement::mediaLoadingFailed(WebMediaPlayer::NetworkState error)
1428 { 1442 {
1429 stopPeriodicTimers(); 1443 stopPeriodicTimers();
1430 1444
1445 // WebMediaPlayer encountered a resource it can't play, retry the loading wi th a new WebMediaPlayer instance using the post-redirect URL.
1446 // TODO(tguilbert): Remove once http://crbug.com/580626 is fixed.
foolip 2016/06/20 10:30:44 Will support for HLS be added to WMPI, or what's t
DaleCurtis 2016/06/20 18:54:25 We'll be adding support for HLS to WMPI, but it wi
1447 if (m_readyState < HAVE_METADATA && error == WebMediaPlayer::NetworkStateFor matError && webMediaPlayer() && !webMediaPlayer()->alternativeSourceURL().isEmpt y()) {
1448 scheduleNextSourceChild();
foolip 2016/06/20 10:30:44 This will end up calling either loadNextSourceChil
DaleCurtis 2016/06/20 18:54:25 This is a good idea. I don't think we need to post
1449 return;
1450 }
1451
1431 // If we failed while trying to load a <source> element, the movie was never parsed, and there are more 1452 // If we failed while trying to load a <source> element, the movie was never parsed, and there are more
1432 // <source> children, schedule the next one 1453 // <source> children, schedule the next one
1433 if (m_readyState < HAVE_METADATA && m_loadState == LoadingFromSourceElement) { 1454 if (m_readyState < HAVE_METADATA && m_loadState == LoadingFromSourceElement) {
1434 1455
1435 // resource selection algorithm 1456 // resource selection algorithm
1436 // Step 9.Otherwise.9 - Failed with elements: Queue a task, using the DO M manipulation task source, to fire a simple event named error at the candidate element. 1457 // Step 9.Otherwise.9 - Failed with elements: Queue a task, using the DO M manipulation task source, to fire a simple event named error at the candidate element.
1437 if (m_currentSourceNode) 1458 if (m_currentSourceNode)
1438 m_currentSourceNode->scheduleErrorEvent(); 1459 m_currentSourceNode->scheduleErrorEvent();
1439 else 1460 else
1440 DVLOG(MEDIA_LOG_LEVEL) << "setNetworkState(" << (void*)this << ") - error event not sent, <source> was removed"; 1461 DVLOG(MEDIA_LOG_LEVEL) << "setNetworkState(" << (void*)this << ") - error event not sent, <source> was removed";
(...skipping 2543 matching lines...) Expand 10 before | Expand all | Expand 10 after
3984 4005
3985 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst 4006 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst
3986 { 4007 {
3987 IntRect result; 4008 IntRect result;
3988 if (LayoutObject* object = m_element->layoutObject()) 4009 if (LayoutObject* object = m_element->layoutObject())
3989 result = object->absoluteBoundingBoxRect(); 4010 result = object->absoluteBoundingBoxRect();
3990 return result; 4011 return result;
3991 } 4012 }
3992 4013
3993 } // namespace blink 4014 } // namespace blink
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_impl.cc ('k') | third_party/WebKit/public/platform/WebMediaPlayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698