OLD | NEW |
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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 case WebMediaPlayerClient::VideoTrackKindSubtitles: | 206 case WebMediaPlayerClient::VideoTrackKindSubtitles: |
207 return VideoTrack::subtitlesKeyword(); | 207 return VideoTrack::subtitlesKeyword(); |
208 case WebMediaPlayerClient::VideoTrackKindCommentary: | 208 case WebMediaPlayerClient::VideoTrackKindCommentary: |
209 return VideoTrack::commentaryKeyword(); | 209 return VideoTrack::commentaryKeyword(); |
210 } | 210 } |
211 | 211 |
212 ASSERT_NOT_REACHED(); | 212 ASSERT_NOT_REACHED(); |
213 return emptyAtom; | 213 return emptyAtom; |
214 } | 214 } |
215 | 215 |
216 static bool canLoadURL(const KURL& url, const ContentType& contentType, const St
ring& keySystem) | 216 static bool canLoadURL(const KURL& url, const ContentType& contentType) |
217 { | 217 { |
218 DEFINE_STATIC_LOCAL(const String, codecs, ("codecs")); | 218 DEFINE_STATIC_LOCAL(const String, codecs, ("codecs")); |
219 | 219 |
220 String contentMIMEType = contentType.type().lower(); | 220 String contentMIMEType = contentType.type().lower(); |
221 String contentTypeCodecs = contentType.parameter(codecs); | 221 String contentTypeCodecs = contentType.parameter(codecs); |
222 | 222 |
223 // If the MIME type is missing or is not meaningful, try to figure it out fr
om the URL. | 223 // If the MIME type is missing or is not meaningful, try to figure it out fr
om the URL. |
224 if (contentMIMEType.isEmpty() || contentMIMEType == "application/octet-strea
m" || contentMIMEType == "text/plain") { | 224 if (contentMIMEType.isEmpty() || contentMIMEType == "application/octet-strea
m" || contentMIMEType == "text/plain") { |
225 if (url.protocolIsData()) | 225 if (url.protocolIsData()) |
226 contentMIMEType = mimeTypeFromDataURL(url.string()); | 226 contentMIMEType = mimeTypeFromDataURL(url.string()); |
227 } | 227 } |
228 | 228 |
229 // If no MIME type is specified, always attempt to load. | 229 // If no MIME type is specified, always attempt to load. |
230 if (contentMIMEType.isEmpty()) | 230 if (contentMIMEType.isEmpty()) |
231 return true; | 231 return true; |
232 | 232 |
233 // 4.8.10.3 MIME types - In the absence of a specification to the contrary,
the MIME type "application/octet-stream" | 233 // 4.8.10.3 MIME types - In the absence of a specification to the contrary,
the MIME type "application/octet-stream" |
234 // when used with parameters, e.g. "application/octet-stream;codecs=theora",
is a type that the user agent knows | 234 // when used with parameters, e.g. "application/octet-stream;codecs=theora",
is a type that the user agent knows |
235 // it cannot render. | 235 // it cannot render. |
236 if (contentMIMEType != "application/octet-stream" || contentTypeCodecs.isEmp
ty()) { | 236 if (contentMIMEType != "application/octet-stream" || contentTypeCodecs.isEmp
ty()) { |
237 WebMimeRegistry::SupportsType supported = Platform::current()->mimeRegis
try()->supportsMediaMIMEType(contentMIMEType, contentTypeCodecs, keySystem.lower
()); | 237 WebMimeRegistry::SupportsType supported = Platform::current()->mimeRegis
try()->supportsMediaMIMEType(contentMIMEType, contentTypeCodecs, String()); |
238 return supported > WebMimeRegistry::IsNotSupported; | 238 return supported > WebMimeRegistry::IsNotSupported; |
239 } | 239 } |
240 | 240 |
241 return false; | 241 return false; |
242 } | 242 } |
243 | 243 |
244 void HTMLMediaElement::recordAutoplayMetric(AutoplayMetrics metric) | 244 void HTMLMediaElement::recordAutoplayMetric(AutoplayMetrics metric) |
245 { | 245 { |
246 DEFINE_STATIC_LOCAL(EnumerationHistogram, autoplayHistogram, ("Blink.MediaEl
ement.Autoplay", NumberOfAutoplayMetrics)); | 246 DEFINE_STATIC_LOCAL(EnumerationHistogram, autoplayHistogram, ("Blink.MediaEl
ement.Autoplay", NumberOfAutoplayMetrics)); |
247 autoplayHistogram.count(metric); | 247 autoplayHistogram.count(metric); |
248 } | 248 } |
249 | 249 |
250 WebMimeRegistry::SupportsType HTMLMediaElement::supportsType(const ContentType&
contentType, const String& keySystem) | 250 WebMimeRegistry::SupportsType HTMLMediaElement::supportsType(const ContentType&
contentType) |
251 { | 251 { |
252 DEFINE_STATIC_LOCAL(const String, codecs, ("codecs")); | 252 DEFINE_STATIC_LOCAL(const String, codecs, ("codecs")); |
253 | 253 |
254 if (!RuntimeEnabledFeatures::mediaEnabled()) | 254 if (!RuntimeEnabledFeatures::mediaEnabled()) |
255 return WebMimeRegistry::IsNotSupported; | 255 return WebMimeRegistry::IsNotSupported; |
256 | 256 |
257 String type = contentType.type().lower(); | 257 String type = contentType.type().lower(); |
258 // The codecs string is not lower-cased because MP4 values are case sensitiv
e | 258 // The codecs string is not lower-cased because MP4 values are case sensitiv
e |
259 // per http://tools.ietf.org/html/rfc4281#page-7. | 259 // per http://tools.ietf.org/html/rfc4281#page-7. |
260 String typeCodecs = contentType.parameter(codecs); | 260 String typeCodecs = contentType.parameter(codecs); |
261 String system = keySystem.lower(); | |
262 | 261 |
263 if (type.isEmpty()) | 262 if (type.isEmpty()) |
264 return WebMimeRegistry::IsNotSupported; | 263 return WebMimeRegistry::IsNotSupported; |
265 | 264 |
266 // 4.8.10.3 MIME types - The canPlayType(type) method must return the empty
string if type is a type that the | 265 // 4.8.10.3 MIME types - The canPlayType(type) method must return the empty
string if type is a type that the |
267 // user agent knows it cannot render or is the type "application/octet-strea
m" | 266 // user agent knows it cannot render or is the type "application/octet-strea
m" |
268 if (type == "application/octet-stream") | 267 if (type == "application/octet-stream") |
269 return WebMimeRegistry::IsNotSupported; | 268 return WebMimeRegistry::IsNotSupported; |
270 | 269 |
271 return Platform::current()->mimeRegistry()->supportsMediaMIMEType(type, type
Codecs, system); | 270 return Platform::current()->mimeRegistry()->supportsMediaMIMEType(type, type
Codecs, String()); |
272 } | 271 } |
273 | 272 |
274 URLRegistry* HTMLMediaElement::s_mediaStreamRegistry = 0; | 273 URLRegistry* HTMLMediaElement::s_mediaStreamRegistry = 0; |
275 | 274 |
276 void HTMLMediaElement::setMediaStreamRegistry(URLRegistry* registry) | 275 void HTMLMediaElement::setMediaStreamRegistry(URLRegistry* registry) |
277 { | 276 { |
278 ASSERT(!s_mediaStreamRegistry); | 277 ASSERT(!s_mediaStreamRegistry); |
279 s_mediaStreamRegistry = registry; | 278 s_mediaStreamRegistry = registry; |
280 } | 279 } |
281 | 280 |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 void HTMLMediaElement::setSrc(const AtomicString& url) | 628 void HTMLMediaElement::setSrc(const AtomicString& url) |
630 { | 629 { |
631 setAttribute(srcAttr, url); | 630 setAttribute(srcAttr, url); |
632 } | 631 } |
633 | 632 |
634 HTMLMediaElement::NetworkState HTMLMediaElement::networkState() const | 633 HTMLMediaElement::NetworkState HTMLMediaElement::networkState() const |
635 { | 634 { |
636 return m_networkState; | 635 return m_networkState; |
637 } | 636 } |
638 | 637 |
639 String HTMLMediaElement::canPlayType(const String& mimeType, const String& keySy
stem) const | 638 String HTMLMediaElement::canPlayType(const String& mimeType) const |
640 { | 639 { |
641 WebMimeRegistry::SupportsType support = supportsType(ContentType(mimeType),
keySystem); | 640 WebMimeRegistry::SupportsType support = supportsType(ContentType(mimeType)); |
642 String canPlay; | 641 String canPlay; |
643 | 642 |
644 // 4.8.10.3 | 643 // 4.8.10.3 |
645 switch (support) { | 644 switch (support) { |
646 case WebMimeRegistry::IsNotSupported: | 645 case WebMimeRegistry::IsNotSupported: |
647 canPlay = emptyString(); | 646 canPlay = emptyString(); |
648 break; | 647 break; |
649 case WebMimeRegistry::MayBeSupported: | 648 case WebMimeRegistry::MayBeSupported: |
650 canPlay = "maybe"; | 649 canPlay = "maybe"; |
651 break; | 650 break; |
652 case WebMimeRegistry::IsSupported: | 651 case WebMimeRegistry::IsSupported: |
653 canPlay = "probably"; | 652 canPlay = "probably"; |
654 break; | 653 break; |
655 } | 654 } |
656 | 655 |
657 WTF_LOG(Media, "HTMLMediaElement::canPlayType(%p, %s, %s) -> %s", this, mime
Type.utf8().data(), keySystem.utf8().data(), canPlay.utf8().data()); | 656 WTF_LOG(Media, "HTMLMediaElement::canPlayType(%p, %s) -> %s", this, mimeType
.utf8().data(), canPlay.utf8().data()); |
658 | 657 |
659 return canPlay; | 658 return canPlay; |
660 } | 659 } |
661 | 660 |
662 void HTMLMediaElement::recordMetricsIfPausing() | 661 void HTMLMediaElement::recordMetricsIfPausing() |
663 { | 662 { |
664 // If not playing, then nothing to record. | 663 // If not playing, then nothing to record. |
665 // TODO(liberato): test metrics. this was m_paused. | 664 // TODO(liberato): test metrics. this was m_paused. |
666 if (m_paused) | 665 if (m_paused) |
667 return; | 666 return; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); | 868 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); |
870 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), empty 'sr
c'", this); | 869 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), empty 'sr
c'", this); |
871 return; | 870 return; |
872 } | 871 } |
873 | 872 |
874 if (!isSafeToLoadURL(mediaURL, Complain)) { | 873 if (!isSafeToLoadURL(mediaURL, Complain)) { |
875 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); | 874 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); |
876 return; | 875 return; |
877 } | 876 } |
878 | 877 |
879 // No type or key system information is available when the url comes | 878 // No type is available when the url comes from the 'src' attribute so M
ediaPlayer |
880 // from the 'src' attribute so MediaPlayer | |
881 // will have to pick a media engine based on the file extension. | 879 // will have to pick a media engine based on the file extension. |
882 ContentType contentType((String())); | 880 ContentType contentType((String())); |
883 loadResource(mediaURL, contentType, String()); | 881 loadResource(mediaURL, contentType); |
884 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), using 'src' a
ttribute url", this); | 882 WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), using 'src' a
ttribute url", this); |
885 return; | 883 return; |
886 } | 884 } |
887 | 885 |
888 // Otherwise, the source elements will be used | 886 // Otherwise, the source elements will be used |
889 loadNextSourceChild(); | 887 loadNextSourceChild(); |
890 } | 888 } |
891 | 889 |
892 void HTMLMediaElement::loadNextSourceChild() | 890 void HTMLMediaElement::loadNextSourceChild() |
893 { | 891 { |
894 ContentType contentType((String())); | 892 ContentType contentType((String())); |
895 String keySystem; | 893 KURL mediaURL = selectNextSourceChild(&contentType, Complain); |
896 KURL mediaURL = selectNextSourceChild(&contentType, &keySystem, Complain); | |
897 if (!mediaURL.isValid()) { | 894 if (!mediaURL.isValid()) { |
898 waitForSourceChange(); | 895 waitForSourceChange(); |
899 return; | 896 return; |
900 } | 897 } |
901 | 898 |
902 // Reset the MediaPlayer and MediaSource if any | 899 // Reset the MediaPlayer and MediaSource if any |
903 resetMediaPlayerAndMediaSource(); | 900 resetMediaPlayerAndMediaSource(); |
904 | 901 |
905 m_loadState = LoadingFromSourceElement; | 902 m_loadState = LoadingFromSourceElement; |
906 loadResource(mediaURL, contentType, keySystem); | 903 loadResource(mediaURL, contentType); |
907 } | 904 } |
908 | 905 |
909 void HTMLMediaElement::loadResource(const KURL& url, ContentType& contentType, c
onst String& keySystem) | 906 void HTMLMediaElement::loadResource(const KURL& url, ContentType& contentType) |
910 { | 907 { |
911 ASSERT(isMainThread()); | 908 ASSERT(isMainThread()); |
912 ASSERT(isSafeToLoadURL(url, Complain)); | 909 ASSERT(isSafeToLoadURL(url, Complain)); |
913 | 910 |
914 WTF_LOG(Media, "HTMLMediaElement::loadResource(%p, %s, %s, %s)", this, urlFo
rLoggingMedia(url).utf8().data(), contentType.raw().utf8().data(), keySystem.utf
8().data()); | 911 WTF_LOG(Media, "HTMLMediaElement::loadResource(%p, %s, %s)", this, urlForLog
gingMedia(url).utf8().data(), contentType.raw().utf8().data()); |
915 | 912 |
916 LocalFrame* frame = document().frame(); | 913 LocalFrame* frame = document().frame(); |
917 if (!frame) { | 914 if (!frame) { |
918 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); | 915 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); |
919 return; | 916 return; |
920 } | 917 } |
921 | 918 |
922 // The resource fetch algorithm | 919 // The resource fetch algorithm |
923 setNetworkState(NETWORK_LOADING); | 920 setNetworkState(NETWORK_LOADING); |
924 | 921 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 if (!m_mediaSource->attachToElement(this)) { | 953 if (!m_mediaSource->attachToElement(this)) { |
957 // Forget our reference to the MediaSource, so we leave it a
lone | 954 // Forget our reference to the MediaSource, so we leave it a
lone |
958 // while processing remainder of load failure. | 955 // while processing remainder of load failure. |
959 m_mediaSource = nullptr; | 956 m_mediaSource = nullptr; |
960 attemptLoad = false; | 957 attemptLoad = false; |
961 } | 958 } |
962 } | 959 } |
963 } | 960 } |
964 } | 961 } |
965 | 962 |
966 if (attemptLoad && canLoadURL(url, contentType, keySystem)) { | 963 if (attemptLoad && canLoadURL(url, contentType)) { |
967 ASSERT(!webMediaPlayer()); | 964 ASSERT(!webMediaPlayer()); |
968 | 965 |
969 if (!m_havePreparedToPlay && effectivePreloadType() == WebMediaPlayer::P
reloadNone) { | 966 if (!m_havePreparedToPlay && effectivePreloadType() == WebMediaPlayer::P
reloadNone) { |
970 WTF_LOG(Media, "HTMLMediaElement::loadResource(%p) : Delaying load b
ecause preload == 'none'", this); | 967 WTF_LOG(Media, "HTMLMediaElement::loadResource(%p) : Delaying load b
ecause preload == 'none'", this); |
971 deferLoad(); | 968 deferLoad(); |
972 } else { | 969 } else { |
973 startPlayerLoad(); | 970 startPlayerLoad(); |
974 } | 971 } |
975 } else { | 972 } else { |
976 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); | 973 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); |
(...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2512 textTracksChanged(); | 2509 textTracksChanged(); |
2513 } | 2510 } |
2514 | 2511 |
2515 bool HTMLMediaElement::havePotentialSourceChild() | 2512 bool HTMLMediaElement::havePotentialSourceChild() |
2516 { | 2513 { |
2517 // Stash the current <source> node and next nodes so we can restore them aft
er checking | 2514 // Stash the current <source> node and next nodes so we can restore them aft
er checking |
2518 // to see there is another potential. | 2515 // to see there is another potential. |
2519 RefPtrWillBeRawPtr<HTMLSourceElement> currentSourceNode = m_currentSourceNod
e; | 2516 RefPtrWillBeRawPtr<HTMLSourceElement> currentSourceNode = m_currentSourceNod
e; |
2520 RefPtrWillBeRawPtr<Node> nextNode = m_nextChildNodeToConsider; | 2517 RefPtrWillBeRawPtr<Node> nextNode = m_nextChildNodeToConsider; |
2521 | 2518 |
2522 KURL nextURL = selectNextSourceChild(0, 0, DoNothing); | 2519 KURL nextURL = selectNextSourceChild(0, DoNothing); |
2523 | 2520 |
2524 m_currentSourceNode = currentSourceNode; | 2521 m_currentSourceNode = currentSourceNode; |
2525 m_nextChildNodeToConsider = nextNode; | 2522 m_nextChildNodeToConsider = nextNode; |
2526 | 2523 |
2527 return nextURL.isValid(); | 2524 return nextURL.isValid(); |
2528 } | 2525 } |
2529 | 2526 |
2530 KURL HTMLMediaElement::selectNextSourceChild(ContentType* contentType, String* k
eySystem, InvalidURLAction actionIfInvalid) | 2527 KURL HTMLMediaElement::selectNextSourceChild(ContentType* contentType, InvalidUR
LAction actionIfInvalid) |
2531 { | 2528 { |
2532 #if !LOG_DISABLED | 2529 #if !LOG_DISABLED |
2533 // Don't log if this was just called to find out if there are any valid <sou
rce> elements. | 2530 // Don't log if this was just called to find out if there are any valid <sou
rce> elements. |
2534 bool shouldLog = actionIfInvalid != DoNothing; | 2531 bool shouldLog = actionIfInvalid != DoNothing; |
2535 if (shouldLog) | 2532 if (shouldLog) |
2536 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p)", this); | 2533 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p)", this); |
2537 #endif | 2534 #endif |
2538 | 2535 |
2539 if (!m_nextChildNodeToConsider) { | 2536 if (!m_nextChildNodeToConsider) { |
2540 #if !LOG_DISABLED | 2537 #if !LOG_DISABLED |
2541 if (shouldLog) | 2538 if (shouldLog) |
2542 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p) -> 0x000
0, \"\"", this); | 2539 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p) -> 0x000
0, \"\"", this); |
2543 #endif | 2540 #endif |
2544 return KURL(); | 2541 return KURL(); |
2545 } | 2542 } |
2546 | 2543 |
2547 KURL mediaURL; | 2544 KURL mediaURL; |
2548 Node* node; | 2545 Node* node; |
2549 HTMLSourceElement* source = 0; | 2546 HTMLSourceElement* source = 0; |
2550 String type; | 2547 String type; |
2551 String system; | |
2552 bool lookingForStartNode = m_nextChildNodeToConsider; | 2548 bool lookingForStartNode = m_nextChildNodeToConsider; |
2553 bool canUseSourceElement = false; | 2549 bool canUseSourceElement = false; |
2554 | 2550 |
2555 NodeVector potentialSourceNodes; | 2551 NodeVector potentialSourceNodes; |
2556 getChildNodes(*this, potentialSourceNodes); | 2552 getChildNodes(*this, potentialSourceNodes); |
2557 | 2553 |
2558 for (unsigned i = 0; !canUseSourceElement && i < potentialSourceNodes.size()
; ++i) { | 2554 for (unsigned i = 0; !canUseSourceElement && i < potentialSourceNodes.size()
; ++i) { |
2559 node = potentialSourceNodes[i].get(); | 2555 node = potentialSourceNodes[i].get(); |
2560 if (lookingForStartNode && m_nextChildNodeToConsider != node) | 2556 if (lookingForStartNode && m_nextChildNodeToConsider != node) |
2561 continue; | 2557 continue; |
2562 lookingForStartNode = false; | 2558 lookingForStartNode = false; |
2563 | 2559 |
2564 if (!isHTMLSourceElement(*node)) | 2560 if (!isHTMLSourceElement(*node)) |
2565 continue; | 2561 continue; |
2566 if (node->parentNode() != this) | 2562 if (node->parentNode() != this) |
2567 continue; | 2563 continue; |
2568 | 2564 |
2569 source = toHTMLSourceElement(node); | 2565 source = toHTMLSourceElement(node); |
2570 | 2566 |
2571 // If candidate does not have a src attribute, or if its src attribute's
value is the empty string ... jump down to the failed step below | 2567 // If candidate does not have a src attribute, or if its src attribute's
value is the empty string ... jump down to the failed step below |
2572 mediaURL = source->getNonEmptyURLAttribute(srcAttr); | 2568 mediaURL = source->getNonEmptyURLAttribute(srcAttr); |
2573 #if !LOG_DISABLED | 2569 #if !LOG_DISABLED |
2574 if (shouldLog) | 2570 if (shouldLog) |
2575 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p) - 'src'
is %s", this, urlForLoggingMedia(mediaURL).utf8().data()); | 2571 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p) - 'src'
is %s", this, urlForLoggingMedia(mediaURL).utf8().data()); |
2576 #endif | 2572 #endif |
2577 if (mediaURL.isEmpty()) | 2573 if (mediaURL.isEmpty()) |
2578 goto checkAgain; | 2574 goto checkAgain; |
2579 | 2575 |
2580 type = source->type(); | 2576 type = source->type(); |
2581 // FIXME(82965): Add support for keySystem in <source> and set system fr
om source. | |
2582 if (type.isEmpty() && mediaURL.protocolIsData()) | 2577 if (type.isEmpty() && mediaURL.protocolIsData()) |
2583 type = mimeTypeFromDataURL(mediaURL); | 2578 type = mimeTypeFromDataURL(mediaURL); |
2584 if (!type.isEmpty() || !system.isEmpty()) { | 2579 if (!type.isEmpty()) { |
2585 #if !LOG_DISABLED | 2580 #if !LOG_DISABLED |
2586 if (shouldLog) | 2581 if (shouldLog) |
2587 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p) - 't
ype' is '%s' - key system is '%s'", this, type.utf8().data(), system.utf8().data
()); | 2582 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p) - 't
ype' is '%s'", this, type.utf8().data()); |
2588 #endif | 2583 #endif |
2589 if (!supportsType(ContentType(type), system)) | 2584 if (!supportsType(ContentType(type))) |
2590 goto checkAgain; | 2585 goto checkAgain; |
2591 } | 2586 } |
2592 | 2587 |
2593 // Is it safe to load this url? | 2588 // Is it safe to load this url? |
2594 if (!isSafeToLoadURL(mediaURL, actionIfInvalid)) | 2589 if (!isSafeToLoadURL(mediaURL, actionIfInvalid)) |
2595 goto checkAgain; | 2590 goto checkAgain; |
2596 | 2591 |
2597 // Making it this far means the <source> looks reasonable. | 2592 // Making it this far means the <source> looks reasonable. |
2598 canUseSourceElement = true; | 2593 canUseSourceElement = true; |
2599 | 2594 |
2600 checkAgain: | 2595 checkAgain: |
2601 if (!canUseSourceElement && actionIfInvalid == Complain && source) | 2596 if (!canUseSourceElement && actionIfInvalid == Complain && source) |
2602 source->scheduleErrorEvent(); | 2597 source->scheduleErrorEvent(); |
2603 } | 2598 } |
2604 | 2599 |
2605 if (canUseSourceElement) { | 2600 if (canUseSourceElement) { |
2606 if (contentType) | 2601 if (contentType) |
2607 *contentType = ContentType(type); | 2602 *contentType = ContentType(type); |
2608 if (keySystem) | |
2609 *keySystem = system; | |
2610 m_currentSourceNode = source; | 2603 m_currentSourceNode = source; |
2611 m_nextChildNodeToConsider = source->nextSibling(); | 2604 m_nextChildNodeToConsider = source->nextSibling(); |
2612 } else { | 2605 } else { |
2613 m_currentSourceNode = nullptr; | 2606 m_currentSourceNode = nullptr; |
2614 m_nextChildNodeToConsider = nullptr; | 2607 m_nextChildNodeToConsider = nullptr; |
2615 } | 2608 } |
2616 | 2609 |
2617 #if !LOG_DISABLED | 2610 #if !LOG_DISABLED |
2618 if (shouldLog) | 2611 if (shouldLog) |
2619 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p) -> %p, %s",
this, m_currentSourceNode.get(), canUseSourceElement ? urlForLoggingMedia(mediaU
RL).utf8().data() : ""); | 2612 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p) -> %p, %s",
this, m_currentSourceNode.get(), canUseSourceElement ? urlForLoggingMedia(mediaU
RL).utf8().data() : ""); |
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3631 { | 3624 { |
3632 visitor->trace(m_client); | 3625 visitor->trace(m_client); |
3633 } | 3626 } |
3634 | 3627 |
3635 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) | 3628 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) |
3636 { | 3629 { |
3637 visitor->trace(m_client); | 3630 visitor->trace(m_client); |
3638 } | 3631 } |
3639 | 3632 |
3640 } // namespace blink | 3633 } // namespace blink |
OLD | NEW |