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

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: use correct macro to enfore static methods only 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 #include "platform/RuntimeEnabledFeatures.h" 74 #include "platform/RuntimeEnabledFeatures.h"
75 #include "platform/UserGestureIndicator.h" 75 #include "platform/UserGestureIndicator.h"
76 #include "platform/audio/AudioBus.h" 76 #include "platform/audio/AudioBus.h"
77 #include "platform/audio/AudioSourceProviderClient.h" 77 #include "platform/audio/AudioSourceProviderClient.h"
78 #include "platform/graphics/GraphicsLayer.h" 78 #include "platform/graphics/GraphicsLayer.h"
79 #include "platform/weborigin/SecurityOrigin.h" 79 #include "platform/weborigin/SecurityOrigin.h"
80 #include "public/platform/Platform.h" 80 #include "public/platform/Platform.h"
81 #include "public/platform/WebAudioSourceProvider.h" 81 #include "public/platform/WebAudioSourceProvider.h"
82 #include "public/platform/WebContentDecryptionModule.h" 82 #include "public/platform/WebContentDecryptionModule.h"
83 #include "public/platform/WebInbandTextTrack.h" 83 #include "public/platform/WebInbandTextTrack.h"
84 #include "public/platform/WebMediaStream.h"
84 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h" 85 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h"
85 #include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h" 86 #include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h"
86 #include "wtf/CurrentTime.h" 87 #include "wtf/CurrentTime.h"
87 #include "wtf/MathExtras.h" 88 #include "wtf/MathExtras.h"
88 #include "wtf/text/CString.h" 89 #include "wtf/text/CString.h"
89 #include <limits> 90 #include <limits>
90 91
91 #ifndef LOG_MEDIA_EVENTS 92 #ifndef LOG_MEDIA_EVENTS
92 // Default to not logging events because so many are generated they can overwhel m the rest of 93 // Default to not logging events because so many are generated they can overwhel m the rest of
93 // the logging. 94 // the logging.
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 return new LayoutMedia(this); 553 return new LayoutMedia(this);
553 } 554 }
554 555
555 Node::InsertionNotificationRequest HTMLMediaElement::insertedInto(ContainerNode* insertionPoint) 556 Node::InsertionNotificationRequest HTMLMediaElement::insertedInto(ContainerNode* insertionPoint)
556 { 557 {
557 WTF_LOG(Media, "HTMLMediaElement::insertedInto(%p, %p)", this, insertionPoin t); 558 WTF_LOG(Media, "HTMLMediaElement::insertedInto(%p, %p)", this, insertionPoin t);
558 559
559 HTMLElement::insertedInto(insertionPoint); 560 HTMLElement::insertedInto(insertionPoint);
560 if (insertionPoint->inDocument()) { 561 if (insertionPoint->inDocument()) {
561 UseCounter::count(document(), UseCounter::HTMLMediaElementInDocument); 562 UseCounter::count(document(), UseCounter::HTMLMediaElementInDocument);
562 if (!getAttribute(srcAttr).isEmpty() && m_networkState == NETWORK_EMPTY) { 563 if (!getAttribute(srcAttr).isEmpty() && m_networkState == NETWORK_EMPTY) {
wolenetz 2016/03/31 19:35:27 On node insertion, if srcObject is used instead of
Guido Urdaneta 2016/04/01 12:14:57 I think you are right. Added extra condition.
563 m_ignorePreloadNone = false; 564 m_ignorePreloadNone = false;
564 invokeLoadAlgorithm(); 565 invokeLoadAlgorithm();
565 } 566 }
566 } 567 }
567 568
568 return InsertionShouldCallDidNotifySubtreeInsertions; 569 return InsertionShouldCallDidNotifySubtreeInsertions;
569 } 570 }
570 571
571 void HTMLMediaElement::didNotifySubtreeInsertionsToDocument() 572 void HTMLMediaElement::didNotifySubtreeInsertionsToDocument()
572 { 573 {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 MediaError* HTMLMediaElement::error() const 648 MediaError* HTMLMediaElement::error() const
648 { 649 {
649 return m_error; 650 return m_error;
650 } 651 }
651 652
652 void HTMLMediaElement::setSrc(const AtomicString& url) 653 void HTMLMediaElement::setSrc(const AtomicString& url)
653 { 654 {
654 setAttribute(srcAttr, url); 655 setAttribute(srcAttr, url);
655 } 656 }
656 657
658 void HTMLMediaElement::setSrcObject(const WebMediaElementSource& srcObject)
659 {
660 // The srcObject IDL attribute, on setting, must set the element's assigned
661 // media provider object to the new value, and then invoke the element's
662 // media element load algorithm.
663 m_source = srcObject;
664 invokeLoadAlgorithm();
665 }
666
657 HTMLMediaElement::NetworkState HTMLMediaElement::getNetworkState() const 667 HTMLMediaElement::NetworkState HTMLMediaElement::getNetworkState() const
658 { 668 {
659 return m_networkState; 669 return m_networkState;
660 } 670 }
661 671
662 String HTMLMediaElement::canPlayType(const String& mimeType) const 672 String HTMLMediaElement::canPlayType(const String& mimeType) const
663 { 673 {
664 WebMimeRegistry::SupportsType support = supportsType(ContentType(mimeType)); 674 WebMimeRegistry::SupportsType support = supportsType(ContentType(mimeType));
665 String canPlay; 675 String canPlay;
666 676
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 } 871 }
862 } 872 }
863 873
864 selectMediaResource(); 874 selectMediaResource();
865 } 875 }
866 876
867 void HTMLMediaElement::selectMediaResource() 877 void HTMLMediaElement::selectMediaResource()
868 { 878 {
869 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p)", this); 879 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p)", this);
870 880
871 enum Mode { attribute, children }; 881 enum Mode { Object, Attribute, Children, Nothing };
882 Mode mode = Nothing;
872 883
873 // 3 - If the media element has a src attribute, then let mode be attribute. 884 // 6 - If the media element has an assigned media provider object, then let
874 Mode mode = attribute; 885 // mode be object.
875 if (!fastHasAttribute(srcAttr)) { 886 if (m_source.isMediaProviderObject()) {
876 // Otherwise, if the media element does not have a src attribute but has a source 887 mode = Object;
877 // element child, then let mode be children and let candidate be the fir st such 888 } else if (fastHasAttribute(srcAttr)) {
878 // source element child in tree order. 889 // Otherwise, if the media element has no assigned media provider object
879 if (HTMLSourceElement* element = Traversal<HTMLSourceElement>::firstChil d(*this)) { 890 // but has a src attribute, then let mode be attribute.
880 mode = children; 891 mode = Attribute;
881 m_nextChildNodeToConsider = element; 892 } else if (HTMLSourceElement* element = Traversal<HTMLSourceElement>::firstC hild(*this)) {
882 m_currentSourceNode = nullptr; 893 // Otherwise, if the media element does not have an assigned media
883 } else { 894 // provider object and does not have a src attribute, but does have a
884 // Otherwise the media element has neither a src attribute nor a sou rce element 895 // source element child, then let mode be children and let candidate be
885 // child: set the networkState to NETWORK_EMPTY, and abort these ste ps; the 896 // the first such source element child in tree order.
886 // synchronous section ends. 897 mode = Children;
887 m_loadState = WaitingForSource; 898 m_nextChildNodeToConsider = element;
888 setShouldDelayLoadEvent(false); 899 m_currentSourceNode = nullptr;
889 setNetworkState(NETWORK_EMPTY); 900 } else {
890 updateDisplayState(); 901 // Otherwise the media element has no assigned media provider object and
902 // has neither a src attribute nor a source element child: set the
903 // networkState to NETWORK_EMPTY, and abort these steps; the synchronous
904 // section ends.
905 m_loadState = WaitingForSource;
906 setShouldDelayLoadEvent(false);
907 setNetworkState(NETWORK_EMPTY);
908 updateDisplayState();
891 909
892 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), nothing t o load", this); 910 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), nothing to lo ad", this);
893 return;
894 }
895 }
896
897 // 4 - Set the media element's delaying-the-load-event flag to true (this de lays the load event),
898 // and set its networkState to NETWORK_LOADING.
899 setShouldDelayLoadEvent(true);
900 setNetworkState(NETWORK_LOADING);
901
902 // 5 - Queue a task to fire a simple event named loadstart at the media elem ent.
903 scheduleEvent(EventTypeNames::loadstart);
904
905 // 6 - If mode is attribute, then run these substeps
906 if (mode == attribute) {
907 m_loadState = LoadingFromSrcAttr;
908
909 const AtomicString& srcValue = fastGetAttribute(srcAttr);
910 // If the src attribute's value is the empty string ... jump down to the failed step below
911 if (srcValue.isEmpty()) {
912 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
913 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), empty 'sr c'", this);
914 return;
915 }
916
917 KURL mediaURL = document().completeURL(srcValue);
918 if (!isSafeToLoadURL(mediaURL, Complain)) {
919 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
920 return;
921 }
922
923 // No type is available when the url comes from the 'src' attribute so M ediaPlayer
924 // will have to pick a media engine based on the file extension.
925 ContentType contentType((String()));
926 loadResource(mediaURL, contentType);
927 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), using 'src' a ttribute url", this);
928 return; 911 return;
929 } 912 }
930 913
931 // Otherwise, the source elements will be used 914 // 7 - Set the media element's networkState to NETWORK_LOADING.
932 loadNextSourceChild(); 915 setNetworkState(NETWORK_LOADING);
916
917 // 8 - Queue a task to fire a simple event named loadstart at the media elem ent.
918 scheduleEvent(EventTypeNames::loadstart);
919
920 // 9 - Run the appropriate steps...
921 switch (mode) {
922 case Object:
923 loadSourceFromObject();
924 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), using 'srcObj ect' attribute", this);
925 break;
926 case Attribute:
927 loadSourceFromAttribute();
928 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), using 'src' a ttribute url", this);
929 break;
930 case Children:
931 loadNextSourceChild();
932 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), using source element", this);
933 break;
934 default:
935 ASSERT_NOT_REACHED();
936 }
937 }
938
939 void HTMLMediaElement::loadSourceFromObject()
940 {
941 ASSERT(m_source.isMediaProviderObject());
942 m_loadState = LoadingFromSrcObject;
943
944 // No type is available when the resource comes from the 'srcObject'
945 // attribute.
946 ContentType contentType((String()));
947 loadResource(contentType);
948 }
949
950 void HTMLMediaElement::loadSourceFromAttribute()
951 {
952 m_loadState = LoadingFromSrcAttr;
953 const AtomicString& srcValue = fastGetAttribute(srcAttr);
954
955 // If the src attribute's value is the empty string ... jump down to the fai led step below
956 if (srcValue.isEmpty()) {
957 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
958 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), empty 'src'", this);
959 return;
960 }
961
962 KURL mediaURL = document().completeURL(srcValue);
963 if (!isSafeToLoadURL(mediaURL, Complain)) {
964 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
965 return;
966 }
967
968 // No type is available when the url comes from the 'src' attribute so
969 // MediaPlayer will have to pick a media engine based on the file extension.
970 ContentType contentType((String()));
971 m_source = WebMediaElementSource(WebURL(mediaURL));
972 loadResource(contentType);
933 } 973 }
934 974
935 void HTMLMediaElement::loadNextSourceChild() 975 void HTMLMediaElement::loadNextSourceChild()
936 { 976 {
937 ContentType contentType((String())); 977 ContentType contentType((String()));
938 KURL mediaURL = selectNextSourceChild(&contentType, Complain); 978 KURL mediaURL = selectNextSourceChild(&contentType, Complain);
939 if (!mediaURL.isValid()) { 979 if (!mediaURL.isValid()) {
940 waitForSourceChange(); 980 waitForSourceChange();
941 return; 981 return;
942 } 982 }
943 983
944 // Reset the MediaPlayer and MediaSource if any 984 // Reset the MediaPlayer and MediaSource if any
945 resetMediaPlayerAndMediaSource(); 985 resetMediaPlayerAndMediaSource();
946 986
947 m_loadState = LoadingFromSourceElement; 987 m_loadState = LoadingFromSourceElement;
948 loadResource(mediaURL, contentType); 988 m_source = WebMediaElementSource(WebURL(mediaURL));
989 loadResource(contentType);
949 } 990 }
950 991
951 void HTMLMediaElement::loadResource(const KURL& url, ContentType& contentType) 992 void HTMLMediaElement::loadResource(ContentType& contentType)
952 { 993 {
953 ASSERT(isMainThread()); 994 ASSERT(isMainThread());
954 ASSERT(isSafeToLoadURL(url, Complain)); 995 KURL url;
955 996 if (m_source.isURL()) {
956 WTF_LOG(Media, "HTMLMediaElement::loadResource(%p, %s, %s)", this, urlForLog gingMedia(url).utf8().data(), contentType.raw().utf8().data()); 997 url = m_source.getAsURL();
998 ASSERT(isSafeToLoadURL(url, Complain));
999 WTF_LOG(Media, "HTMLMediaElement::loadResource(%p, %s, %s)", this, urlFo rLoggingMedia(url).utf8().data(), contentType.raw().utf8().data());
1000 }
957 1001
958 LocalFrame* frame = document().frame(); 1002 LocalFrame* frame = document().frame();
959 if (!frame) { 1003 if (!frame) {
960 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); 1004 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
961 return; 1005 return;
962 } 1006 }
963 1007
964 // The resource fetch algorithm 1008 // The resource fetch algorithm
965 setNetworkState(NETWORK_LOADING); 1009 setNetworkState(NETWORK_LOADING);
966 1010
(...skipping 14 matching lines...) Expand all
981 setPlayerPreload(); 1025 setPlayerPreload();
982 1026
983 if (fastHasAttribute(mutedAttr)) 1027 if (fastHasAttribute(mutedAttr))
984 m_muted = true; 1028 m_muted = true;
985 updateVolume(); 1029 updateVolume();
986 1030
987 ASSERT(!m_mediaSource); 1031 ASSERT(!m_mediaSource);
988 1032
989 bool attemptLoad = true; 1033 bool attemptLoad = true;
990 1034
991 if (url.protocolIs(mediaSourceBlobProtocol)) { 1035 bool isBlobProtocol = m_source.isMediaProviderObject() || url.protocolIs(med iaSourceBlobProtocol);
992 if (isMediaStreamURL(url.getString())) { 1036 if (isBlobProtocol) {
1037 bool isMediaStream = m_source.isMediaStream() || (m_source.isURL() && is MediaStreamURL(url.getString()));
1038 if (isMediaStream) {
993 m_userGestureRequiredForPlay = false; 1039 m_userGestureRequiredForPlay = false;
994 } else { 1040 } else {
995 m_mediaSource = HTMLMediaSource::lookup(url.getString()); 1041 m_mediaSource = HTMLMediaSource::lookup(url.getString());
996 1042
997 if (m_mediaSource) { 1043 if (m_mediaSource) {
998 if (!m_mediaSource->attachToElement(this)) { 1044 if (!m_mediaSource->attachToElement(this)) {
999 // Forget our reference to the MediaSource, so we leave it a lone 1045 // Forget our reference to the MediaSource, so we leave it a lone
1000 // while processing remainder of load failure. 1046 // while processing remainder of load failure.
1001 m_mediaSource = nullptr; 1047 m_mediaSource = nullptr;
1002 attemptLoad = false; 1048 attemptLoad = false;
1003 } 1049 }
1004 } 1050 }
1005 } 1051 }
1006 } 1052 }
1007 1053
1008 if (attemptLoad && canLoadURL(url, contentType)) { 1054 bool canLoadResource = m_source.isMediaProviderObject() || canLoadURL(url, c ontentType);
1055 if (attemptLoad && canLoadResource) {
1009 ASSERT(!webMediaPlayer()); 1056 ASSERT(!webMediaPlayer());
1010 1057
1011 if (effectivePreloadType() == WebMediaPlayer::PreloadNone) { 1058 if (effectivePreloadType() == WebMediaPlayer::PreloadNone) {
1012 WTF_LOG(Media, "HTMLMediaElement::loadResource(%p) : Delaying load b ecause preload == 'none'", this); 1059 WTF_LOG(Media, "HTMLMediaElement::loadResource(%p) : Delaying load b ecause preload == 'none'", this);
1013 deferLoad(); 1060 deferLoad();
1014 } else { 1061 } else {
1015 startPlayerLoad(); 1062 startPlayerLoad();
1016 } 1063 }
1017 } else { 1064 } else {
1018 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); 1065 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
1019 } 1066 }
1020 1067
1021 // If there is no poster to display, allow the media engine to render video frames as soon as 1068 // If there is no poster to display, allow the media engine to render video frames as soon as
1022 // they are available. 1069 // they are available.
1023 updateDisplayState(); 1070 updateDisplayState();
1024 1071
1025 if (layoutObject()) 1072 if (layoutObject())
1026 layoutObject()->updateFromElement(); 1073 layoutObject()->updateFromElement();
1027 } 1074 }
1028 1075
1029 void HTMLMediaElement::startPlayerLoad() 1076 void HTMLMediaElement::startPlayerLoad()
1030 { 1077 {
1031 ASSERT(!m_webMediaPlayer); 1078 ASSERT(!m_webMediaPlayer);
1032 // Filter out user:pass as those two URL components aren't 1079
1033 // considered for media resource fetches (including for the CORS 1080 if (m_source.isURL()) {
1034 // use-credentials mode.) That behavior aligns with Gecko, with IE 1081 // Filter out user:pass as those two URL components aren't
1035 // being more restrictive and not allowing fetches to such URLs. 1082 // considered for media resource fetches (including for the CORS
1036 // 1083 // use-credentials mode.) That behavior aligns with Gecko, with IE
1037 // Spec reference: http://whatwg.org/c/#concept-media-load-resource 1084 // being more restrictive and not allowing fetches to such URLs.
1038 // 1085 //
1039 // FIXME: when the HTML spec switches to specifying resource 1086 // Spec reference: http://whatwg.org/c/#concept-media-load-resource
1040 // fetches in terms of Fetch (http://fetch.spec.whatwg.org), and 1087 //
1041 // along with that potentially also specifying a setting for its 1088 // FIXME: when the HTML spec switches to specifying resource
1042 // 'authentication flag' to control how user:pass embedded in a 1089 // fetches in terms of Fetch (http://fetch.spec.whatwg.org), and
1043 // media resource URL should be treated, then update the handling 1090 // along with that potentially also specifying a setting for its
1044 // here to match. 1091 // 'authentication flag' to control how user:pass embedded in a
1045 KURL requestURL = m_currentSrc; 1092 // media resource URL should be treated, then update the handling
1046 if (!requestURL.user().isEmpty()) 1093 // here to match.
1047 requestURL.setUser(String()); 1094 KURL requestURL = m_currentSrc;
1048 if (!requestURL.pass().isEmpty()) 1095 if (!requestURL.user().isEmpty())
1049 requestURL.setPass(String()); 1096 requestURL.setUser(String());
1097 if (!requestURL.pass().isEmpty())
1098 requestURL.setPass(String());
1099
1100 KURL kurl(ParsedURLString, requestURL);
1101 m_source = WebMediaElementSource(WebURL(kurl));
1102 }
1050 1103
1051 LocalFrame* frame = document().frame(); 1104 LocalFrame* frame = document().frame();
1052 // TODO(srirama.m): Figure out how frame can be null when 1105 // TODO(srirama.m): Figure out how frame can be null when
1053 // coming from executeDeferredLoad() 1106 // coming from executeDeferredLoad()
1054 if (!frame) { 1107 if (!frame) {
1055 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); 1108 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
1056 return; 1109 return;
1057 } 1110 }
1058 1111
1059 KURL kurl(ParsedURLString, requestURL); 1112 m_webMediaPlayer = frame->loader().client()->createWebMediaPlayer(*this, loa dType(), m_source, this);
1060 m_webMediaPlayer = frame->loader().client()->createWebMediaPlayer(*this, loa dType(), kurl, this);
1061 if (!m_webMediaPlayer) { 1113 if (!m_webMediaPlayer) {
1062 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); 1114 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
1063 return; 1115 return;
1064 } 1116 }
1065 1117
1066 if (layoutObject()) 1118 if (layoutObject())
1067 layoutObject()->setShouldDoFullPaintInvalidation(); 1119 layoutObject()->setShouldDoFullPaintInvalidation();
1068 // Make sure if we create/re-create the WebMediaPlayer that we update our wr apper. 1120 // Make sure if we create/re-create the WebMediaPlayer that we update our wr apper.
1069 m_audioSourceProvider.wrap(m_webMediaPlayer->getAudioSourceProvider()); 1121 m_audioSourceProvider.wrap(m_webMediaPlayer->getAudioSourceProvider());
1070 m_webMediaPlayer->setVolume(effectiveMediaVolume()); 1122 m_webMediaPlayer->setVolume(effectiveMediaVolume());
1071 1123
1072 m_webMediaPlayer->setPoster(posterImageURL()); 1124 m_webMediaPlayer->setPoster(posterImageURL());
1073 1125
1074 m_webMediaPlayer->setPreload(effectivePreloadType()); 1126 m_webMediaPlayer->setPreload(effectivePreloadType());
1075 1127
1076 m_webMediaPlayer->load(loadType(), kurl, corsMode()); 1128 m_webMediaPlayer->load(loadType(), m_source, corsMode());
1077 1129
1078 if (isFullscreen()) { 1130 if (isFullscreen()) {
1079 // This handles any transition to or from fullscreen overlay mode. 1131 // This handles any transition to or from fullscreen overlay mode.
1080 frame->chromeClient().enterFullScreenForElement(this); 1132 frame->chromeClient().enterFullScreenForElement(this);
1081 } 1133 }
1082 } 1134 }
1083 1135
1084 void HTMLMediaElement::setPlayerPreload() 1136 void HTMLMediaElement::setPlayerPreload()
1085 { 1137 {
1086 if (m_webMediaPlayer) 1138 if (m_webMediaPlayer)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 } 1211 }
1160 ASSERT(m_deferredLoadState == WaitingForStopDelayingLoadEventTask); 1212 ASSERT(m_deferredLoadState == WaitingForStopDelayingLoadEventTask);
1161 m_deferredLoadState = WaitingForTrigger; 1213 m_deferredLoadState = WaitingForTrigger;
1162 } 1214 }
1163 1215
1164 WebMediaPlayer::LoadType HTMLMediaElement::loadType() const 1216 WebMediaPlayer::LoadType HTMLMediaElement::loadType() const
1165 { 1217 {
1166 if (m_mediaSource) 1218 if (m_mediaSource)
1167 return WebMediaPlayer::LoadTypeMediaSource; 1219 return WebMediaPlayer::LoadTypeMediaSource;
1168 1220
1221 if (m_source.isMediaStream())
1222 return WebMediaPlayer::LoadTypeMediaStream;
1223
1169 if (isMediaStreamURL(m_currentSrc.getString())) 1224 if (isMediaStreamURL(m_currentSrc.getString()))
1170 return WebMediaPlayer::LoadTypeMediaStream; 1225 return WebMediaPlayer::LoadTypeMediaStream;
1171 1226
1172 return WebMediaPlayer::LoadTypeURL; 1227 return WebMediaPlayer::LoadTypeURL;
1173 } 1228 }
1174 1229
1175 bool HTMLMediaElement::textTracksAreReady() const 1230 bool HTMLMediaElement::textTracksAreReady() const
1176 { 1231 {
1177 // 4.8.10.12.1 Text track model 1232 // 4.8.10.12.1 Text track model
1178 // ... 1233 // ...
(...skipping 2646 matching lines...) Expand 10 before | Expand all | Expand 10 after
3825 { 3880 {
3826 visitor->trace(m_client); 3881 visitor->trace(m_client);
3827 } 3882 }
3828 3883
3829 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) 3884 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl)
3830 { 3885 {
3831 visitor->trace(m_client); 3886 visitor->trace(m_client);
3832 } 3887 }
3833 3888
3834 } // namespace blink 3889 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698