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