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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 1815033003: Add srcObject attribute of type MediaStream to HTMLMediaElement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix condition Created 4 years, 8 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
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 #include "platform/RuntimeEnabledFeatures.h" 76 #include "platform/RuntimeEnabledFeatures.h"
77 #include "platform/UserGestureIndicator.h" 77 #include "platform/UserGestureIndicator.h"
78 #include "platform/audio/AudioBus.h" 78 #include "platform/audio/AudioBus.h"
79 #include "platform/audio/AudioSourceProviderClient.h" 79 #include "platform/audio/AudioSourceProviderClient.h"
80 #include "platform/graphics/GraphicsLayer.h" 80 #include "platform/graphics/GraphicsLayer.h"
81 #include "platform/weborigin/SecurityOrigin.h" 81 #include "platform/weborigin/SecurityOrigin.h"
82 #include "public/platform/Platform.h" 82 #include "public/platform/Platform.h"
83 #include "public/platform/WebAudioSourceProvider.h" 83 #include "public/platform/WebAudioSourceProvider.h"
84 #include "public/platform/WebContentDecryptionModule.h" 84 #include "public/platform/WebContentDecryptionModule.h"
85 #include "public/platform/WebInbandTextTrack.h" 85 #include "public/platform/WebInbandTextTrack.h"
86 #include "public/platform/WebMediaStream.h"
86 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h" 87 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h"
87 #include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h" 88 #include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h"
88 #include "wtf/CurrentTime.h" 89 #include "wtf/CurrentTime.h"
89 #include "wtf/MathExtras.h" 90 #include "wtf/MathExtras.h"
90 #include "wtf/text/CString.h" 91 #include "wtf/text/CString.h"
91 #include <limits> 92 #include <limits>
92 93
93 #ifndef LOG_MEDIA_EVENTS 94 #ifndef LOG_MEDIA_EVENTS
94 // Default to not logging events because so many are generated they can overwhel m the rest of 95 // Default to not logging events because so many are generated they can overwhel m the rest of
95 // the logging. 96 // the logging.
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 return new LayoutMedia(this); 617 return new LayoutMedia(this);
617 } 618 }
618 619
619 Node::InsertionNotificationRequest HTMLMediaElement::insertedInto(ContainerNode* insertionPoint) 620 Node::InsertionNotificationRequest HTMLMediaElement::insertedInto(ContainerNode* insertionPoint)
620 { 621 {
621 WTF_LOG(Media, "HTMLMediaElement::insertedInto(%p, %p)", this, insertionPoin t); 622 WTF_LOG(Media, "HTMLMediaElement::insertedInto(%p, %p)", this, insertionPoin t);
622 623
623 HTMLElement::insertedInto(insertionPoint); 624 HTMLElement::insertedInto(insertionPoint);
624 if (insertionPoint->inDocument()) { 625 if (insertionPoint->inDocument()) {
625 UseCounter::count(document(), UseCounter::HTMLMediaElementInDocument); 626 UseCounter::count(document(), UseCounter::HTMLMediaElementInDocument);
626 if (!getAttribute(srcAttr).isEmpty() && m_networkState == NETWORK_EMPTY) { 627 if (m_networkState == NETWORK_EMPTY && (!getAttribute(srcAttr).isEmpty() || m_source.isMediaProviderObject())) {
philipj_slow 2016/04/06 11:58:42 Hmm, why this change? This block of code isn't per
Guido Urdaneta 2016/04/06 16:34:54 Nothing broke with or without this change. wolenet
philipj_slow 2016/04/07 15:38:11 What could now be broken when using srcObject is m
Guido Urdaneta 2016/04/08 10:58:47 I think it makes sense to add the srcObject check
627 m_ignorePreloadNone = false; 628 m_ignorePreloadNone = false;
628 invokeLoadAlgorithm(); 629 invokeLoadAlgorithm();
629 } 630 }
630 } 631 }
631 632
632 return InsertionShouldCallDidNotifySubtreeInsertions; 633 return InsertionShouldCallDidNotifySubtreeInsertions;
633 } 634 }
634 635
635 void HTMLMediaElement::didNotifySubtreeInsertionsToDocument() 636 void HTMLMediaElement::didNotifySubtreeInsertionsToDocument()
636 { 637 {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 MediaError* HTMLMediaElement::error() const 712 MediaError* HTMLMediaElement::error() const
712 { 713 {
713 return m_error; 714 return m_error;
714 } 715 }
715 716
716 void HTMLMediaElement::setSrc(const AtomicString& url) 717 void HTMLMediaElement::setSrc(const AtomicString& url)
717 { 718 {
718 setAttribute(srcAttr, url); 719 setAttribute(srcAttr, url);
719 } 720 }
720 721
722 void HTMLMediaElement::setSrcObject(const WebMediaElementSource& srcObject)
723 {
724 // The srcObject IDL attribute, on setting, must set the element's assigned
725 // media provider object to the new value, and then invoke the element's
726 // media element load algorithm.
727 m_source = srcObject;
philipj_slow 2016/04/06 11:58:42 Looking at this I'm thinking that it'd be cleaner
Guido Urdaneta 2016/04/06 16:34:55 Done.
728 invokeLoadAlgorithm();
729 }
730
721 HTMLMediaElement::NetworkState HTMLMediaElement::getNetworkState() const 731 HTMLMediaElement::NetworkState HTMLMediaElement::getNetworkState() const
722 { 732 {
723 return m_networkState; 733 return m_networkState;
724 } 734 }
725 735
726 String HTMLMediaElement::canPlayType(const String& mimeType) const 736 String HTMLMediaElement::canPlayType(const String& mimeType) const
727 { 737 {
728 WebMimeRegistry::SupportsType support = supportsType(ContentType(mimeType)); 738 WebMimeRegistry::SupportsType support = supportsType(ContentType(mimeType));
729 String canPlay; 739 String canPlay;
730 740
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 } 899 }
890 } 900 }
891 901
892 selectMediaResource(); 902 selectMediaResource();
893 } 903 }
894 904
895 void HTMLMediaElement::selectMediaResource() 905 void HTMLMediaElement::selectMediaResource()
896 { 906 {
897 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p)", this); 907 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p)", this);
898 908
899 enum Mode { attribute, children }; 909 enum Mode { Object, Attribute, Children, Nothing };
910 Mode mode = Nothing;
900 911
901 // 3 - If the media element has a src attribute, then let mode be attribute. 912 // 6 - If the media element has an assigned media provider object, then let
902 Mode mode = attribute; 913 // mode be object.
903 if (!fastHasAttribute(srcAttr)) { 914 if (m_source.isMediaProviderObject()) {
904 // Otherwise, if the media element does not have a src attribute but has a source 915 mode = Object;
905 // element child, then let mode be children and let candidate be the fir st such 916 } else if (fastHasAttribute(srcAttr)) {
906 // source element child in tree order. 917 // Otherwise, if the media element has no assigned media provider object
907 if (HTMLSourceElement* element = Traversal<HTMLSourceElement>::firstChil d(*this)) { 918 // but has a src attribute, then let mode be attribute.
908 mode = children; 919 mode = Attribute;
909 m_nextChildNodeToConsider = element; 920 } else if (HTMLSourceElement* element = Traversal<HTMLSourceElement>::firstC hild(*this)) {
910 m_currentSourceNode = nullptr; 921 // Otherwise, if the media element does not have an assigned media
911 } else { 922 // provider object and does not have a src attribute, but does have a
912 // Otherwise the media element has neither a src attribute nor a sou rce element 923 // source element child, then let mode be children and let candidate be
913 // child: set the networkState to NETWORK_EMPTY, and abort these ste ps; the 924 // the first such source element child in tree order.
914 // synchronous section ends. 925 mode = Children;
915 m_loadState = WaitingForSource; 926 m_nextChildNodeToConsider = element;
916 setShouldDelayLoadEvent(false); 927 m_currentSourceNode = nullptr;
917 setNetworkState(NETWORK_EMPTY); 928 } else {
918 updateDisplayState(); 929 // Otherwise the media element has no assigned media provider object and
930 // has neither a src attribute nor a source element child: set the
931 // networkState to NETWORK_EMPTY, and abort these steps; the synchronous
932 // section ends.
933 m_loadState = WaitingForSource;
934 setShouldDelayLoadEvent(false);
935 setNetworkState(NETWORK_EMPTY);
936 updateDisplayState();
919 937
920 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), nothing t o load", this); 938 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), nothing to lo ad", this);
921 return;
922 }
923 }
924
925 // 4 - Set the media element's delaying-the-load-event flag to true (this de lays the load event),
926 // and set its networkState to NETWORK_LOADING.
927 setShouldDelayLoadEvent(true);
928 setNetworkState(NETWORK_LOADING);
929
930 // 5 - Queue a task to fire a simple event named loadstart at the media elem ent.
931 scheduleEvent(EventTypeNames::loadstart);
932
933 // 6 - If mode is attribute, then run these substeps
934 if (mode == attribute) {
935 m_loadState = LoadingFromSrcAttr;
936
937 const AtomicString& srcValue = fastGetAttribute(srcAttr);
938 // If the src attribute's value is the empty string ... jump down to the failed step below
939 if (srcValue.isEmpty()) {
940 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
941 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), empty 'sr c'", this);
942 return;
943 }
944
945 KURL mediaURL = document().completeURL(srcValue);
946 if (!isSafeToLoadURL(mediaURL, Complain)) {
947 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
948 return;
949 }
950
951 // No type is available when the url comes from the 'src' attribute so M ediaPlayer
952 // will have to pick a media engine based on the file extension.
953 ContentType contentType((String()));
954 loadResource(mediaURL, contentType);
955 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), using 'src' a ttribute url", this);
956 return; 939 return;
957 } 940 }
958 941
959 // Otherwise, the source elements will be used 942 // 7 - Set the media element's networkState to NETWORK_LOADING.
960 loadNextSourceChild(); 943 setNetworkState(NETWORK_LOADING);
944
945 // 8 - Queue a task to fire a simple event named loadstart at the media elem ent.
946 scheduleEvent(EventTypeNames::loadstart);
947
948 // 9 - Run the appropriate steps...
949 switch (mode) {
950 case Object:
951 loadSourceFromObject();
952 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), using 'srcObj ect' attribute", this);
953 break;
954 case Attribute:
955 loadSourceFromAttribute();
956 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), using 'src' a ttribute url", this);
957 break;
958 case Children:
959 loadNextSourceChild();
960 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), using source element", this);
961 break;
962 default:
963 ASSERT_NOT_REACHED();
964 }
965 }
966
967 void HTMLMediaElement::loadSourceFromObject()
968 {
969 ASSERT(m_source.isMediaProviderObject());
970 m_loadState = LoadingFromSrcObject;
971
972 // No type is available when the resource comes from the 'srcObject'
973 // attribute.
974 ContentType contentType((String()));
975 loadResource(contentType);
976 }
977
978 void HTMLMediaElement::loadSourceFromAttribute()
979 {
980 m_loadState = LoadingFromSrcAttr;
981 const AtomicString& srcValue = fastGetAttribute(srcAttr);
982
983 // If the src attribute's value is the empty string ... jump down to the fai led step below
984 if (srcValue.isEmpty()) {
985 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
986 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), empty 'src'", this);
987 return;
988 }
989
990 KURL mediaURL = document().completeURL(srcValue);
991 if (!isSafeToLoadURL(mediaURL, Complain)) {
992 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
993 return;
994 }
995
996 // No type is available when the url comes from the 'src' attribute so
997 // MediaPlayer will have to pick a media engine based on the file extension.
998 ContentType contentType((String()));
999 m_source = WebMediaElementSource(WebURL(mediaURL));
philipj_slow 2016/04/06 11:58:42 Here, rather than setting m_source/m_srcObject, ca
Guido Urdaneta 2016/04/06 16:34:55 Done.
1000 loadResource(contentType);
961 } 1001 }
962 1002
963 void HTMLMediaElement::loadNextSourceChild() 1003 void HTMLMediaElement::loadNextSourceChild()
964 { 1004 {
965 ContentType contentType((String())); 1005 ContentType contentType((String()));
966 KURL mediaURL = selectNextSourceChild(&contentType, Complain); 1006 KURL mediaURL = selectNextSourceChild(&contentType, Complain);
967 if (!mediaURL.isValid()) { 1007 if (!mediaURL.isValid()) {
968 waitForSourceChange(); 1008 waitForSourceChange();
969 return; 1009 return;
970 } 1010 }
971 1011
972 // Reset the MediaPlayer and MediaSource if any 1012 // Reset the MediaPlayer and MediaSource if any
973 resetMediaPlayerAndMediaSource(); 1013 resetMediaPlayerAndMediaSource();
974 1014
975 m_loadState = LoadingFromSourceElement; 1015 m_loadState = LoadingFromSourceElement;
976 loadResource(mediaURL, contentType); 1016 m_source = WebMediaElementSource(WebURL(mediaURL));
philipj_slow 2016/04/06 11:58:42 Ditto.
Guido Urdaneta 2016/04/06 16:34:54 Done.
1017 loadResource(contentType);
977 } 1018 }
978 1019
979 void HTMLMediaElement::loadResource(const KURL& url, ContentType& contentType) 1020 void HTMLMediaElement::loadResource(ContentType& contentType)
980 { 1021 {
981 ASSERT(isMainThread()); 1022 ASSERT(isMainThread());
982 ASSERT(isSafeToLoadURL(url, Complain)); 1023 KURL url;
983 1024 if (m_source.isURL()) {
984 WTF_LOG(Media, "HTMLMediaElement::loadResource(%p, %s, %s)", this, urlForLog gingMedia(url).utf8().data(), contentType.raw().utf8().data()); 1025 url = m_source.getAsURL();
1026 ASSERT(isSafeToLoadURL(url, Complain));
1027 WTF_LOG(Media, "HTMLMediaElement::loadResource(%p, %s, %s)", this, urlFo rLoggingMedia(url).utf8().data(), contentType.raw().utf8().data());
1028 }
985 1029
986 LocalFrame* frame = document().frame(); 1030 LocalFrame* frame = document().frame();
987 if (!frame) { 1031 if (!frame) {
988 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); 1032 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
989 return; 1033 return;
990 } 1034 }
991 1035
992 // The resource fetch algorithm 1036 // The resource fetch algorithm
993 setNetworkState(NETWORK_LOADING); 1037 setNetworkState(NETWORK_LOADING);
994 1038
(...skipping 16 matching lines...) Expand all
1011 setPlayerPreload(); 1055 setPlayerPreload();
1012 1056
1013 if (fastHasAttribute(mutedAttr)) 1057 if (fastHasAttribute(mutedAttr))
1014 m_muted = true; 1058 m_muted = true;
1015 updateVolume(); 1059 updateVolume();
1016 1060
1017 ASSERT(!m_mediaSource); 1061 ASSERT(!m_mediaSource);
1018 1062
1019 bool attemptLoad = true; 1063 bool attemptLoad = true;
1020 1064
1021 if (url.protocolIs(mediaSourceBlobProtocol)) { 1065 bool isBlobProtocol = m_source.isMediaProviderObject() || url.protocolIs(med iaSourceBlobProtocol);
philipj_slow 2016/04/06 11:58:42 I guess isObjectOrBlobURL or something would be mo
Guido Urdaneta 2016/04/06 16:34:55 Done.
1022 if (isMediaStreamURL(url.getString())) { 1066 if (isBlobProtocol) {
1067 bool isMediaStream = m_source.isMediaStream() || (m_source.isURL() && is MediaStreamURL(url.getString()));
1068 if (isMediaStream) {
1023 m_autoplayHelper->removeUserGestureRequirement(GesturelessPlaybackEn abledByStream); 1069 m_autoplayHelper->removeUserGestureRequirement(GesturelessPlaybackEn abledByStream);
1024 } else { 1070 } else {
1025 m_mediaSource = HTMLMediaSource::lookup(url.getString()); 1071 m_mediaSource = HTMLMediaSource::lookup(url.getString());
1026 1072
1027 if (m_mediaSource) { 1073 if (m_mediaSource) {
1028 if (!m_mediaSource->attachToElement(this)) { 1074 if (!m_mediaSource->attachToElement(this)) {
1029 // Forget our reference to the MediaSource, so we leave it a lone 1075 // Forget our reference to the MediaSource, so we leave it a lone
1030 // while processing remainder of load failure. 1076 // while processing remainder of load failure.
1031 m_mediaSource = nullptr; 1077 m_mediaSource = nullptr;
1032 attemptLoad = false; 1078 attemptLoad = false;
1033 } 1079 }
1034 } 1080 }
1035 } 1081 }
1036 } 1082 }
1037 1083
1038 if (attemptLoad && canLoadURL(url, contentType)) { 1084 bool canLoadResource = m_source.isMediaProviderObject() || canLoadURL(url, c ontentType);
1085 if (attemptLoad && canLoadResource) {
1039 ASSERT(!webMediaPlayer()); 1086 ASSERT(!webMediaPlayer());
1040 1087
1041 if (effectivePreloadType() == WebMediaPlayer::PreloadNone) { 1088 if (effectivePreloadType() == WebMediaPlayer::PreloadNone) {
1042 WTF_LOG(Media, "HTMLMediaElement::loadResource(%p) : Delaying load b ecause preload == 'none'", this); 1089 WTF_LOG(Media, "HTMLMediaElement::loadResource(%p) : Delaying load b ecause preload == 'none'", this);
1043 deferLoad(); 1090 deferLoad();
1044 } else { 1091 } else {
1045 startPlayerLoad(); 1092 startPlayerLoad();
1046 } 1093 }
1047 } else { 1094 } else {
1048 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); 1095 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
1049 } 1096 }
1050 1097
1051 // If there is no poster to display, allow the media engine to render video frames as soon as 1098 // If there is no poster to display, allow the media engine to render video frames as soon as
1052 // they are available. 1099 // they are available.
1053 updateDisplayState(); 1100 updateDisplayState();
1054 1101
1055 if (layoutObject()) 1102 if (layoutObject())
1056 layoutObject()->updateFromElement(); 1103 layoutObject()->updateFromElement();
1057 } 1104 }
1058 1105
1059 void HTMLMediaElement::startPlayerLoad() 1106 void HTMLMediaElement::startPlayerLoad()
1060 { 1107 {
1061 ASSERT(!m_webMediaPlayer); 1108 ASSERT(!m_webMediaPlayer);
1062 // Filter out user:pass as those two URL components aren't 1109
1063 // considered for media resource fetches (including for the CORS 1110 if (m_source.isURL()) {
philipj_slow 2016/04/06 11:58:42 This will have to change with my proposed changes
Guido Urdaneta 2016/04/06 16:34:55 Done.
1064 // use-credentials mode.) That behavior aligns with Gecko, with IE 1111 // Filter out user:pass as those two URL components aren't
1065 // being more restrictive and not allowing fetches to such URLs. 1112 // considered for media resource fetches (including for the CORS
1066 // 1113 // use-credentials mode.) That behavior aligns with Gecko, with IE
1067 // Spec reference: http://whatwg.org/c/#concept-media-load-resource 1114 // being more restrictive and not allowing fetches to such URLs.
1068 // 1115 //
1069 // FIXME: when the HTML spec switches to specifying resource 1116 // Spec reference: http://whatwg.org/c/#concept-media-load-resource
1070 // fetches in terms of Fetch (http://fetch.spec.whatwg.org), and 1117 //
1071 // along with that potentially also specifying a setting for its 1118 // FIXME: when the HTML spec switches to specifying resource
1072 // 'authentication flag' to control how user:pass embedded in a 1119 // fetches in terms of Fetch (http://fetch.spec.whatwg.org), and
1073 // media resource URL should be treated, then update the handling 1120 // along with that potentially also specifying a setting for its
1074 // here to match. 1121 // 'authentication flag' to control how user:pass embedded in a
1075 KURL requestURL = m_currentSrc; 1122 // media resource URL should be treated, then update the handling
1076 if (!requestURL.user().isEmpty()) 1123 // here to match.
1077 requestURL.setUser(String()); 1124 KURL requestURL = m_currentSrc;
1078 if (!requestURL.pass().isEmpty()) 1125 if (!requestURL.user().isEmpty())
1079 requestURL.setPass(String()); 1126 requestURL.setUser(String());
1127 if (!requestURL.pass().isEmpty())
1128 requestURL.setPass(String());
1129
1130 KURL kurl(ParsedURLString, requestURL);
1131 m_source = WebMediaElementSource(WebURL(kurl));
1132 }
1080 1133
1081 LocalFrame* frame = document().frame(); 1134 LocalFrame* frame = document().frame();
1082 // TODO(srirama.m): Figure out how frame can be null when 1135 // TODO(srirama.m): Figure out how frame can be null when
1083 // coming from executeDeferredLoad() 1136 // coming from executeDeferredLoad()
1084 if (!frame) { 1137 if (!frame) {
1085 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); 1138 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
1086 return; 1139 return;
1087 } 1140 }
1088 1141
1089 KURL kurl(ParsedURLString, requestURL); 1142 m_webMediaPlayer = frame->loader().client()->createWebMediaPlayer(*this, m_s ource, this);
1090 m_webMediaPlayer = frame->loader().client()->createWebMediaPlayer(*this, kur l, this);
1091 if (!m_webMediaPlayer) { 1143 if (!m_webMediaPlayer) {
1092 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); 1144 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
1093 return; 1145 return;
1094 } 1146 }
1095 1147
1096 if (layoutObject()) 1148 if (layoutObject())
1097 layoutObject()->setShouldDoFullPaintInvalidation(); 1149 layoutObject()->setShouldDoFullPaintInvalidation();
1098 // Make sure if we create/re-create the WebMediaPlayer that we update our wr apper. 1150 // Make sure if we create/re-create the WebMediaPlayer that we update our wr apper.
1099 m_audioSourceProvider.wrap(m_webMediaPlayer->getAudioSourceProvider()); 1151 m_audioSourceProvider.wrap(m_webMediaPlayer->getAudioSourceProvider());
1100 m_webMediaPlayer->setVolume(effectiveMediaVolume()); 1152 m_webMediaPlayer->setVolume(effectiveMediaVolume());
1101 1153
1102 m_webMediaPlayer->setPoster(posterImageURL()); 1154 m_webMediaPlayer->setPoster(posterImageURL());
1103 1155
1104 m_webMediaPlayer->setPreload(effectivePreloadType()); 1156 m_webMediaPlayer->setPreload(effectivePreloadType());
1105 1157
1106 m_webMediaPlayer->load(loadType(), kurl, corsMode()); 1158 m_webMediaPlayer->load(loadType(), m_source, corsMode());
1107 1159
1108 if (isFullscreen()) { 1160 if (isFullscreen()) {
1109 // This handles any transition to or from fullscreen overlay mode. 1161 // This handles any transition to or from fullscreen overlay mode.
1110 frame->chromeClient().enterFullScreenForElement(this); 1162 frame->chromeClient().enterFullScreenForElement(this);
1111 } 1163 }
1112 } 1164 }
1113 1165
1114 void HTMLMediaElement::setPlayerPreload() 1166 void HTMLMediaElement::setPlayerPreload()
1115 { 1167 {
1116 if (m_webMediaPlayer) 1168 if (m_webMediaPlayer)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 } 1241 }
1190 ASSERT(m_deferredLoadState == WaitingForStopDelayingLoadEventTask); 1242 ASSERT(m_deferredLoadState == WaitingForStopDelayingLoadEventTask);
1191 m_deferredLoadState = WaitingForTrigger; 1243 m_deferredLoadState = WaitingForTrigger;
1192 } 1244 }
1193 1245
1194 WebMediaPlayer::LoadType HTMLMediaElement::loadType() const 1246 WebMediaPlayer::LoadType HTMLMediaElement::loadType() const
1195 { 1247 {
1196 if (m_mediaSource) 1248 if (m_mediaSource)
1197 return WebMediaPlayer::LoadTypeMediaSource; 1249 return WebMediaPlayer::LoadTypeMediaSource;
1198 1250
1251 if (m_source.isMediaStream())
1252 return WebMediaPlayer::LoadTypeMediaStream;
1253
1199 if (isMediaStreamURL(m_currentSrc.getString())) 1254 if (isMediaStreamURL(m_currentSrc.getString()))
1200 return WebMediaPlayer::LoadTypeMediaStream; 1255 return WebMediaPlayer::LoadTypeMediaStream;
1201 1256
1202 return WebMediaPlayer::LoadTypeURL; 1257 return WebMediaPlayer::LoadTypeURL;
1203 } 1258 }
1204 1259
1205 bool HTMLMediaElement::textTracksAreReady() const 1260 bool HTMLMediaElement::textTracksAreReady() const
1206 { 1261 {
1207 // 4.8.10.12.1 Text track model 1262 // 4.8.10.12.1 Text track model
1208 // ... 1263 // ...
(...skipping 2663 matching lines...) Expand 10 before | Expand all | Expand 10 after
3872 } 3927 }
3873 3928
3874 #if !ENABLE(OILPAN) 3929 #if !ENABLE(OILPAN)
3875 WeakPtr<HTMLMediaElement> HTMLMediaElement::createWeakPtr() 3930 WeakPtr<HTMLMediaElement> HTMLMediaElement::createWeakPtr()
3876 { 3931 {
3877 return m_weakPtrFactory.createWeakPtr(); 3932 return m_weakPtrFactory.createWeakPtr();
3878 } 3933 }
3879 #endif 3934 #endif
3880 3935
3881 } // namespace blink 3936 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698