| 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 , m_haveVisibleTextTrack(false) | 295 , m_haveVisibleTextTrack(false) |
| 296 , m_processingPreferenceChange(false) | 296 , m_processingPreferenceChange(false) |
| 297 , m_lastTextTrackUpdateTime(-1) | 297 , m_lastTextTrackUpdateTime(-1) |
| 298 , m_textTracks(0) | 298 , m_textTracks(0) |
| 299 , m_ignoreTrackDisplayUpdate(0) | 299 , m_ignoreTrackDisplayUpdate(0) |
| 300 #endif | 300 #endif |
| 301 #if ENABLE(WEB_AUDIO) | 301 #if ENABLE(WEB_AUDIO) |
| 302 , m_audioSourceNode(0) | 302 , m_audioSourceNode(0) |
| 303 #endif | 303 #endif |
| 304 { | 304 { |
| 305 LOG(Media, "HTMLMediaElement::HTMLMediaElement"); | 305 LOG_INFO(Media, "HTMLMediaElement::HTMLMediaElement"); |
| 306 document->registerForMediaVolumeCallbacks(this); | 306 document->registerForMediaVolumeCallbacks(this); |
| 307 document->registerForPrivateBrowsingStateChangedCallbacks(this); | 307 document->registerForPrivateBrowsingStateChangedCallbacks(this); |
| 308 | 308 |
| 309 if (document->settings() && document->settings()->mediaPlaybackRequiresUserG
esture()) { | 309 if (document->settings() && document->settings()->mediaPlaybackRequiresUserG
esture()) { |
| 310 addBehaviorRestriction(RequireUserGestureForRateChangeRestriction); | 310 addBehaviorRestriction(RequireUserGestureForRateChangeRestriction); |
| 311 addBehaviorRestriction(RequireUserGestureForLoadRestriction); | 311 addBehaviorRestriction(RequireUserGestureForLoadRestriction); |
| 312 } | 312 } |
| 313 | 313 |
| 314 setHasCustomStyleCallbacks(); | 314 setHasCustomStyleCallbacks(); |
| 315 addElementToDocumentMap(this, document); | 315 addElementToDocumentMap(this, document); |
| 316 | 316 |
| 317 #if ENABLE(VIDEO_TRACK) | 317 #if ENABLE(VIDEO_TRACK) |
| 318 document->registerForCaptionPreferencesChangedCallbacks(this); | 318 document->registerForCaptionPreferencesChangedCallbacks(this); |
| 319 #endif | 319 #endif |
| 320 } | 320 } |
| 321 | 321 |
| 322 HTMLMediaElement::~HTMLMediaElement() | 322 HTMLMediaElement::~HTMLMediaElement() |
| 323 { | 323 { |
| 324 LOG(Media, "HTMLMediaElement::~HTMLMediaElement"); | 324 LOG_INFO(Media, "HTMLMediaElement::~HTMLMediaElement"); |
| 325 if (m_isWaitingUntilMediaCanStart) | 325 if (m_isWaitingUntilMediaCanStart) |
| 326 document()->removeMediaCanStartListener(this); | 326 document()->removeMediaCanStartListener(this); |
| 327 setShouldDelayLoadEvent(false); | 327 setShouldDelayLoadEvent(false); |
| 328 document()->unregisterForMediaVolumeCallbacks(this); | 328 document()->unregisterForMediaVolumeCallbacks(this); |
| 329 document()->unregisterForPrivateBrowsingStateChangedCallbacks(this); | 329 document()->unregisterForPrivateBrowsingStateChangedCallbacks(this); |
| 330 #if ENABLE(VIDEO_TRACK) | 330 #if ENABLE(VIDEO_TRACK) |
| 331 document()->unregisterForCaptionPreferencesChangedCallbacks(this); | 331 document()->unregisterForCaptionPreferencesChangedCallbacks(this); |
| 332 if (m_textTracks) | 332 if (m_textTracks) |
| 333 m_textTracks->clearOwner(); | 333 m_textTracks->clearOwner(); |
| 334 if (m_textTracks) { | 334 if (m_textTracks) { |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 // <media> doesn't allow its content, including shadow subtree, to | 544 // <media> doesn't allow its content, including shadow subtree, to |
| 545 // be rendered. So this should return false for most of the children. | 545 // be rendered. So this should return false for most of the children. |
| 546 // One exception is a shadow tree built for rendering controls which should
be visible. | 546 // One exception is a shadow tree built for rendering controls which should
be visible. |
| 547 // So we let them go here by comparing its subtree root with one of the cont
rols. | 547 // So we let them go here by comparing its subtree root with one of the cont
rols. |
| 548 return (mediaControls()->treeScope() == childContext.node()->treeScope() | 548 return (mediaControls()->treeScope() == childContext.node()->treeScope() |
| 549 && childContext.isOnUpperEncapsulationBoundary() && HTMLElement::chi
ldShouldCreateRenderer(childContext)); | 549 && childContext.isOnUpperEncapsulationBoundary() && HTMLElement::chi
ldShouldCreateRenderer(childContext)); |
| 550 } | 550 } |
| 551 | 551 |
| 552 Node::InsertionNotificationRequest HTMLMediaElement::insertedInto(ContainerNode*
insertionPoint) | 552 Node::InsertionNotificationRequest HTMLMediaElement::insertedInto(ContainerNode*
insertionPoint) |
| 553 { | 553 { |
| 554 LOG(Media, "HTMLMediaElement::insertedInto"); | 554 LOG_INFO(Media, "HTMLMediaElement::insertedInto"); |
| 555 HTMLElement::insertedInto(insertionPoint); | 555 HTMLElement::insertedInto(insertionPoint); |
| 556 if (insertionPoint->inDocument() && !getAttribute(srcAttr).isEmpty() && m_ne
tworkState == NETWORK_EMPTY) | 556 if (insertionPoint->inDocument() && !getAttribute(srcAttr).isEmpty() && m_ne
tworkState == NETWORK_EMPTY) |
| 557 scheduleDelayedAction(LoadMediaResource); | 557 scheduleDelayedAction(LoadMediaResource); |
| 558 configureMediaControls(); | 558 configureMediaControls(); |
| 559 return InsertionDone; | 559 return InsertionDone; |
| 560 } | 560 } |
| 561 | 561 |
| 562 void HTMLMediaElement::removedFrom(ContainerNode* insertionPoint) | 562 void HTMLMediaElement::removedFrom(ContainerNode* insertionPoint) |
| 563 { | 563 { |
| 564 if (insertionPoint->inDocument()) { | 564 if (insertionPoint->inDocument()) { |
| 565 LOG(Media, "HTMLMediaElement::removedFromDocument"); | 565 LOG_INFO(Media, "HTMLMediaElement::removedFromDocument"); |
| 566 configureMediaControls(); | 566 configureMediaControls(); |
| 567 if (m_networkState > NETWORK_EMPTY) | 567 if (m_networkState > NETWORK_EMPTY) |
| 568 pause(); | 568 pause(); |
| 569 if (m_isFullscreen) | 569 if (m_isFullscreen) |
| 570 exitFullscreen(); | 570 exitFullscreen(); |
| 571 } | 571 } |
| 572 | 572 |
| 573 HTMLElement::removedFrom(insertionPoint); | 573 HTMLElement::removedFrom(insertionPoint); |
| 574 } | 574 } |
| 575 | 575 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 594 } | 594 } |
| 595 | 595 |
| 596 void HTMLMediaElement::didRecalcStyle(StyleChange) | 596 void HTMLMediaElement::didRecalcStyle(StyleChange) |
| 597 { | 597 { |
| 598 if (renderer()) | 598 if (renderer()) |
| 599 renderer()->updateFromElement(); | 599 renderer()->updateFromElement(); |
| 600 } | 600 } |
| 601 | 601 |
| 602 void HTMLMediaElement::scheduleDelayedAction(DelayedActionType actionType) | 602 void HTMLMediaElement::scheduleDelayedAction(DelayedActionType actionType) |
| 603 { | 603 { |
| 604 LOG(Media, "HTMLMediaElement::scheduleLoad"); | 604 LOG_INFO(Media, "HTMLMediaElement::scheduleLoad"); |
| 605 | 605 |
| 606 if ((actionType & LoadMediaResource) && !(m_pendingActionFlags & LoadMediaRe
source)) { | 606 if ((actionType & LoadMediaResource) && !(m_pendingActionFlags & LoadMediaRe
source)) { |
| 607 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) | 607 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) |
| 608 createMediaPlayerProxy(); | 608 createMediaPlayerProxy(); |
| 609 #endif | 609 #endif |
| 610 | 610 |
| 611 prepareForLoad(); | 611 prepareForLoad(); |
| 612 m_pendingActionFlags |= LoadMediaResource; | 612 m_pendingActionFlags |= LoadMediaResource; |
| 613 } | 613 } |
| 614 | 614 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 629 void HTMLMediaElement::scheduleNextSourceChild() | 629 void HTMLMediaElement::scheduleNextSourceChild() |
| 630 { | 630 { |
| 631 // Schedule the timer to try the next <source> element WITHOUT resetting sta
te ala prepareForLoad. | 631 // Schedule the timer to try the next <source> element WITHOUT resetting sta
te ala prepareForLoad. |
| 632 m_pendingActionFlags |= LoadMediaResource; | 632 m_pendingActionFlags |= LoadMediaResource; |
| 633 m_loadTimer.startOneShot(0); | 633 m_loadTimer.startOneShot(0); |
| 634 } | 634 } |
| 635 | 635 |
| 636 void HTMLMediaElement::scheduleEvent(const AtomicString& eventName) | 636 void HTMLMediaElement::scheduleEvent(const AtomicString& eventName) |
| 637 { | 637 { |
| 638 #if LOG_MEDIA_EVENTS | 638 #if LOG_MEDIA_EVENTS |
| 639 LOG(Media, "HTMLMediaElement::scheduleEvent - scheduling '%s'", eventName.st
ring().ascii().data()); | 639 LOG_INFO(Media, "HTMLMediaElement::scheduleEvent - scheduling '%s'", eventNa
me.string().ascii().data()); |
| 640 #endif | 640 #endif |
| 641 RefPtr<Event> event = Event::create(eventName, false, true); | 641 RefPtr<Event> event = Event::create(eventName, false, true); |
| 642 event->setTarget(this); | 642 event->setTarget(this); |
| 643 | 643 |
| 644 m_asyncEventQueue->enqueueEvent(event.release()); | 644 m_asyncEventQueue->enqueueEvent(event.release()); |
| 645 } | 645 } |
| 646 | 646 |
| 647 void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*) | 647 void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*) |
| 648 { | 648 { |
| 649 RefPtr<HTMLMediaElement> protect(this); // loadNextSourceChild may fire 'bef
oreload', which can make arbitrary DOM mutations. | 649 RefPtr<HTMLMediaElement> protect(this); // loadNextSourceChild may fire 'bef
oreload', which can make arbitrary DOM mutations. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 canPlay = emptyString(); | 695 canPlay = emptyString(); |
| 696 break; | 696 break; |
| 697 case MediaPlayer::MayBeSupported: | 697 case MediaPlayer::MayBeSupported: |
| 698 canPlay = ASCIILiteral("maybe"); | 698 canPlay = ASCIILiteral("maybe"); |
| 699 break; | 699 break; |
| 700 case MediaPlayer::IsSupported: | 700 case MediaPlayer::IsSupported: |
| 701 canPlay = ASCIILiteral("probably"); | 701 canPlay = ASCIILiteral("probably"); |
| 702 break; | 702 break; |
| 703 } | 703 } |
| 704 | 704 |
| 705 LOG(Media, "HTMLMediaElement::canPlayType(%s, %s, %s) -> %s", mimeType.utf8(
).data(), keySystem.utf8().data(), url.elidedString().utf8().data(), canPlay.utf
8().data()); | 705 LOG_INFO(Media, "HTMLMediaElement::canPlayType(%s, %s, %s) -> %s", mimeType.
utf8().data(), keySystem.utf8().data(), url.elidedString().utf8().data(), canPla
y.utf8().data()); |
| 706 | 706 |
| 707 return canPlay; | 707 return canPlay; |
| 708 } | 708 } |
| 709 | 709 |
| 710 void HTMLMediaElement::load() | 710 void HTMLMediaElement::load() |
| 711 { | 711 { |
| 712 RefPtr<HTMLMediaElement> protect(this); // loadInternal may result in a 'bef
oreload' event, which can make arbitrary DOM mutations. | 712 RefPtr<HTMLMediaElement> protect(this); // loadInternal may result in a 'bef
oreload' event, which can make arbitrary DOM mutations. |
| 713 | 713 |
| 714 LOG(Media, "HTMLMediaElement::load()"); | 714 LOG_INFO(Media, "HTMLMediaElement::load()"); |
| 715 | 715 |
| 716 if (userGestureRequiredForLoad() && !ScriptController::processingUserGesture
()) | 716 if (userGestureRequiredForLoad() && !ScriptController::processingUserGesture
()) |
| 717 return; | 717 return; |
| 718 | 718 |
| 719 m_loadInitiatedByUserGesture = ScriptController::processingUserGesture(); | 719 m_loadInitiatedByUserGesture = ScriptController::processingUserGesture(); |
| 720 if (m_loadInitiatedByUserGesture) | 720 if (m_loadInitiatedByUserGesture) |
| 721 removeBehaviorsRestrictionsAfterFirstUserGesture(); | 721 removeBehaviorsRestrictionsAfterFirstUserGesture(); |
| 722 prepareForLoad(); | 722 prepareForLoad(); |
| 723 loadInternal(); | 723 loadInternal(); |
| 724 prepareToPlay(); | 724 prepareToPlay(); |
| 725 } | 725 } |
| 726 | 726 |
| 727 void HTMLMediaElement::prepareForLoad() | 727 void HTMLMediaElement::prepareForLoad() |
| 728 { | 728 { |
| 729 LOG(Media, "HTMLMediaElement::prepareForLoad"); | 729 LOG_INFO(Media, "HTMLMediaElement::prepareForLoad"); |
| 730 | 730 |
| 731 // Perform the cleanup required for the resource load algorithm to run. | 731 // Perform the cleanup required for the resource load algorithm to run. |
| 732 stopPeriodicTimers(); | 732 stopPeriodicTimers(); |
| 733 m_loadTimer.stop(); | 733 m_loadTimer.stop(); |
| 734 m_sentEndEvent = false; | 734 m_sentEndEvent = false; |
| 735 m_sentStalledEvent = false; | 735 m_sentStalledEvent = false; |
| 736 m_haveFiredLoadedData = false; | 736 m_haveFiredLoadedData = false; |
| 737 m_completelyLoaded = false; | 737 m_completelyLoaded = false; |
| 738 m_havePreparedToPlay = false; | 738 m_havePreparedToPlay = false; |
| 739 m_displayMode = Unknown; | 739 m_displayMode = Unknown; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 } | 845 } |
| 846 } | 846 } |
| 847 } | 847 } |
| 848 #endif | 848 #endif |
| 849 | 849 |
| 850 selectMediaResource(); | 850 selectMediaResource(); |
| 851 } | 851 } |
| 852 | 852 |
| 853 void HTMLMediaElement::selectMediaResource() | 853 void HTMLMediaElement::selectMediaResource() |
| 854 { | 854 { |
| 855 LOG(Media, "HTMLMediaElement::selectMediaResource"); | 855 LOG_INFO(Media, "HTMLMediaElement::selectMediaResource"); |
| 856 | 856 |
| 857 enum Mode { attribute, children }; | 857 enum Mode { attribute, children }; |
| 858 | 858 |
| 859 // 3 - If the media element has a src attribute, then let mode be attribute. | 859 // 3 - If the media element has a src attribute, then let mode be attribute. |
| 860 Mode mode = attribute; | 860 Mode mode = attribute; |
| 861 if (!fastHasAttribute(srcAttr)) { | 861 if (!fastHasAttribute(srcAttr)) { |
| 862 Node* node; | 862 Node* node; |
| 863 for (node = firstChild(); node; node = node->nextSibling()) { | 863 for (node = firstChild(); node; node = node->nextSibling()) { |
| 864 if (node->hasTagName(sourceTag)) | 864 if (node->hasTagName(sourceTag)) |
| 865 break; | 865 break; |
| 866 } | 866 } |
| 867 | 867 |
| 868 // Otherwise, if the media element does not have a src attribute but has
a source | 868 // Otherwise, if the media element does not have a src attribute but has
a source |
| 869 // element child, then let mode be children and let candidate be the fir
st such | 869 // element child, then let mode be children and let candidate be the fir
st such |
| 870 // source element child in tree order. | 870 // source element child in tree order. |
| 871 if (node) { | 871 if (node) { |
| 872 mode = children; | 872 mode = children; |
| 873 m_nextChildNodeToConsider = node; | 873 m_nextChildNodeToConsider = node; |
| 874 m_currentSourceNode = 0; | 874 m_currentSourceNode = 0; |
| 875 } else { | 875 } else { |
| 876 // Otherwise the media element has neither a src attribute nor a sou
rce element | 876 // Otherwise the media element has neither a src attribute nor a sou
rce element |
| 877 // child: set the networkState to NETWORK_EMPTY, and abort these ste
ps; the | 877 // child: set the networkState to NETWORK_EMPTY, and abort these ste
ps; the |
| 878 // synchronous section ends. | 878 // synchronous section ends. |
| 879 m_loadState = WaitingForSource; | 879 m_loadState = WaitingForSource; |
| 880 setShouldDelayLoadEvent(false); | 880 setShouldDelayLoadEvent(false); |
| 881 m_networkState = NETWORK_EMPTY; | 881 m_networkState = NETWORK_EMPTY; |
| 882 | 882 |
| 883 LOG(Media, "HTMLMediaElement::selectMediaResource, nothing to load")
; | 883 LOG_INFO(Media, "HTMLMediaElement::selectMediaResource, nothing to l
oad"); |
| 884 return; | 884 return; |
| 885 } | 885 } |
| 886 } | 886 } |
| 887 | 887 |
| 888 // 4 - Set the media element's delaying-the-load-event flag to true (this de
lays the load event), | 888 // 4 - Set the media element's delaying-the-load-event flag to true (this de
lays the load event), |
| 889 // and set its networkState to NETWORK_LOADING. | 889 // and set its networkState to NETWORK_LOADING. |
| 890 setShouldDelayLoadEvent(true); | 890 setShouldDelayLoadEvent(true); |
| 891 m_networkState = NETWORK_LOADING; | 891 m_networkState = NETWORK_LOADING; |
| 892 | 892 |
| 893 // 5 - Queue a task to fire a simple event named loadstart at the media elem
ent. | 893 // 5 - Queue a task to fire a simple event named loadstart at the media elem
ent. |
| 894 scheduleEvent(eventNames().loadstartEvent); | 894 scheduleEvent(eventNames().loadstartEvent); |
| 895 | 895 |
| 896 // 6 - If mode is attribute, then run these substeps | 896 // 6 - If mode is attribute, then run these substeps |
| 897 if (mode == attribute) { | 897 if (mode == attribute) { |
| 898 m_loadState = LoadingFromSrcAttr; | 898 m_loadState = LoadingFromSrcAttr; |
| 899 | 899 |
| 900 // If the src attribute's value is the empty string ... jump down to the
failed step below | 900 // If the src attribute's value is the empty string ... jump down to the
failed step below |
| 901 KURL mediaURL = getNonEmptyURLAttribute(srcAttr); | 901 KURL mediaURL = getNonEmptyURLAttribute(srcAttr); |
| 902 if (mediaURL.isEmpty()) { | 902 if (mediaURL.isEmpty()) { |
| 903 mediaLoadingFailed(MediaPlayer::FormatError); | 903 mediaLoadingFailed(MediaPlayer::FormatError); |
| 904 LOG(Media, "HTMLMediaElement::selectMediaResource, empty 'src'"); | 904 LOG_INFO(Media, "HTMLMediaElement::selectMediaResource, empty 'src'"
); |
| 905 return; | 905 return; |
| 906 } | 906 } |
| 907 | 907 |
| 908 if (!isSafeToLoadURL(mediaURL, Complain) || !dispatchBeforeLoadEvent(med
iaURL.string())) { | 908 if (!isSafeToLoadURL(mediaURL, Complain) || !dispatchBeforeLoadEvent(med
iaURL.string())) { |
| 909 mediaLoadingFailed(MediaPlayer::FormatError); | 909 mediaLoadingFailed(MediaPlayer::FormatError); |
| 910 return; | 910 return; |
| 911 } | 911 } |
| 912 | 912 |
| 913 // No type or key system information is available when the url comes | 913 // No type or key system information is available when the url comes |
| 914 // from the 'src' attribute so MediaPlayer | 914 // from the 'src' attribute so MediaPlayer |
| 915 // will have to pick a media engine based on the file extension. | 915 // will have to pick a media engine based on the file extension. |
| 916 ContentType contentType((String())); | 916 ContentType contentType((String())); |
| 917 loadResource(mediaURL, contentType, String()); | 917 loadResource(mediaURL, contentType, String()); |
| 918 LOG(Media, "HTMLMediaElement::selectMediaResource, using 'src' attribute
url"); | 918 LOG_INFO(Media, "HTMLMediaElement::selectMediaResource, using 'src' attr
ibute url"); |
| 919 return; | 919 return; |
| 920 } | 920 } |
| 921 | 921 |
| 922 // Otherwise, the source elements will be used | 922 // Otherwise, the source elements will be used |
| 923 loadNextSourceChild(); | 923 loadNextSourceChild(); |
| 924 } | 924 } |
| 925 | 925 |
| 926 void HTMLMediaElement::loadNextSourceChild() | 926 void HTMLMediaElement::loadNextSourceChild() |
| 927 { | 927 { |
| 928 ContentType contentType((String())); | 928 ContentType contentType((String())); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 url.setPath(path); | 960 url.setPath(path); |
| 961 #endif | 961 #endif |
| 962 return url; | 962 return url; |
| 963 } | 963 } |
| 964 #endif | 964 #endif |
| 965 | 965 |
| 966 void HTMLMediaElement::loadResource(const KURL& initialURL, ContentType& content
Type, const String& keySystem) | 966 void HTMLMediaElement::loadResource(const KURL& initialURL, ContentType& content
Type, const String& keySystem) |
| 967 { | 967 { |
| 968 ASSERT(isSafeToLoadURL(initialURL, Complain)); | 968 ASSERT(isSafeToLoadURL(initialURL, Complain)); |
| 969 | 969 |
| 970 LOG(Media, "HTMLMediaElement::loadResource(%s, %s, %s)", urlForLoggingMedia(
initialURL).utf8().data(), contentType.raw().utf8().data(), keySystem.utf8().dat
a()); | 970 LOG_INFO(Media, "HTMLMediaElement::loadResource(%s, %s, %s)", urlForLoggingM
edia(initialURL).utf8().data(), contentType.raw().utf8().data(), keySystem.utf8(
).data()); |
| 971 | 971 |
| 972 Frame* frame = document()->frame(); | 972 Frame* frame = document()->frame(); |
| 973 if (!frame) { | 973 if (!frame) { |
| 974 mediaLoadingFailed(MediaPlayer::FormatError); | 974 mediaLoadingFailed(MediaPlayer::FormatError); |
| 975 return; | 975 return; |
| 976 } | 976 } |
| 977 | 977 |
| 978 KURL url = initialURL; | 978 KURL url = initialURL; |
| 979 if (!frame->loader()->willLoadMediaElementURL(url)) { | 979 if (!frame->loader()->willLoadMediaElementURL(url)) { |
| 980 mediaLoadingFailed(MediaPlayer::FormatError); | 980 mediaLoadingFailed(MediaPlayer::FormatError); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 999 } | 999 } |
| 1000 #endif | 1000 #endif |
| 1001 | 1001 |
| 1002 // Set m_currentSrc *before* changing to the cache url, the fact that we are
loading from the app | 1002 // Set m_currentSrc *before* changing to the cache url, the fact that we are
loading from the app |
| 1003 // cache is an internal detail not exposed through the media element API. | 1003 // cache is an internal detail not exposed through the media element API. |
| 1004 m_currentSrc = url; | 1004 m_currentSrc = url; |
| 1005 | 1005 |
| 1006 #if !PLATFORM(CHROMIUM) | 1006 #if !PLATFORM(CHROMIUM) |
| 1007 if (resource) { | 1007 if (resource) { |
| 1008 url = createFileURLForApplicationCacheResource(resource->path()); | 1008 url = createFileURLForApplicationCacheResource(resource->path()); |
| 1009 LOG(Media, "HTMLMediaElement::loadResource - will load from app cache ->
%s", urlForLoggingMedia(url).utf8().data()); | 1009 LOG_INFO(Media, "HTMLMediaElement::loadResource - will load from app cac
he -> %s", urlForLoggingMedia(url).utf8().data()); |
| 1010 } | 1010 } |
| 1011 #endif | 1011 #endif |
| 1012 | 1012 |
| 1013 LOG(Media, "HTMLMediaElement::loadResource - m_currentSrc -> %s", urlForLogg
ingMedia(m_currentSrc).utf8().data()); | 1013 LOG_INFO(Media, "HTMLMediaElement::loadResource - m_currentSrc -> %s", urlFo
rLoggingMedia(m_currentSrc).utf8().data()); |
| 1014 | 1014 |
| 1015 #if ENABLE(MEDIA_STREAM) | 1015 #if ENABLE(MEDIA_STREAM) |
| 1016 if (MediaStreamRegistry::registry().lookupMediaStreamDescriptor(url.string()
)) | 1016 if (MediaStreamRegistry::registry().lookupMediaStreamDescriptor(url.string()
)) |
| 1017 removeBehaviorRestriction(RequireUserGestureForRateChangeRestriction); | 1017 removeBehaviorRestriction(RequireUserGestureForRateChangeRestriction); |
| 1018 #endif | 1018 #endif |
| 1019 | 1019 |
| 1020 if (m_sendProgressEvents) | 1020 if (m_sendProgressEvents) |
| 1021 startProgressEventTimer(); | 1021 startProgressEventTimer(); |
| 1022 | 1022 |
| 1023 Settings* settings = document()->settings(); | 1023 Settings* settings = document()->settings(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 | 1080 |
| 1081 // 12 - Further sort tasks in events that have the same time by the | 1081 // 12 - Further sort tasks in events that have the same time by the |
| 1082 // relative text track cue order of the text track cues associated | 1082 // relative text track cue order of the text track cues associated |
| 1083 // with these tasks. | 1083 // with these tasks. |
| 1084 return a.second->cueIndex() - b.second->cueIndex() < 0; | 1084 return a.second->cueIndex() - b.second->cueIndex() < 0; |
| 1085 } | 1085 } |
| 1086 | 1086 |
| 1087 | 1087 |
| 1088 void HTMLMediaElement::updateActiveTextTrackCues(float movieTime) | 1088 void HTMLMediaElement::updateActiveTextTrackCues(float movieTime) |
| 1089 { | 1089 { |
| 1090 LOG(Media, "HTMLMediaElement::updateActiveTextTracks"); | 1090 LOG_INFO(Media, "HTMLMediaElement::updateActiveTextTracks"); |
| 1091 | 1091 |
| 1092 // 4.8.10.8 Playing the media resource | 1092 // 4.8.10.8 Playing the media resource |
| 1093 | 1093 |
| 1094 // If the current playback position changes while the steps are running, | 1094 // If the current playback position changes while the steps are running, |
| 1095 // then the user agent must wait for the steps to complete, and then must | 1095 // then the user agent must wait for the steps to complete, and then must |
| 1096 // immediately rerun the steps. | 1096 // immediately rerun the steps. |
| 1097 if (ignoreTrackDisplayUpdateRequests()) | 1097 if (ignoreTrackDisplayUpdateRequests()) |
| 1098 return; | 1098 return; |
| 1099 | 1099 |
| 1100 // 1 - Let current cues be a list of cues, initialized to contain all the | 1100 // 1 - Let current cues be a list of cues, initialized to contain all the |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1454 | 1454 |
| 1455 cue->removeDisplayTree(); | 1455 cue->removeDisplayTree(); |
| 1456 updateActiveTextTrackCues(currentTime()); | 1456 updateActiveTextTrackCues(currentTime()); |
| 1457 } | 1457 } |
| 1458 | 1458 |
| 1459 #endif | 1459 #endif |
| 1460 | 1460 |
| 1461 bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionI
fInvalid) | 1461 bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionI
fInvalid) |
| 1462 { | 1462 { |
| 1463 if (!url.isValid()) { | 1463 if (!url.isValid()) { |
| 1464 LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%s) -> FALSE because url i
s invalid", urlForLoggingMedia(url).utf8().data()); | 1464 LOG_INFO(Media, "HTMLMediaElement::isSafeToLoadURL(%s) -> FALSE because
url is invalid", urlForLoggingMedia(url).utf8().data()); |
| 1465 return false; | 1465 return false; |
| 1466 } | 1466 } |
| 1467 | 1467 |
| 1468 Frame* frame = document()->frame(); | 1468 Frame* frame = document()->frame(); |
| 1469 if (!frame || !document()->securityOrigin()->canDisplay(url)) { | 1469 if (!frame || !document()->securityOrigin()->canDisplay(url)) { |
| 1470 if (actionIfInvalid == Complain) | 1470 if (actionIfInvalid == Complain) |
| 1471 FrameLoader::reportLocalLoadFailed(frame, url.elidedString()); | 1471 FrameLoader::reportLocalLoadFailed(frame, url.elidedString()); |
| 1472 LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%s) -> FALSE rejected by S
ecurityOrigin", urlForLoggingMedia(url).utf8().data()); | 1472 LOG_INFO(Media, "HTMLMediaElement::isSafeToLoadURL(%s) -> FALSE rejected
by SecurityOrigin", urlForLoggingMedia(url).utf8().data()); |
| 1473 return false; | 1473 return false; |
| 1474 } | 1474 } |
| 1475 | 1475 |
| 1476 if (!document()->contentSecurityPolicy()->allowMediaFromSource(url)) { | 1476 if (!document()->contentSecurityPolicy()->allowMediaFromSource(url)) { |
| 1477 LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%s) -> rejected by Content
Security Policy", urlForLoggingMedia(url).utf8().data()); | 1477 LOG_INFO(Media, "HTMLMediaElement::isSafeToLoadURL(%s) -> rejected by Co
ntent Security Policy", urlForLoggingMedia(url).utf8().data()); |
| 1478 return false; | 1478 return false; |
| 1479 } | 1479 } |
| 1480 | 1480 |
| 1481 return true; | 1481 return true; |
| 1482 } | 1482 } |
| 1483 | 1483 |
| 1484 void HTMLMediaElement::startProgressEventTimer() | 1484 void HTMLMediaElement::startProgressEventTimer() |
| 1485 { | 1485 { |
| 1486 if (m_progressEventTimer.isActive()) | 1486 if (m_progressEventTimer.isActive()) |
| 1487 return; | 1487 return; |
| 1488 | 1488 |
| 1489 m_previousProgressTime = WTF::currentTime(); | 1489 m_previousProgressTime = WTF::currentTime(); |
| 1490 // 350ms is not magic, it is in the spec! | 1490 // 350ms is not magic, it is in the spec! |
| 1491 m_progressEventTimer.startRepeating(0.350); | 1491 m_progressEventTimer.startRepeating(0.350); |
| 1492 } | 1492 } |
| 1493 | 1493 |
| 1494 void HTMLMediaElement::waitForSourceChange() | 1494 void HTMLMediaElement::waitForSourceChange() |
| 1495 { | 1495 { |
| 1496 LOG(Media, "HTMLMediaElement::waitForSourceChange"); | 1496 LOG_INFO(Media, "HTMLMediaElement::waitForSourceChange"); |
| 1497 | 1497 |
| 1498 stopPeriodicTimers(); | 1498 stopPeriodicTimers(); |
| 1499 m_loadState = WaitingForSource; | 1499 m_loadState = WaitingForSource; |
| 1500 | 1500 |
| 1501 // 6.17 - Waiting: Set the element's networkState attribute to the NETWORK_N
O_SOURCE value | 1501 // 6.17 - Waiting: Set the element's networkState attribute to the NETWORK_N
O_SOURCE value |
| 1502 m_networkState = NETWORK_NO_SOURCE; | 1502 m_networkState = NETWORK_NO_SOURCE; |
| 1503 | 1503 |
| 1504 // 6.18 - Set the element's delaying-the-load-event flag to false. This stop
s delaying the load event. | 1504 // 6.18 - Set the element's delaying-the-load-event flag to false. This stop
s delaying the load event. |
| 1505 setShouldDelayLoadEvent(false); | 1505 setShouldDelayLoadEvent(false); |
| 1506 | 1506 |
| 1507 updateDisplayState(); | 1507 updateDisplayState(); |
| 1508 | 1508 |
| 1509 if (renderer()) | 1509 if (renderer()) |
| 1510 renderer()->updateFromElement(); | 1510 renderer()->updateFromElement(); |
| 1511 } | 1511 } |
| 1512 | 1512 |
| 1513 void HTMLMediaElement::noneSupported() | 1513 void HTMLMediaElement::noneSupported() |
| 1514 { | 1514 { |
| 1515 LOG(Media, "HTMLMediaElement::noneSupported"); | 1515 LOG_INFO(Media, "HTMLMediaElement::noneSupported"); |
| 1516 | 1516 |
| 1517 stopPeriodicTimers(); | 1517 stopPeriodicTimers(); |
| 1518 m_loadState = WaitingForSource; | 1518 m_loadState = WaitingForSource; |
| 1519 m_currentSourceNode = 0; | 1519 m_currentSourceNode = 0; |
| 1520 | 1520 |
| 1521 // 4.8.10.5 | 1521 // 4.8.10.5 |
| 1522 // 6 - Reaching this step indicates that the media resource failed to load o
r that the given | 1522 // 6 - Reaching this step indicates that the media resource failed to load o
r that the given |
| 1523 // URL could not be resolved. In one atomic operation, run the following ste
ps: | 1523 // URL could not be resolved. In one atomic operation, run the following ste
ps: |
| 1524 | 1524 |
| 1525 // 6.1 - Set the error attribute to a new MediaError object whose code attri
bute is set to | 1525 // 6.1 - Set the error attribute to a new MediaError object whose code attri
bute is set to |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1545 // the element won't attempt to load another resource. | 1545 // the element won't attempt to load another resource. |
| 1546 | 1546 |
| 1547 updateDisplayState(); | 1547 updateDisplayState(); |
| 1548 | 1548 |
| 1549 if (renderer()) | 1549 if (renderer()) |
| 1550 renderer()->updateFromElement(); | 1550 renderer()->updateFromElement(); |
| 1551 } | 1551 } |
| 1552 | 1552 |
| 1553 void HTMLMediaElement::mediaEngineError(PassRefPtr<MediaError> err) | 1553 void HTMLMediaElement::mediaEngineError(PassRefPtr<MediaError> err) |
| 1554 { | 1554 { |
| 1555 LOG(Media, "HTMLMediaElement::mediaEngineError(%d)", static_cast<int>(err->c
ode())); | 1555 LOG_INFO(Media, "HTMLMediaElement::mediaEngineError(%d)", static_cast<int>(e
rr->code())); |
| 1556 | 1556 |
| 1557 // 1 - The user agent should cancel the fetching process. | 1557 // 1 - The user agent should cancel the fetching process. |
| 1558 stopPeriodicTimers(); | 1558 stopPeriodicTimers(); |
| 1559 m_loadState = WaitingForSource; | 1559 m_loadState = WaitingForSource; |
| 1560 | 1560 |
| 1561 // 2 - Set the error attribute to a new MediaError object whose code attribu
te is | 1561 // 2 - Set the error attribute to a new MediaError object whose code attribu
te is |
| 1562 // set to MEDIA_ERR_NETWORK/MEDIA_ERR_DECODE. | 1562 // set to MEDIA_ERR_NETWORK/MEDIA_ERR_DECODE. |
| 1563 m_error = err; | 1563 m_error = err; |
| 1564 | 1564 |
| 1565 // 3 - Queue a task to fire a simple event named error at the media element. | 1565 // 3 - Queue a task to fire a simple event named error at the media element. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1576 | 1576 |
| 1577 // 5 - Set the element's delaying-the-load-event flag to false. This stops d
elaying the load event. | 1577 // 5 - Set the element's delaying-the-load-event flag to false. This stops d
elaying the load event. |
| 1578 setShouldDelayLoadEvent(false); | 1578 setShouldDelayLoadEvent(false); |
| 1579 | 1579 |
| 1580 // 6 - Abort the overall resource selection algorithm. | 1580 // 6 - Abort the overall resource selection algorithm. |
| 1581 m_currentSourceNode = 0; | 1581 m_currentSourceNode = 0; |
| 1582 } | 1582 } |
| 1583 | 1583 |
| 1584 void HTMLMediaElement::cancelPendingEventsAndCallbacks() | 1584 void HTMLMediaElement::cancelPendingEventsAndCallbacks() |
| 1585 { | 1585 { |
| 1586 LOG(Media, "HTMLMediaElement::cancelPendingEventsAndCallbacks"); | 1586 LOG_INFO(Media, "HTMLMediaElement::cancelPendingEventsAndCallbacks"); |
| 1587 m_asyncEventQueue->cancelAllEvents(); | 1587 m_asyncEventQueue->cancelAllEvents(); |
| 1588 | 1588 |
| 1589 for (Node* node = firstChild(); node; node = node->nextSibling()) { | 1589 for (Node* node = firstChild(); node; node = node->nextSibling()) { |
| 1590 if (node->hasTagName(sourceTag)) | 1590 if (node->hasTagName(sourceTag)) |
| 1591 static_cast<HTMLSourceElement*>(node)->cancelPendingErrorEvent(); | 1591 static_cast<HTMLSourceElement*>(node)->cancelPendingErrorEvent(); |
| 1592 } | 1592 } |
| 1593 } | 1593 } |
| 1594 | 1594 |
| 1595 Document* HTMLMediaElement::mediaPlayerOwningDocument() | 1595 Document* HTMLMediaElement::mediaPlayerOwningDocument() |
| 1596 { | 1596 { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1650 { | 1650 { |
| 1651 stopPeriodicTimers(); | 1651 stopPeriodicTimers(); |
| 1652 | 1652 |
| 1653 // If we failed while trying to load a <source> element, the movie was never
parsed, and there are more | 1653 // If we failed while trying to load a <source> element, the movie was never
parsed, and there are more |
| 1654 // <source> children, schedule the next one | 1654 // <source> children, schedule the next one |
| 1655 if (m_readyState < HAVE_METADATA && m_loadState == LoadingFromSourceElement)
{ | 1655 if (m_readyState < HAVE_METADATA && m_loadState == LoadingFromSourceElement)
{ |
| 1656 | 1656 |
| 1657 if (m_currentSourceNode) | 1657 if (m_currentSourceNode) |
| 1658 m_currentSourceNode->scheduleErrorEvent(); | 1658 m_currentSourceNode->scheduleErrorEvent(); |
| 1659 else | 1659 else |
| 1660 LOG(Media, "HTMLMediaElement::setNetworkState - error event not sent
, <source> was removed"); | 1660 LOG_INFO(Media, "HTMLMediaElement::setNetworkState - error event not
sent, <source> was removed"); |
| 1661 | 1661 |
| 1662 if (havePotentialSourceChild()) { | 1662 if (havePotentialSourceChild()) { |
| 1663 LOG(Media, "HTMLMediaElement::setNetworkState - scheduling next <sou
rce>"); | 1663 LOG_INFO(Media, "HTMLMediaElement::setNetworkState - scheduling next
<source>"); |
| 1664 scheduleNextSourceChild(); | 1664 scheduleNextSourceChild(); |
| 1665 } else { | 1665 } else { |
| 1666 LOG(Media, "HTMLMediaElement::setNetworkState - no more <source> ele
ments, waiting"); | 1666 LOG_INFO(Media, "HTMLMediaElement::setNetworkState - no more <source
> elements, waiting"); |
| 1667 waitForSourceChange(); | 1667 waitForSourceChange(); |
| 1668 } | 1668 } |
| 1669 | 1669 |
| 1670 return; | 1670 return; |
| 1671 } | 1671 } |
| 1672 | 1672 |
| 1673 if (error == MediaPlayer::NetworkError && m_readyState >= HAVE_METADATA) | 1673 if (error == MediaPlayer::NetworkError && m_readyState >= HAVE_METADATA) |
| 1674 mediaEngineError(MediaError::create(MediaError::MEDIA_ERR_NETWORK)); | 1674 mediaEngineError(MediaError::create(MediaError::MEDIA_ERR_NETWORK)); |
| 1675 else if (error == MediaPlayer::DecodeError) | 1675 else if (error == MediaPlayer::DecodeError) |
| 1676 mediaEngineError(MediaError::create(MediaError::MEDIA_ERR_DECODE)); | 1676 mediaEngineError(MediaError::create(MediaError::MEDIA_ERR_DECODE)); |
| 1677 else if ((error == MediaPlayer::FormatError || error == MediaPlayer::Network
Error) && m_loadState == LoadingFromSrcAttr) | 1677 else if ((error == MediaPlayer::FormatError || error == MediaPlayer::Network
Error) && m_loadState == LoadingFromSrcAttr) |
| 1678 noneSupported(); | 1678 noneSupported(); |
| 1679 | 1679 |
| 1680 updateDisplayState(); | 1680 updateDisplayState(); |
| 1681 if (hasMediaControls()) { | 1681 if (hasMediaControls()) { |
| 1682 mediaControls()->reset(); | 1682 mediaControls()->reset(); |
| 1683 mediaControls()->reportedError(); | 1683 mediaControls()->reportedError(); |
| 1684 } | 1684 } |
| 1685 | 1685 |
| 1686 logMediaLoadRequest(document()->page(), String(), stringForNetworkState(erro
r), false); | 1686 logMediaLoadRequest(document()->page(), String(), stringForNetworkState(erro
r), false); |
| 1687 } | 1687 } |
| 1688 | 1688 |
| 1689 void HTMLMediaElement::setNetworkState(MediaPlayer::NetworkState state) | 1689 void HTMLMediaElement::setNetworkState(MediaPlayer::NetworkState state) |
| 1690 { | 1690 { |
| 1691 LOG(Media, "HTMLMediaElement::setNetworkState(%d) - current state is %d", st
atic_cast<int>(state), static_cast<int>(m_networkState)); | 1691 LOG_INFO(Media, "HTMLMediaElement::setNetworkState(%d) - current state is %d
", static_cast<int>(state), static_cast<int>(m_networkState)); |
| 1692 | 1692 |
| 1693 if (state == MediaPlayer::Empty) { | 1693 if (state == MediaPlayer::Empty) { |
| 1694 // Just update the cached state and leave, we can't do anything. | 1694 // Just update the cached state and leave, we can't do anything. |
| 1695 m_networkState = NETWORK_EMPTY; | 1695 m_networkState = NETWORK_EMPTY; |
| 1696 return; | 1696 return; |
| 1697 } | 1697 } |
| 1698 | 1698 |
| 1699 if (state == MediaPlayer::FormatError || state == MediaPlayer::NetworkError
|| state == MediaPlayer::DecodeError) { | 1699 if (state == MediaPlayer::FormatError || state == MediaPlayer::NetworkError
|| state == MediaPlayer::DecodeError) { |
| 1700 mediaLoadingFailed(state); | 1700 mediaLoadingFailed(state); |
| 1701 return; | 1701 return; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1743 { | 1743 { |
| 1744 beginProcessingMediaPlayerCallback(); | 1744 beginProcessingMediaPlayerCallback(); |
| 1745 | 1745 |
| 1746 setReadyState(m_player->readyState()); | 1746 setReadyState(m_player->readyState()); |
| 1747 | 1747 |
| 1748 endProcessingMediaPlayerCallback(); | 1748 endProcessingMediaPlayerCallback(); |
| 1749 } | 1749 } |
| 1750 | 1750 |
| 1751 void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state) | 1751 void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state) |
| 1752 { | 1752 { |
| 1753 LOG(Media, "HTMLMediaElement::setReadyState(%d) - current state is %d,", sta
tic_cast<int>(state), static_cast<int>(m_readyState)); | 1753 LOG_INFO(Media, "HTMLMediaElement::setReadyState(%d) - current state is %d,"
, static_cast<int>(state), static_cast<int>(m_readyState)); |
| 1754 | 1754 |
| 1755 // Set "wasPotentiallyPlaying" BEFORE updating m_readyState, potentiallyPlay
ing() uses it | 1755 // Set "wasPotentiallyPlaying" BEFORE updating m_readyState, potentiallyPlay
ing() uses it |
| 1756 bool wasPotentiallyPlaying = potentiallyPlaying(); | 1756 bool wasPotentiallyPlaying = potentiallyPlaying(); |
| 1757 | 1757 |
| 1758 ReadyState oldState = m_readyState; | 1758 ReadyState oldState = m_readyState; |
| 1759 ReadyState newState = static_cast<ReadyState>(state); | 1759 ReadyState newState = static_cast<ReadyState>(state); |
| 1760 | 1760 |
| 1761 #if ENABLE(VIDEO_TRACK) | 1761 #if ENABLE(VIDEO_TRACK) |
| 1762 bool tracksAreReady = !RuntimeEnabledFeatures::webkitVideoTrackEnabled() ||
textTracksAreReady(); | 1762 bool tracksAreReady = !RuntimeEnabledFeatures::webkitVideoTrackEnabled() ||
textTracksAreReady(); |
| 1763 | 1763 |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2010 mediaControls()->bufferingProgressed(); | 2010 mediaControls()->bufferingProgressed(); |
| 2011 } else if (timedelta > 3.0 && !m_sentStalledEvent) { | 2011 } else if (timedelta > 3.0 && !m_sentStalledEvent) { |
| 2012 scheduleEvent(eventNames().stalledEvent); | 2012 scheduleEvent(eventNames().stalledEvent); |
| 2013 m_sentStalledEvent = true; | 2013 m_sentStalledEvent = true; |
| 2014 setShouldDelayLoadEvent(false); | 2014 setShouldDelayLoadEvent(false); |
| 2015 } | 2015 } |
| 2016 } | 2016 } |
| 2017 | 2017 |
| 2018 void HTMLMediaElement::rewind(float timeDelta) | 2018 void HTMLMediaElement::rewind(float timeDelta) |
| 2019 { | 2019 { |
| 2020 LOG(Media, "HTMLMediaElement::rewind(%f)", timeDelta); | 2020 LOG_INFO(Media, "HTMLMediaElement::rewind(%f)", timeDelta); |
| 2021 setCurrentTime(max(currentTime() - timeDelta, minTimeSeekable()), IGNORE_EXC
EPTION); | 2021 setCurrentTime(max(currentTime() - timeDelta, minTimeSeekable()), IGNORE_EXC
EPTION); |
| 2022 } | 2022 } |
| 2023 | 2023 |
| 2024 void HTMLMediaElement::returnToRealtime() | 2024 void HTMLMediaElement::returnToRealtime() |
| 2025 { | 2025 { |
| 2026 LOG(Media, "HTMLMediaElement::returnToRealtime"); | 2026 LOG_INFO(Media, "HTMLMediaElement::returnToRealtime"); |
| 2027 setCurrentTime(maxTimeSeekable(), IGNORE_EXCEPTION); | 2027 setCurrentTime(maxTimeSeekable(), IGNORE_EXCEPTION); |
| 2028 } | 2028 } |
| 2029 | 2029 |
| 2030 void HTMLMediaElement::addPlayedRange(float start, float end) | 2030 void HTMLMediaElement::addPlayedRange(float start, float end) |
| 2031 { | 2031 { |
| 2032 LOG(Media, "HTMLMediaElement::addPlayedRange(%f, %f)", start, end); | 2032 LOG_INFO(Media, "HTMLMediaElement::addPlayedRange(%f, %f)", start, end); |
| 2033 if (!m_playedTimeRanges) | 2033 if (!m_playedTimeRanges) |
| 2034 m_playedTimeRanges = TimeRanges::create(); | 2034 m_playedTimeRanges = TimeRanges::create(); |
| 2035 m_playedTimeRanges->add(start, end); | 2035 m_playedTimeRanges->add(start, end); |
| 2036 } | 2036 } |
| 2037 | 2037 |
| 2038 bool HTMLMediaElement::supportsSave() const | 2038 bool HTMLMediaElement::supportsSave() const |
| 2039 { | 2039 { |
| 2040 return m_player ? m_player->supportsSave() : false; | 2040 return m_player ? m_player->supportsSave() : false; |
| 2041 } | 2041 } |
| 2042 | 2042 |
| 2043 bool HTMLMediaElement::supportsScanning() const | 2043 bool HTMLMediaElement::supportsScanning() const |
| 2044 { | 2044 { |
| 2045 return m_player ? m_player->supportsScanning() : false; | 2045 return m_player ? m_player->supportsScanning() : false; |
| 2046 } | 2046 } |
| 2047 | 2047 |
| 2048 void HTMLMediaElement::prepareToPlay() | 2048 void HTMLMediaElement::prepareToPlay() |
| 2049 { | 2049 { |
| 2050 LOG(Media, "HTMLMediaElement::prepareToPlay(%p)", this); | 2050 LOG_INFO(Media, "HTMLMediaElement::prepareToPlay(%p)", this); |
| 2051 if (m_havePreparedToPlay) | 2051 if (m_havePreparedToPlay) |
| 2052 return; | 2052 return; |
| 2053 m_havePreparedToPlay = true; | 2053 m_havePreparedToPlay = true; |
| 2054 m_player->prepareToPlay(); | 2054 m_player->prepareToPlay(); |
| 2055 } | 2055 } |
| 2056 | 2056 |
| 2057 void HTMLMediaElement::seek(float time, ExceptionCode& ec) | 2057 void HTMLMediaElement::seek(float time, ExceptionCode& ec) |
| 2058 { | 2058 { |
| 2059 LOG(Media, "HTMLMediaElement::seek(%f)", time); | 2059 LOG_INFO(Media, "HTMLMediaElement::seek(%f)", time); |
| 2060 | 2060 |
| 2061 // 4.8.9.9 Seeking | 2061 // 4.8.9.9 Seeking |
| 2062 | 2062 |
| 2063 // 1 - If the media element's readyState is HAVE_NOTHING, then raise an INVA
LID_STATE_ERR exception. | 2063 // 1 - If the media element's readyState is HAVE_NOTHING, then raise an INVA
LID_STATE_ERR exception. |
| 2064 if (m_readyState == HAVE_NOTHING || !m_player) { | 2064 if (m_readyState == HAVE_NOTHING || !m_player) { |
| 2065 ec = INVALID_STATE_ERR; | 2065 ec = INVALID_STATE_ERR; |
| 2066 return; | 2066 return; |
| 2067 } | 2067 } |
| 2068 | 2068 |
| 2069 // If the media engine has been told to postpone loading data, let it go ahe
ad now. | 2069 // If the media engine has been told to postpone loading data, let it go ahe
ad now. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2092 time = max(time, earliestTime); | 2092 time = max(time, earliestTime); |
| 2093 | 2093 |
| 2094 // Ask the media engine for the time value in the movie's time scale before
comparing with current time. This | 2094 // Ask the media engine for the time value in the movie's time scale before
comparing with current time. This |
| 2095 // is necessary because if the seek time is not equal to currentTime but the
delta is less than the movie's | 2095 // is necessary because if the seek time is not equal to currentTime but the
delta is less than the movie's |
| 2096 // time scale, we will ask the media engine to "seek" to the current movie t
ime, which may be a noop and | 2096 // time scale, we will ask the media engine to "seek" to the current movie t
ime, which may be a noop and |
| 2097 // not generate a timechanged callback. This means m_seeking will never be c
leared and we will never | 2097 // not generate a timechanged callback. This means m_seeking will never be c
leared and we will never |
| 2098 // fire a 'seeked' event. | 2098 // fire a 'seeked' event. |
| 2099 #if !LOG_DISABLED | 2099 #if !LOG_DISABLED |
| 2100 float mediaTime = m_player->mediaTimeForTimeValue(time); | 2100 float mediaTime = m_player->mediaTimeForTimeValue(time); |
| 2101 if (time != mediaTime) | 2101 if (time != mediaTime) |
| 2102 LOG(Media, "HTMLMediaElement::seek(%f) - media timeline equivalent is %f
", time, mediaTime); | 2102 LOG_INFO(Media, "HTMLMediaElement::seek(%f) - media timeline equivalent
is %f", time, mediaTime); |
| 2103 #endif | 2103 #endif |
| 2104 time = m_player->mediaTimeForTimeValue(time); | 2104 time = m_player->mediaTimeForTimeValue(time); |
| 2105 | 2105 |
| 2106 // 7 - If the (possibly now changed) new playback position is not in one of
the ranges given in the | 2106 // 7 - If the (possibly now changed) new playback position is not in one of
the ranges given in the |
| 2107 // seekable attribute, then let it be the position in one of the ranges give
n in the seekable attribute | 2107 // seekable attribute, then let it be the position in one of the ranges give
n in the seekable attribute |
| 2108 // that is the nearest to the new playback position. ... If there are no ran
ges given in the seekable | 2108 // that is the nearest to the new playback position. ... If there are no ran
ges given in the seekable |
| 2109 // attribute then set the seeking IDL attribute to false and abort these ste
ps. | 2109 // attribute then set the seeking IDL attribute to false and abort these ste
ps. |
| 2110 RefPtr<TimeRanges> seekableRanges = seekable(); | 2110 RefPtr<TimeRanges> seekableRanges = seekable(); |
| 2111 | 2111 |
| 2112 // Short circuit seeking to the current time by just firing the events if no
seek is required. | 2112 // Short circuit seeking to the current time by just firing the events if no
seek is required. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2146 scheduleEvent(eventNames().seekingEvent); | 2146 scheduleEvent(eventNames().seekingEvent); |
| 2147 | 2147 |
| 2148 // 10 - Queue a task to fire a simple event named timeupdate at the element. | 2148 // 10 - Queue a task to fire a simple event named timeupdate at the element. |
| 2149 scheduleTimeupdateEvent(false); | 2149 scheduleTimeupdateEvent(false); |
| 2150 | 2150 |
| 2151 // 11-15 are handled, if necessary, when the engine signals a readystate cha
nge. | 2151 // 11-15 are handled, if necessary, when the engine signals a readystate cha
nge. |
| 2152 } | 2152 } |
| 2153 | 2153 |
| 2154 void HTMLMediaElement::finishSeek() | 2154 void HTMLMediaElement::finishSeek() |
| 2155 { | 2155 { |
| 2156 LOG(Media, "HTMLMediaElement::finishSeek"); | 2156 LOG_INFO(Media, "HTMLMediaElement::finishSeek"); |
| 2157 | 2157 |
| 2158 // 4.8.10.9 Seeking step 14 | 2158 // 4.8.10.9 Seeking step 14 |
| 2159 m_seeking = false; | 2159 m_seeking = false; |
| 2160 | 2160 |
| 2161 // 4.8.10.9 Seeking step 15 | 2161 // 4.8.10.9 Seeking step 15 |
| 2162 scheduleEvent(eventNames().seekedEvent); | 2162 scheduleEvent(eventNames().seekedEvent); |
| 2163 | 2163 |
| 2164 setDisplayMode(Video); | 2164 setDisplayMode(Video); |
| 2165 } | 2165 } |
| 2166 | 2166 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2185 } | 2185 } |
| 2186 | 2186 |
| 2187 void HTMLMediaElement::refreshCachedTime() const | 2187 void HTMLMediaElement::refreshCachedTime() const |
| 2188 { | 2188 { |
| 2189 m_cachedTime = m_player->currentTime(); | 2189 m_cachedTime = m_player->currentTime(); |
| 2190 m_cachedTimeWallClockUpdateTime = WTF::currentTime(); | 2190 m_cachedTimeWallClockUpdateTime = WTF::currentTime(); |
| 2191 } | 2191 } |
| 2192 | 2192 |
| 2193 void HTMLMediaElement::invalidateCachedTime() | 2193 void HTMLMediaElement::invalidateCachedTime() |
| 2194 { | 2194 { |
| 2195 LOG(Media, "HTMLMediaElement::invalidateCachedTime"); | 2195 LOG_INFO(Media, "HTMLMediaElement::invalidateCachedTime"); |
| 2196 | 2196 |
| 2197 // Don't try to cache movie time when playback first starts as the time repo
rted by the engine | 2197 // Don't try to cache movie time when playback first starts as the time repo
rted by the engine |
| 2198 // sometimes fluctuates for a short amount of time, so the cached time will
be off if we take it | 2198 // sometimes fluctuates for a short amount of time, so the cached time will
be off if we take it |
| 2199 // too early. | 2199 // too early. |
| 2200 static const double minimumTimePlayingBeforeCacheSnapshot = 0.5; | 2200 static const double minimumTimePlayingBeforeCacheSnapshot = 0.5; |
| 2201 | 2201 |
| 2202 m_minimumWallClockTimeToCacheMediaTime = WTF::currentTime() + minimumTimePla
yingBeforeCacheSnapshot; | 2202 m_minimumWallClockTimeToCacheMediaTime = WTF::currentTime() + minimumTimePla
yingBeforeCacheSnapshot; |
| 2203 m_cachedTime = MediaPlayer::invalidTime(); | 2203 m_cachedTime = MediaPlayer::invalidTime(); |
| 2204 } | 2204 } |
| 2205 | 2205 |
| 2206 // playback state | 2206 // playback state |
| 2207 float HTMLMediaElement::currentTime() const | 2207 float HTMLMediaElement::currentTime() const |
| 2208 { | 2208 { |
| 2209 #if LOG_CACHED_TIME_WARNINGS | 2209 #if LOG_CACHED_TIME_WARNINGS |
| 2210 static const double minCachedDeltaForWarning = 0.01; | 2210 static const double minCachedDeltaForWarning = 0.01; |
| 2211 #endif | 2211 #endif |
| 2212 | 2212 |
| 2213 if (!m_player) | 2213 if (!m_player) |
| 2214 return 0; | 2214 return 0; |
| 2215 | 2215 |
| 2216 if (m_seeking) { | 2216 if (m_seeking) { |
| 2217 LOG(Media, "HTMLMediaElement::currentTime - seeking, returning %f", m_la
stSeekTime); | 2217 LOG_INFO(Media, "HTMLMediaElement::currentTime - seeking, returning %f",
m_lastSeekTime); |
| 2218 return m_lastSeekTime; | 2218 return m_lastSeekTime; |
| 2219 } | 2219 } |
| 2220 | 2220 |
| 2221 if (m_cachedTime != MediaPlayer::invalidTime() && m_paused) { | 2221 if (m_cachedTime != MediaPlayer::invalidTime() && m_paused) { |
| 2222 #if LOG_CACHED_TIME_WARNINGS | 2222 #if LOG_CACHED_TIME_WARNINGS |
| 2223 float delta = m_cachedTime - m_player->currentTime(); | 2223 float delta = m_cachedTime - m_player->currentTime(); |
| 2224 if (delta > minCachedDeltaForWarning) | 2224 if (delta > minCachedDeltaForWarning) |
| 2225 LOG(Media, "HTMLMediaElement::currentTime - WARNING, cached time is
%f seconds off of media time when paused", delta); | 2225 LOG_INFO(Media, "HTMLMediaElement::currentTime - WARNING, cached tim
e is %f seconds off of media time when paused", delta); |
| 2226 #endif | 2226 #endif |
| 2227 return m_cachedTime; | 2227 return m_cachedTime; |
| 2228 } | 2228 } |
| 2229 | 2229 |
| 2230 // Is it too soon use a cached time? | 2230 // Is it too soon use a cached time? |
| 2231 double now = WTF::currentTime(); | 2231 double now = WTF::currentTime(); |
| 2232 double maximumDurationToCacheMediaTime = m_player->maximumDurationToCacheMed
iaTime(); | 2232 double maximumDurationToCacheMediaTime = m_player->maximumDurationToCacheMed
iaTime(); |
| 2233 | 2233 |
| 2234 if (maximumDurationToCacheMediaTime && m_cachedTime != MediaPlayer::invalidT
ime() && !m_paused && now > m_minimumWallClockTimeToCacheMediaTime) { | 2234 if (maximumDurationToCacheMediaTime && m_cachedTime != MediaPlayer::invalidT
ime() && !m_paused && now > m_minimumWallClockTimeToCacheMediaTime) { |
| 2235 double wallClockDelta = now - m_cachedTimeWallClockUpdateTime; | 2235 double wallClockDelta = now - m_cachedTimeWallClockUpdateTime; |
| 2236 | 2236 |
| 2237 // Not too soon, use the cached time only if it hasn't expired. | 2237 // Not too soon, use the cached time only if it hasn't expired. |
| 2238 if (wallClockDelta < maximumDurationToCacheMediaTime) { | 2238 if (wallClockDelta < maximumDurationToCacheMediaTime) { |
| 2239 float adjustedCacheTime = static_cast<float>(m_cachedTime + (m_playb
ackRate * wallClockDelta)); | 2239 float adjustedCacheTime = static_cast<float>(m_cachedTime + (m_playb
ackRate * wallClockDelta)); |
| 2240 | 2240 |
| 2241 #if LOG_CACHED_TIME_WARNINGS | 2241 #if LOG_CACHED_TIME_WARNINGS |
| 2242 float delta = adjustedCacheTime - m_player->currentTime(); | 2242 float delta = adjustedCacheTime - m_player->currentTime(); |
| 2243 if (delta > minCachedDeltaForWarning) | 2243 if (delta > minCachedDeltaForWarning) |
| 2244 LOG(Media, "HTMLMediaElement::currentTime - WARNING, cached time
is %f seconds off of media time when playing", delta); | 2244 LOG_INFO(Media, "HTMLMediaElement::currentTime - WARNING, cached
time is %f seconds off of media time when playing", delta); |
| 2245 #endif | 2245 #endif |
| 2246 return adjustedCacheTime; | 2246 return adjustedCacheTime; |
| 2247 } | 2247 } |
| 2248 } | 2248 } |
| 2249 | 2249 |
| 2250 #if LOG_CACHED_TIME_WARNINGS | 2250 #if LOG_CACHED_TIME_WARNINGS |
| 2251 if (maximumDurationToCacheMediaTime && now > m_minimumWallClockTimeToCacheMe
diaTime && m_cachedTime != MediaPlayer::invalidTime()) { | 2251 if (maximumDurationToCacheMediaTime && now > m_minimumWallClockTimeToCacheMe
diaTime && m_cachedTime != MediaPlayer::invalidTime()) { |
| 2252 double wallClockDelta = now - m_cachedTimeWallClockUpdateTime; | 2252 double wallClockDelta = now - m_cachedTimeWallClockUpdateTime; |
| 2253 float delta = m_cachedTime + (m_playbackRate * wallClockDelta) - m_playe
r->currentTime(); | 2253 float delta = m_cachedTime + (m_playbackRate * wallClockDelta) - m_playe
r->currentTime(); |
| 2254 LOG(Media, "HTMLMediaElement::currentTime - cached time was %f seconds o
ff of media time when it expired", delta); | 2254 LOG_INFO(Media, "HTMLMediaElement::currentTime - cached time was %f seco
nds off of media time when it expired", delta); |
| 2255 } | 2255 } |
| 2256 #endif | 2256 #endif |
| 2257 | 2257 |
| 2258 refreshCachedTime(); | 2258 refreshCachedTime(); |
| 2259 | 2259 |
| 2260 return m_cachedTime; | 2260 return m_cachedTime; |
| 2261 } | 2261 } |
| 2262 | 2262 |
| 2263 void HTMLMediaElement::setCurrentTime(float time, ExceptionCode& ec) | 2263 void HTMLMediaElement::setCurrentTime(float time, ExceptionCode& ec) |
| 2264 { | 2264 { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2313 } | 2313 } |
| 2314 } | 2314 } |
| 2315 | 2315 |
| 2316 float HTMLMediaElement::playbackRate() const | 2316 float HTMLMediaElement::playbackRate() const |
| 2317 { | 2317 { |
| 2318 return m_playbackRate; | 2318 return m_playbackRate; |
| 2319 } | 2319 } |
| 2320 | 2320 |
| 2321 void HTMLMediaElement::setPlaybackRate(float rate) | 2321 void HTMLMediaElement::setPlaybackRate(float rate) |
| 2322 { | 2322 { |
| 2323 LOG(Media, "HTMLMediaElement::setPlaybackRate(%f)", rate); | 2323 LOG_INFO(Media, "HTMLMediaElement::setPlaybackRate(%f)", rate); |
| 2324 | 2324 |
| 2325 if (m_playbackRate != rate) { | 2325 if (m_playbackRate != rate) { |
| 2326 m_playbackRate = rate; | 2326 m_playbackRate = rate; |
| 2327 invalidateCachedTime(); | 2327 invalidateCachedTime(); |
| 2328 scheduleEvent(eventNames().ratechangeEvent); | 2328 scheduleEvent(eventNames().ratechangeEvent); |
| 2329 } | 2329 } |
| 2330 | 2330 |
| 2331 if (m_player && potentiallyPlaying() && m_player->rate() != rate && !m_media
Controller) | 2331 if (m_player && potentiallyPlaying() && m_player->rate() != rate && !m_media
Controller) |
| 2332 m_player->setRate(rate); | 2332 m_player->setRate(rate); |
| 2333 } | 2333 } |
| 2334 | 2334 |
| 2335 void HTMLMediaElement::updatePlaybackRate() | 2335 void HTMLMediaElement::updatePlaybackRate() |
| 2336 { | 2336 { |
| 2337 float effectiveRate = m_mediaController ? m_mediaController->playbackRate()
: m_playbackRate; | 2337 float effectiveRate = m_mediaController ? m_mediaController->playbackRate()
: m_playbackRate; |
| 2338 if (m_player && potentiallyPlaying() && m_player->rate() != effectiveRate) | 2338 if (m_player && potentiallyPlaying() && m_player->rate() != effectiveRate) |
| 2339 m_player->setRate(effectiveRate); | 2339 m_player->setRate(effectiveRate); |
| 2340 } | 2340 } |
| 2341 | 2341 |
| 2342 bool HTMLMediaElement::webkitPreservesPitch() const | 2342 bool HTMLMediaElement::webkitPreservesPitch() const |
| 2343 { | 2343 { |
| 2344 return m_webkitPreservesPitch; | 2344 return m_webkitPreservesPitch; |
| 2345 } | 2345 } |
| 2346 | 2346 |
| 2347 void HTMLMediaElement::setWebkitPreservesPitch(bool preservesPitch) | 2347 void HTMLMediaElement::setWebkitPreservesPitch(bool preservesPitch) |
| 2348 { | 2348 { |
| 2349 LOG(Media, "HTMLMediaElement::setWebkitPreservesPitch(%s)", boolString(prese
rvesPitch)); | 2349 LOG_INFO(Media, "HTMLMediaElement::setWebkitPreservesPitch(%s)", boolString(
preservesPitch)); |
| 2350 | 2350 |
| 2351 m_webkitPreservesPitch = preservesPitch; | 2351 m_webkitPreservesPitch = preservesPitch; |
| 2352 | 2352 |
| 2353 if (!m_player) | 2353 if (!m_player) |
| 2354 return; | 2354 return; |
| 2355 | 2355 |
| 2356 m_player->setPreservesPitch(preservesPitch); | 2356 m_player->setPreservesPitch(preservesPitch); |
| 2357 } | 2357 } |
| 2358 | 2358 |
| 2359 bool HTMLMediaElement::ended() const | 2359 bool HTMLMediaElement::ended() const |
| 2360 { | 2360 { |
| 2361 // 4.8.10.8 Playing the media resource | 2361 // 4.8.10.8 Playing the media resource |
| 2362 // The ended attribute must return true if the media element has ended | 2362 // The ended attribute must return true if the media element has ended |
| 2363 // playback and the direction of playback is forwards, and false otherwise. | 2363 // playback and the direction of playback is forwards, and false otherwise. |
| 2364 return endedPlayback() && m_playbackRate > 0; | 2364 return endedPlayback() && m_playbackRate > 0; |
| 2365 } | 2365 } |
| 2366 | 2366 |
| 2367 bool HTMLMediaElement::autoplay() const | 2367 bool HTMLMediaElement::autoplay() const |
| 2368 { | 2368 { |
| 2369 return fastHasAttribute(autoplayAttr); | 2369 return fastHasAttribute(autoplayAttr); |
| 2370 } | 2370 } |
| 2371 | 2371 |
| 2372 void HTMLMediaElement::setAutoplay(bool b) | 2372 void HTMLMediaElement::setAutoplay(bool b) |
| 2373 { | 2373 { |
| 2374 LOG(Media, "HTMLMediaElement::setAutoplay(%s)", boolString(b)); | 2374 LOG_INFO(Media, "HTMLMediaElement::setAutoplay(%s)", boolString(b)); |
| 2375 setBooleanAttribute(autoplayAttr, b); | 2375 setBooleanAttribute(autoplayAttr, b); |
| 2376 } | 2376 } |
| 2377 | 2377 |
| 2378 String HTMLMediaElement::preload() const | 2378 String HTMLMediaElement::preload() const |
| 2379 { | 2379 { |
| 2380 switch (m_preload) { | 2380 switch (m_preload) { |
| 2381 case MediaPlayer::None: | 2381 case MediaPlayer::None: |
| 2382 return ASCIILiteral("none"); | 2382 return ASCIILiteral("none"); |
| 2383 break; | 2383 break; |
| 2384 case MediaPlayer::MetaData: | 2384 case MediaPlayer::MetaData: |
| 2385 return ASCIILiteral("metadata"); | 2385 return ASCIILiteral("metadata"); |
| 2386 break; | 2386 break; |
| 2387 case MediaPlayer::Auto: | 2387 case MediaPlayer::Auto: |
| 2388 return ASCIILiteral("auto"); | 2388 return ASCIILiteral("auto"); |
| 2389 break; | 2389 break; |
| 2390 } | 2390 } |
| 2391 | 2391 |
| 2392 ASSERT_NOT_REACHED(); | 2392 ASSERT_NOT_REACHED(); |
| 2393 return String(); | 2393 return String(); |
| 2394 } | 2394 } |
| 2395 | 2395 |
| 2396 void HTMLMediaElement::setPreload(const String& preload) | 2396 void HTMLMediaElement::setPreload(const String& preload) |
| 2397 { | 2397 { |
| 2398 LOG(Media, "HTMLMediaElement::setPreload(%s)", preload.utf8().data()); | 2398 LOG_INFO(Media, "HTMLMediaElement::setPreload(%s)", preload.utf8().data()); |
| 2399 setAttribute(preloadAttr, preload); | 2399 setAttribute(preloadAttr, preload); |
| 2400 } | 2400 } |
| 2401 | 2401 |
| 2402 void HTMLMediaElement::play() | 2402 void HTMLMediaElement::play() |
| 2403 { | 2403 { |
| 2404 LOG(Media, "HTMLMediaElement::play()"); | 2404 LOG_INFO(Media, "HTMLMediaElement::play()"); |
| 2405 | 2405 |
| 2406 if (userGestureRequiredForRateChange() && !ScriptController::processingUserG
esture()) | 2406 if (userGestureRequiredForRateChange() && !ScriptController::processingUserG
esture()) |
| 2407 return; | 2407 return; |
| 2408 if (ScriptController::processingUserGesture()) | 2408 if (ScriptController::processingUserGesture()) |
| 2409 removeBehaviorsRestrictionsAfterFirstUserGesture(); | 2409 removeBehaviorsRestrictionsAfterFirstUserGesture(); |
| 2410 | 2410 |
| 2411 Settings* settings = document()->settings(); | 2411 Settings* settings = document()->settings(); |
| 2412 if (settings && settings->needsSiteSpecificQuirks() && m_dispatchingCanPlayE
vent && !m_loadInitiatedByUserGesture) { | 2412 if (settings && settings->needsSiteSpecificQuirks() && m_dispatchingCanPlayE
vent && !m_loadInitiatedByUserGesture) { |
| 2413 // It should be impossible to be processing the canplay event while hand
ling a user gesture | 2413 // It should be impossible to be processing the canplay event while hand
ling a user gesture |
| 2414 // since it is dispatched asynchronously. | 2414 // since it is dispatched asynchronously. |
| 2415 ASSERT(!ScriptController::processingUserGesture()); | 2415 ASSERT(!ScriptController::processingUserGesture()); |
| 2416 String host = document()->baseURL().host(); | 2416 String host = document()->baseURL().host(); |
| 2417 if (host.endsWith(".npr.org", false) || equalIgnoringCase(host, "npr.org
")) | 2417 if (host.endsWith(".npr.org", false) || equalIgnoringCase(host, "npr.org
")) |
| 2418 return; | 2418 return; |
| 2419 } | 2419 } |
| 2420 | 2420 |
| 2421 playInternal(); | 2421 playInternal(); |
| 2422 } | 2422 } |
| 2423 | 2423 |
| 2424 void HTMLMediaElement::playInternal() | 2424 void HTMLMediaElement::playInternal() |
| 2425 { | 2425 { |
| 2426 LOG(Media, "HTMLMediaElement::playInternal"); | 2426 LOG_INFO(Media, "HTMLMediaElement::playInternal"); |
| 2427 | 2427 |
| 2428 // 4.8.10.9. Playing the media resource | 2428 // 4.8.10.9. Playing the media resource |
| 2429 if (!m_player || m_networkState == NETWORK_EMPTY) | 2429 if (!m_player || m_networkState == NETWORK_EMPTY) |
| 2430 scheduleDelayedAction(LoadMediaResource); | 2430 scheduleDelayedAction(LoadMediaResource); |
| 2431 | 2431 |
| 2432 if (endedPlayback()) | 2432 if (endedPlayback()) |
| 2433 seek(0, IGNORE_EXCEPTION); | 2433 seek(0, IGNORE_EXCEPTION); |
| 2434 | 2434 |
| 2435 if (m_mediaController) | 2435 if (m_mediaController) |
| 2436 m_mediaController->bringElementUpToSpeed(this); | 2436 m_mediaController->bringElementUpToSpeed(this); |
| 2437 | 2437 |
| 2438 if (m_paused) { | 2438 if (m_paused) { |
| 2439 m_paused = false; | 2439 m_paused = false; |
| 2440 invalidateCachedTime(); | 2440 invalidateCachedTime(); |
| 2441 scheduleEvent(eventNames().playEvent); | 2441 scheduleEvent(eventNames().playEvent); |
| 2442 | 2442 |
| 2443 if (m_readyState <= HAVE_CURRENT_DATA) | 2443 if (m_readyState <= HAVE_CURRENT_DATA) |
| 2444 scheduleEvent(eventNames().waitingEvent); | 2444 scheduleEvent(eventNames().waitingEvent); |
| 2445 else if (m_readyState >= HAVE_FUTURE_DATA) | 2445 else if (m_readyState >= HAVE_FUTURE_DATA) |
| 2446 scheduleEvent(eventNames().playingEvent); | 2446 scheduleEvent(eventNames().playingEvent); |
| 2447 } | 2447 } |
| 2448 m_autoplaying = false; | 2448 m_autoplaying = false; |
| 2449 | 2449 |
| 2450 updatePlayState(); | 2450 updatePlayState(); |
| 2451 updateMediaController(); | 2451 updateMediaController(); |
| 2452 } | 2452 } |
| 2453 | 2453 |
| 2454 void HTMLMediaElement::pause() | 2454 void HTMLMediaElement::pause() |
| 2455 { | 2455 { |
| 2456 LOG(Media, "HTMLMediaElement::pause()"); | 2456 LOG_INFO(Media, "HTMLMediaElement::pause()"); |
| 2457 | 2457 |
| 2458 if (userGestureRequiredForRateChange() && !ScriptController::processingUserG
esture()) | 2458 if (userGestureRequiredForRateChange() && !ScriptController::processingUserG
esture()) |
| 2459 return; | 2459 return; |
| 2460 | 2460 |
| 2461 pauseInternal(); | 2461 pauseInternal(); |
| 2462 } | 2462 } |
| 2463 | 2463 |
| 2464 | 2464 |
| 2465 void HTMLMediaElement::pauseInternal() | 2465 void HTMLMediaElement::pauseInternal() |
| 2466 { | 2466 { |
| 2467 LOG(Media, "HTMLMediaElement::pauseInternal"); | 2467 LOG_INFO(Media, "HTMLMediaElement::pauseInternal"); |
| 2468 | 2468 |
| 2469 // 4.8.10.9. Playing the media resource | 2469 // 4.8.10.9. Playing the media resource |
| 2470 if (!m_player || m_networkState == NETWORK_EMPTY) | 2470 if (!m_player || m_networkState == NETWORK_EMPTY) |
| 2471 scheduleDelayedAction(LoadMediaResource); | 2471 scheduleDelayedAction(LoadMediaResource); |
| 2472 | 2472 |
| 2473 m_autoplaying = false; | 2473 m_autoplaying = false; |
| 2474 | 2474 |
| 2475 if (!m_paused) { | 2475 if (!m_paused) { |
| 2476 m_paused = true; | 2476 m_paused = true; |
| 2477 scheduleTimeupdateEvent(false); | 2477 scheduleTimeupdateEvent(false); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2594 | 2594 |
| 2595 #endif | 2595 #endif |
| 2596 | 2596 |
| 2597 bool HTMLMediaElement::loop() const | 2597 bool HTMLMediaElement::loop() const |
| 2598 { | 2598 { |
| 2599 return fastHasAttribute(loopAttr); | 2599 return fastHasAttribute(loopAttr); |
| 2600 } | 2600 } |
| 2601 | 2601 |
| 2602 void HTMLMediaElement::setLoop(bool b) | 2602 void HTMLMediaElement::setLoop(bool b) |
| 2603 { | 2603 { |
| 2604 LOG(Media, "HTMLMediaElement::setLoop(%s)", boolString(b)); | 2604 LOG_INFO(Media, "HTMLMediaElement::setLoop(%s)", boolString(b)); |
| 2605 setBooleanAttribute(loopAttr, b); | 2605 setBooleanAttribute(loopAttr, b); |
| 2606 } | 2606 } |
| 2607 | 2607 |
| 2608 bool HTMLMediaElement::controls() const | 2608 bool HTMLMediaElement::controls() const |
| 2609 { | 2609 { |
| 2610 Frame* frame = document()->frame(); | 2610 Frame* frame = document()->frame(); |
| 2611 | 2611 |
| 2612 // always show controls when scripting is disabled | 2612 // always show controls when scripting is disabled |
| 2613 if (frame && !frame->script()->canExecuteScripts(NotAboutToExecuteScript)) | 2613 if (frame && !frame->script()->canExecuteScripts(NotAboutToExecuteScript)) |
| 2614 return true; | 2614 return true; |
| 2615 | 2615 |
| 2616 // always show controls for video when fullscreen playback is required. | 2616 // always show controls for video when fullscreen playback is required. |
| 2617 if (isVideo() && document()->page() && document()->page()->chrome()->require
sFullscreenForVideoPlayback()) | 2617 if (isVideo() && document()->page() && document()->page()->chrome()->require
sFullscreenForVideoPlayback()) |
| 2618 return true; | 2618 return true; |
| 2619 | 2619 |
| 2620 // Always show controls when in full screen mode. | 2620 // Always show controls when in full screen mode. |
| 2621 if (isFullscreen()) | 2621 if (isFullscreen()) |
| 2622 return true; | 2622 return true; |
| 2623 | 2623 |
| 2624 return fastHasAttribute(controlsAttr); | 2624 return fastHasAttribute(controlsAttr); |
| 2625 } | 2625 } |
| 2626 | 2626 |
| 2627 void HTMLMediaElement::setControls(bool b) | 2627 void HTMLMediaElement::setControls(bool b) |
| 2628 { | 2628 { |
| 2629 LOG(Media, "HTMLMediaElement::setControls(%s)", boolString(b)); | 2629 LOG_INFO(Media, "HTMLMediaElement::setControls(%s)", boolString(b)); |
| 2630 setBooleanAttribute(controlsAttr, b); | 2630 setBooleanAttribute(controlsAttr, b); |
| 2631 } | 2631 } |
| 2632 | 2632 |
| 2633 float HTMLMediaElement::volume() const | 2633 float HTMLMediaElement::volume() const |
| 2634 { | 2634 { |
| 2635 return m_volume; | 2635 return m_volume; |
| 2636 } | 2636 } |
| 2637 | 2637 |
| 2638 void HTMLMediaElement::setVolume(float vol, ExceptionCode& ec) | 2638 void HTMLMediaElement::setVolume(float vol, ExceptionCode& ec) |
| 2639 { | 2639 { |
| 2640 LOG(Media, "HTMLMediaElement::setVolume(%f)", vol); | 2640 LOG_INFO(Media, "HTMLMediaElement::setVolume(%f)", vol); |
| 2641 | 2641 |
| 2642 if (vol < 0.0f || vol > 1.0f) { | 2642 if (vol < 0.0f || vol > 1.0f) { |
| 2643 ec = INDEX_SIZE_ERR; | 2643 ec = INDEX_SIZE_ERR; |
| 2644 return; | 2644 return; |
| 2645 } | 2645 } |
| 2646 | 2646 |
| 2647 if (m_volume != vol) { | 2647 if (m_volume != vol) { |
| 2648 m_volume = vol; | 2648 m_volume = vol; |
| 2649 updateVolume(); | 2649 updateVolume(); |
| 2650 scheduleEvent(eventNames().volumechangeEvent); | 2650 scheduleEvent(eventNames().volumechangeEvent); |
| 2651 } | 2651 } |
| 2652 } | 2652 } |
| 2653 | 2653 |
| 2654 bool HTMLMediaElement::muted() const | 2654 bool HTMLMediaElement::muted() const |
| 2655 { | 2655 { |
| 2656 return m_muted; | 2656 return m_muted; |
| 2657 } | 2657 } |
| 2658 | 2658 |
| 2659 void HTMLMediaElement::setMuted(bool muted) | 2659 void HTMLMediaElement::setMuted(bool muted) |
| 2660 { | 2660 { |
| 2661 LOG(Media, "HTMLMediaElement::setMuted(%s)", boolString(muted)); | 2661 LOG_INFO(Media, "HTMLMediaElement::setMuted(%s)", boolString(muted)); |
| 2662 | 2662 |
| 2663 if (m_muted != muted) { | 2663 if (m_muted != muted) { |
| 2664 m_muted = muted; | 2664 m_muted = muted; |
| 2665 // Avoid recursion when the player reports volume changes. | 2665 // Avoid recursion when the player reports volume changes. |
| 2666 if (!processingMediaPlayerCallback()) { | 2666 if (!processingMediaPlayerCallback()) { |
| 2667 if (m_player) { | 2667 if (m_player) { |
| 2668 m_player->setMuted(m_muted); | 2668 m_player->setMuted(m_muted); |
| 2669 if (hasMediaControls()) | 2669 if (hasMediaControls()) |
| 2670 mediaControls()->changedMute(); | 2670 mediaControls()->changedMute(); |
| 2671 } | 2671 } |
| 2672 } | 2672 } |
| 2673 scheduleEvent(eventNames().volumechangeEvent); | 2673 scheduleEvent(eventNames().volumechangeEvent); |
| 2674 } | 2674 } |
| 2675 } | 2675 } |
| 2676 | 2676 |
| 2677 void HTMLMediaElement::togglePlayState() | 2677 void HTMLMediaElement::togglePlayState() |
| 2678 { | 2678 { |
| 2679 LOG(Media, "HTMLMediaElement::togglePlayState - canPlay() is %s", boolString
(canPlay())); | 2679 LOG_INFO(Media, "HTMLMediaElement::togglePlayState - canPlay() is %s", boolS
tring(canPlay())); |
| 2680 | 2680 |
| 2681 // We can safely call the internal play/pause methods, which don't check res
trictions, because | 2681 // We can safely call the internal play/pause methods, which don't check res
trictions, because |
| 2682 // this method is only called from the built-in media controller | 2682 // this method is only called from the built-in media controller |
| 2683 if (canPlay()) { | 2683 if (canPlay()) { |
| 2684 updatePlaybackRate(); | 2684 updatePlaybackRate(); |
| 2685 playInternal(); | 2685 playInternal(); |
| 2686 } else | 2686 } else |
| 2687 pauseInternal(); | 2687 pauseInternal(); |
| 2688 } | 2688 } |
| 2689 | 2689 |
| 2690 void HTMLMediaElement::beginScrubbing() | 2690 void HTMLMediaElement::beginScrubbing() |
| 2691 { | 2691 { |
| 2692 LOG(Media, "HTMLMediaElement::beginScrubbing - paused() is %s", boolString(p
aused())); | 2692 LOG_INFO(Media, "HTMLMediaElement::beginScrubbing - paused() is %s", boolStr
ing(paused())); |
| 2693 | 2693 |
| 2694 if (!paused()) { | 2694 if (!paused()) { |
| 2695 if (ended()) { | 2695 if (ended()) { |
| 2696 // Because a media element stays in non-paused state when it reaches
end, playback resumes | 2696 // Because a media element stays in non-paused state when it reaches
end, playback resumes |
| 2697 // when the slider is dragged from the end to another position unles
s we pause first. Do | 2697 // when the slider is dragged from the end to another position unles
s we pause first. Do |
| 2698 // a "hard pause" so an event is generated, since we want to stay pa
used after scrubbing finishes. | 2698 // a "hard pause" so an event is generated, since we want to stay pa
used after scrubbing finishes. |
| 2699 pause(); | 2699 pause(); |
| 2700 } else { | 2700 } else { |
| 2701 // Not at the end but we still want to pause playback so the media e
ngine doesn't try to | 2701 // Not at the end but we still want to pause playback so the media e
ngine doesn't try to |
| 2702 // continue playing during scrubbing. Pause without generating an ev
ent as we will | 2702 // continue playing during scrubbing. Pause without generating an ev
ent as we will |
| 2703 // unpause after scrubbing finishes. | 2703 // unpause after scrubbing finishes. |
| 2704 setPausedInternal(true); | 2704 setPausedInternal(true); |
| 2705 } | 2705 } |
| 2706 } | 2706 } |
| 2707 } | 2707 } |
| 2708 | 2708 |
| 2709 void HTMLMediaElement::endScrubbing() | 2709 void HTMLMediaElement::endScrubbing() |
| 2710 { | 2710 { |
| 2711 LOG(Media, "HTMLMediaElement::endScrubbing - m_pausedInternal is %s", boolSt
ring(m_pausedInternal)); | 2711 LOG_INFO(Media, "HTMLMediaElement::endScrubbing - m_pausedInternal is %s", b
oolString(m_pausedInternal)); |
| 2712 | 2712 |
| 2713 if (m_pausedInternal) | 2713 if (m_pausedInternal) |
| 2714 setPausedInternal(false); | 2714 setPausedInternal(false); |
| 2715 } | 2715 } |
| 2716 | 2716 |
| 2717 // The spec says to fire periodic timeupdate events (those sent while playing) e
very | 2717 // The spec says to fire periodic timeupdate events (those sent while playing) e
very |
| 2718 // "15 to 250ms", we choose the slowest frequency | 2718 // "15 to 250ms", we choose the slowest frequency |
| 2719 static const double maxTimeupdateEventFrequency = 0.25; | 2719 static const double maxTimeupdateEventFrequency = 0.25; |
| 2720 | 2720 |
| 2721 void HTMLMediaElement::startPlaybackProgressTimer() | 2721 void HTMLMediaElement::startPlaybackProgressTimer() |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3035 void HTMLMediaElement::didRemoveTrack(HTMLTrackElement* trackElement) | 3035 void HTMLMediaElement::didRemoveTrack(HTMLTrackElement* trackElement) |
| 3036 { | 3036 { |
| 3037 ASSERT(trackElement->hasTagName(trackTag)); | 3037 ASSERT(trackElement->hasTagName(trackTag)); |
| 3038 | 3038 |
| 3039 if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled()) | 3039 if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled()) |
| 3040 return; | 3040 return; |
| 3041 | 3041 |
| 3042 #if !LOG_DISABLED | 3042 #if !LOG_DISABLED |
| 3043 if (trackElement->hasTagName(trackTag)) { | 3043 if (trackElement->hasTagName(trackTag)) { |
| 3044 KURL url = trackElement->getNonEmptyURLAttribute(srcAttr); | 3044 KURL url = trackElement->getNonEmptyURLAttribute(srcAttr); |
| 3045 LOG(Media, "HTMLMediaElement::didRemoveTrack - 'src' is %s", urlForLoggi
ngMedia(url).utf8().data()); | 3045 LOG_INFO(Media, "HTMLMediaElement::didRemoveTrack - 'src' is %s", urlFor
LoggingMedia(url).utf8().data()); |
| 3046 } | 3046 } |
| 3047 #endif | 3047 #endif |
| 3048 | 3048 |
| 3049 RefPtr<TextTrack> textTrack = trackElement->track(); | 3049 RefPtr<TextTrack> textTrack = trackElement->track(); |
| 3050 if (!textTrack) | 3050 if (!textTrack) |
| 3051 return; | 3051 return; |
| 3052 | 3052 |
| 3053 textTrack->setHasBeenConfigured(false); | 3053 textTrack->setHasBeenConfigured(false); |
| 3054 | 3054 |
| 3055 if (!m_textTracks) | 3055 if (!m_textTracks) |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3247 | 3247 |
| 3248 return nextURL.isValid(); | 3248 return nextURL.isValid(); |
| 3249 } | 3249 } |
| 3250 | 3250 |
| 3251 KURL HTMLMediaElement::selectNextSourceChild(ContentType* contentType, String* k
eySystem, InvalidURLAction actionIfInvalid) | 3251 KURL HTMLMediaElement::selectNextSourceChild(ContentType* contentType, String* k
eySystem, InvalidURLAction actionIfInvalid) |
| 3252 { | 3252 { |
| 3253 #if !LOG_DISABLED | 3253 #if !LOG_DISABLED |
| 3254 // Don't log if this was just called to find out if there are any valid <sou
rce> elements. | 3254 // Don't log if this was just called to find out if there are any valid <sou
rce> elements. |
| 3255 bool shouldLog = actionIfInvalid != DoNothing; | 3255 bool shouldLog = actionIfInvalid != DoNothing; |
| 3256 if (shouldLog) | 3256 if (shouldLog) |
| 3257 LOG(Media, "HTMLMediaElement::selectNextSourceChild"); | 3257 LOG_INFO(Media, "HTMLMediaElement::selectNextSourceChild"); |
| 3258 #endif | 3258 #endif |
| 3259 | 3259 |
| 3260 if (!m_nextChildNodeToConsider) { | 3260 if (!m_nextChildNodeToConsider) { |
| 3261 #if !LOG_DISABLED | 3261 #if !LOG_DISABLED |
| 3262 if (shouldLog) | 3262 if (shouldLog) |
| 3263 LOG(Media, "HTMLMediaElement::selectNextSourceChild -> 0x0000, \"\""
); | 3263 LOG_INFO(Media, "HTMLMediaElement::selectNextSourceChild -> 0x0000,
\"\""); |
| 3264 #endif | 3264 #endif |
| 3265 return KURL(); | 3265 return KURL(); |
| 3266 } | 3266 } |
| 3267 | 3267 |
| 3268 KURL mediaURL; | 3268 KURL mediaURL; |
| 3269 Node* node; | 3269 Node* node; |
| 3270 HTMLSourceElement* source = 0; | 3270 HTMLSourceElement* source = 0; |
| 3271 String type; | 3271 String type; |
| 3272 String system; | 3272 String system; |
| 3273 bool lookingForStartNode = m_nextChildNodeToConsider; | 3273 bool lookingForStartNode = m_nextChildNodeToConsider; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3287 continue; | 3287 continue; |
| 3288 if (node->parentNode() != this) | 3288 if (node->parentNode() != this) |
| 3289 continue; | 3289 continue; |
| 3290 | 3290 |
| 3291 source = static_cast<HTMLSourceElement*>(node); | 3291 source = static_cast<HTMLSourceElement*>(node); |
| 3292 | 3292 |
| 3293 // 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 | 3293 // 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 |
| 3294 mediaURL = source->getNonEmptyURLAttribute(srcAttr); | 3294 mediaURL = source->getNonEmptyURLAttribute(srcAttr); |
| 3295 #if !LOG_DISABLED | 3295 #if !LOG_DISABLED |
| 3296 if (shouldLog) | 3296 if (shouldLog) |
| 3297 LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'src' is %s",
urlForLoggingMedia(mediaURL).utf8().data()); | 3297 LOG_INFO(Media, "HTMLMediaElement::selectNextSourceChild - 'src' is
%s", urlForLoggingMedia(mediaURL).utf8().data()); |
| 3298 #endif | 3298 #endif |
| 3299 if (mediaURL.isEmpty()) | 3299 if (mediaURL.isEmpty()) |
| 3300 goto check_again; | 3300 goto check_again; |
| 3301 | 3301 |
| 3302 if (source->fastHasAttribute(mediaAttr)) { | 3302 if (source->fastHasAttribute(mediaAttr)) { |
| 3303 MediaQueryEvaluator screenEval("screen", document()->frame(), render
er() ? renderer()->style() : 0); | 3303 MediaQueryEvaluator screenEval("screen", document()->frame(), render
er() ? renderer()->style() : 0); |
| 3304 RefPtr<MediaQuerySet> media = MediaQuerySet::createAllowingDescripti
onSyntax(source->media()); | 3304 RefPtr<MediaQuerySet> media = MediaQuerySet::createAllowingDescripti
onSyntax(source->media()); |
| 3305 #if !LOG_DISABLED | 3305 #if !LOG_DISABLED |
| 3306 if (shouldLog) | 3306 if (shouldLog) |
| 3307 LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'media' is
%s", source->media().utf8().data()); | 3307 LOG_INFO(Media, "HTMLMediaElement::selectNextSourceChild - 'medi
a' is %s", source->media().utf8().data()); |
| 3308 #endif | 3308 #endif |
| 3309 if (!screenEval.eval(media.get())) | 3309 if (!screenEval.eval(media.get())) |
| 3310 goto check_again; | 3310 goto check_again; |
| 3311 } | 3311 } |
| 3312 | 3312 |
| 3313 type = source->type(); | 3313 type = source->type(); |
| 3314 // FIXME(82965): Add support for keySystem in <source> and set system fr
om source. | 3314 // FIXME(82965): Add support for keySystem in <source> and set system fr
om source. |
| 3315 if (type.isEmpty() && mediaURL.protocolIsData()) | 3315 if (type.isEmpty() && mediaURL.protocolIsData()) |
| 3316 type = mimeTypeFromDataURL(mediaURL); | 3316 type = mimeTypeFromDataURL(mediaURL); |
| 3317 if (!type.isEmpty() || !system.isEmpty()) { | 3317 if (!type.isEmpty() || !system.isEmpty()) { |
| 3318 #if !LOG_DISABLED | 3318 #if !LOG_DISABLED |
| 3319 if (shouldLog) | 3319 if (shouldLog) |
| 3320 LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'type' is
'%s' - key system is '%s'", type.utf8().data(), system.utf8().data()); | 3320 LOG_INFO(Media, "HTMLMediaElement::selectNextSourceChild - 'type
' is '%s' - key system is '%s'", type.utf8().data(), system.utf8().data()); |
| 3321 #endif | 3321 #endif |
| 3322 if (!MediaPlayer::supportsType(ContentType(type), system, mediaURL,
this)) | 3322 if (!MediaPlayer::supportsType(ContentType(type), system, mediaURL,
this)) |
| 3323 goto check_again; | 3323 goto check_again; |
| 3324 } | 3324 } |
| 3325 | 3325 |
| 3326 // Is it safe to load this url? | 3326 // Is it safe to load this url? |
| 3327 okToLoadSourceURL = isSafeToLoadURL(mediaURL, actionIfInvalid) && dispat
chBeforeLoadEvent(mediaURL.string()); | 3327 okToLoadSourceURL = isSafeToLoadURL(mediaURL, actionIfInvalid) && dispat
chBeforeLoadEvent(mediaURL.string()); |
| 3328 | 3328 |
| 3329 // A 'beforeload' event handler can mutate the DOM, so check to see if t
he source element is still a child node. | 3329 // A 'beforeload' event handler can mutate the DOM, so check to see if t
he source element is still a child node. |
| 3330 if (node->parentNode() != this) { | 3330 if (node->parentNode() != this) { |
| 3331 LOG(Media, "HTMLMediaElement::selectNextSourceChild : 'beforeload' r
emoved current element"); | 3331 LOG_INFO(Media, "HTMLMediaElement::selectNextSourceChild : 'beforelo
ad' removed current element"); |
| 3332 source = 0; | 3332 source = 0; |
| 3333 goto check_again; | 3333 goto check_again; |
| 3334 } | 3334 } |
| 3335 | 3335 |
| 3336 if (!okToLoadSourceURL) | 3336 if (!okToLoadSourceURL) |
| 3337 goto check_again; | 3337 goto check_again; |
| 3338 | 3338 |
| 3339 // Making it this far means the <source> looks reasonable. | 3339 // Making it this far means the <source> looks reasonable. |
| 3340 canUseSourceElement = true; | 3340 canUseSourceElement = true; |
| 3341 | 3341 |
| 3342 check_again: | 3342 check_again: |
| 3343 if (!canUseSourceElement && actionIfInvalid == Complain && source) | 3343 if (!canUseSourceElement && actionIfInvalid == Complain && source) |
| 3344 source->scheduleErrorEvent(); | 3344 source->scheduleErrorEvent(); |
| 3345 } | 3345 } |
| 3346 | 3346 |
| 3347 if (canUseSourceElement) { | 3347 if (canUseSourceElement) { |
| 3348 if (contentType) | 3348 if (contentType) |
| 3349 *contentType = ContentType(type); | 3349 *contentType = ContentType(type); |
| 3350 if (keySystem) | 3350 if (keySystem) |
| 3351 *keySystem = system; | 3351 *keySystem = system; |
| 3352 m_currentSourceNode = source; | 3352 m_currentSourceNode = source; |
| 3353 m_nextChildNodeToConsider = source->nextSibling(); | 3353 m_nextChildNodeToConsider = source->nextSibling(); |
| 3354 } else { | 3354 } else { |
| 3355 m_currentSourceNode = 0; | 3355 m_currentSourceNode = 0; |
| 3356 m_nextChildNodeToConsider = 0; | 3356 m_nextChildNodeToConsider = 0; |
| 3357 } | 3357 } |
| 3358 | 3358 |
| 3359 #if !LOG_DISABLED | 3359 #if !LOG_DISABLED |
| 3360 if (shouldLog) | 3360 if (shouldLog) |
| 3361 LOG(Media, "HTMLMediaElement::selectNextSourceChild -> %p, %s", m_curren
tSourceNode.get(), canUseSourceElement ? urlForLoggingMedia(mediaURL).utf8().dat
a() : ""); | 3361 LOG_INFO(Media, "HTMLMediaElement::selectNextSourceChild -> %p, %s", m_c
urrentSourceNode.get(), canUseSourceElement ? urlForLoggingMedia(mediaURL).utf8(
).data() : ""); |
| 3362 #endif | 3362 #endif |
| 3363 return canUseSourceElement ? mediaURL : KURL(); | 3363 return canUseSourceElement ? mediaURL : KURL(); |
| 3364 } | 3364 } |
| 3365 | 3365 |
| 3366 void HTMLMediaElement::sourceWasAdded(HTMLSourceElement* source) | 3366 void HTMLMediaElement::sourceWasAdded(HTMLSourceElement* source) |
| 3367 { | 3367 { |
| 3368 LOG(Media, "HTMLMediaElement::sourceWasAdded(%p)", source); | 3368 LOG_INFO(Media, "HTMLMediaElement::sourceWasAdded(%p)", source); |
| 3369 | 3369 |
| 3370 #if !LOG_DISABLED | 3370 #if !LOG_DISABLED |
| 3371 if (source->hasTagName(sourceTag)) { | 3371 if (source->hasTagName(sourceTag)) { |
| 3372 KURL url = source->getNonEmptyURLAttribute(srcAttr); | 3372 KURL url = source->getNonEmptyURLAttribute(srcAttr); |
| 3373 LOG(Media, "HTMLMediaElement::sourceWasAdded - 'src' is %s", urlForLoggi
ngMedia(url).utf8().data()); | 3373 LOG_INFO(Media, "HTMLMediaElement::sourceWasAdded - 'src' is %s", urlFor
LoggingMedia(url).utf8().data()); |
| 3374 } | 3374 } |
| 3375 #endif | 3375 #endif |
| 3376 | 3376 |
| 3377 // We should only consider a <source> element when there is not src attribut
e at all. | 3377 // We should only consider a <source> element when there is not src attribut
e at all. |
| 3378 if (fastHasAttribute(srcAttr)) | 3378 if (fastHasAttribute(srcAttr)) |
| 3379 return; | 3379 return; |
| 3380 | 3380 |
| 3381 // 4.8.8 - If a source element is inserted as a child of a media element tha
t has no src | 3381 // 4.8.8 - If a source element is inserted as a child of a media element tha
t has no src |
| 3382 // attribute and whose networkState has the value NETWORK_EMPTY, the user ag
ent must invoke | 3382 // attribute and whose networkState has the value NETWORK_EMPTY, the user ag
ent must invoke |
| 3383 // the media element's resource selection algorithm. | 3383 // the media element's resource selection algorithm. |
| 3384 if (networkState() == HTMLMediaElement::NETWORK_EMPTY) { | 3384 if (networkState() == HTMLMediaElement::NETWORK_EMPTY) { |
| 3385 scheduleDelayedAction(LoadMediaResource); | 3385 scheduleDelayedAction(LoadMediaResource); |
| 3386 m_nextChildNodeToConsider = source; | 3386 m_nextChildNodeToConsider = source; |
| 3387 return; | 3387 return; |
| 3388 } | 3388 } |
| 3389 | 3389 |
| 3390 if (m_currentSourceNode && source == m_currentSourceNode->nextSibling()) { | 3390 if (m_currentSourceNode && source == m_currentSourceNode->nextSibling()) { |
| 3391 LOG(Media, "HTMLMediaElement::sourceWasAdded - <source> inserted immedia
tely after current source"); | 3391 LOG_INFO(Media, "HTMLMediaElement::sourceWasAdded - <source> inserted im
mediately after current source"); |
| 3392 m_nextChildNodeToConsider = source; | 3392 m_nextChildNodeToConsider = source; |
| 3393 return; | 3393 return; |
| 3394 } | 3394 } |
| 3395 | 3395 |
| 3396 if (m_nextChildNodeToConsider) | 3396 if (m_nextChildNodeToConsider) |
| 3397 return; | 3397 return; |
| 3398 | 3398 |
| 3399 // 4.8.9.5, resource selection algorithm, source elements section: | 3399 // 4.8.9.5, resource selection algorithm, source elements section: |
| 3400 // 21. Wait until the node after pointer is a node other than the end of the
list. (This step might wait forever.) | 3400 // 21. Wait until the node after pointer is a node other than the end of the
list. (This step might wait forever.) |
| 3401 // 22. Asynchronously await a stable state... | 3401 // 22. Asynchronously await a stable state... |
| 3402 // 23. Set the element's delaying-the-load-event flag back to true (this del
ays the load event again, in case | 3402 // 23. Set the element's delaying-the-load-event flag back to true (this del
ays the load event again, in case |
| 3403 // it hasn't been fired yet). | 3403 // it hasn't been fired yet). |
| 3404 setShouldDelayLoadEvent(true); | 3404 setShouldDelayLoadEvent(true); |
| 3405 | 3405 |
| 3406 // 24. Set the networkState back to NETWORK_LOADING. | 3406 // 24. Set the networkState back to NETWORK_LOADING. |
| 3407 m_networkState = NETWORK_LOADING; | 3407 m_networkState = NETWORK_LOADING; |
| 3408 | 3408 |
| 3409 // 25. Jump back to the find next candidate step above. | 3409 // 25. Jump back to the find next candidate step above. |
| 3410 m_nextChildNodeToConsider = source; | 3410 m_nextChildNodeToConsider = source; |
| 3411 scheduleNextSourceChild(); | 3411 scheduleNextSourceChild(); |
| 3412 } | 3412 } |
| 3413 | 3413 |
| 3414 void HTMLMediaElement::sourceWasRemoved(HTMLSourceElement* source) | 3414 void HTMLMediaElement::sourceWasRemoved(HTMLSourceElement* source) |
| 3415 { | 3415 { |
| 3416 LOG(Media, "HTMLMediaElement::sourceWasRemoved(%p)", source); | 3416 LOG_INFO(Media, "HTMLMediaElement::sourceWasRemoved(%p)", source); |
| 3417 | 3417 |
| 3418 #if !LOG_DISABLED | 3418 #if !LOG_DISABLED |
| 3419 if (source->hasTagName(sourceTag)) { | 3419 if (source->hasTagName(sourceTag)) { |
| 3420 KURL url = source->getNonEmptyURLAttribute(srcAttr); | 3420 KURL url = source->getNonEmptyURLAttribute(srcAttr); |
| 3421 LOG(Media, "HTMLMediaElement::sourceWasRemoved - 'src' is %s", urlForLog
gingMedia(url).utf8().data()); | 3421 LOG_INFO(Media, "HTMLMediaElement::sourceWasRemoved - 'src' is %s", urlF
orLoggingMedia(url).utf8().data()); |
| 3422 } | 3422 } |
| 3423 #endif | 3423 #endif |
| 3424 | 3424 |
| 3425 if (source != m_currentSourceNode && source != m_nextChildNodeToConsider) | 3425 if (source != m_currentSourceNode && source != m_nextChildNodeToConsider) |
| 3426 return; | 3426 return; |
| 3427 | 3427 |
| 3428 if (source == m_nextChildNodeToConsider) { | 3428 if (source == m_nextChildNodeToConsider) { |
| 3429 if (m_currentSourceNode) | 3429 if (m_currentSourceNode) |
| 3430 m_nextChildNodeToConsider = m_currentSourceNode->nextSibling(); | 3430 m_nextChildNodeToConsider = m_currentSourceNode->nextSibling(); |
| 3431 LOG(Media, "HTMLMediaElement::sourceRemoved - m_nextChildNodeToConsider
set to %p", m_nextChildNodeToConsider.get()); | 3431 LOG_INFO(Media, "HTMLMediaElement::sourceRemoved - m_nextChildNodeToCons
ider set to %p", m_nextChildNodeToConsider.get()); |
| 3432 } else if (source == m_currentSourceNode) { | 3432 } else if (source == m_currentSourceNode) { |
| 3433 // Clear the current source node pointer, but don't change the movie as
the spec says: | 3433 // Clear the current source node pointer, but don't change the movie as
the spec says: |
| 3434 // 4.8.8 - Dynamically modifying a source element and its attribute when
the element is already | 3434 // 4.8.8 - Dynamically modifying a source element and its attribute when
the element is already |
| 3435 // inserted in a video or audio element will have no effect. | 3435 // inserted in a video or audio element will have no effect. |
| 3436 m_currentSourceNode = 0; | 3436 m_currentSourceNode = 0; |
| 3437 LOG(Media, "HTMLMediaElement::sourceRemoved - m_currentSourceNode set to
0"); | 3437 LOG_INFO(Media, "HTMLMediaElement::sourceRemoved - m_currentSourceNode s
et to 0"); |
| 3438 } | 3438 } |
| 3439 } | 3439 } |
| 3440 | 3440 |
| 3441 void HTMLMediaElement::mediaPlayerTimeChanged(MediaPlayer*) | 3441 void HTMLMediaElement::mediaPlayerTimeChanged(MediaPlayer*) |
| 3442 { | 3442 { |
| 3443 LOG(Media, "HTMLMediaElement::mediaPlayerTimeChanged"); | 3443 LOG_INFO(Media, "HTMLMediaElement::mediaPlayerTimeChanged"); |
| 3444 | 3444 |
| 3445 #if ENABLE(VIDEO_TRACK) | 3445 #if ENABLE(VIDEO_TRACK) |
| 3446 if (RuntimeEnabledFeatures::webkitVideoTrackEnabled()) | 3446 if (RuntimeEnabledFeatures::webkitVideoTrackEnabled()) |
| 3447 updateActiveTextTrackCues(currentTime()); | 3447 updateActiveTextTrackCues(currentTime()); |
| 3448 #endif | 3448 #endif |
| 3449 | 3449 |
| 3450 beginProcessingMediaPlayerCallback(); | 3450 beginProcessingMediaPlayerCallback(); |
| 3451 | 3451 |
| 3452 invalidateCachedTime(); | 3452 invalidateCachedTime(); |
| 3453 | 3453 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3492 } | 3492 } |
| 3493 else | 3493 else |
| 3494 m_sentEndEvent = false; | 3494 m_sentEndEvent = false; |
| 3495 | 3495 |
| 3496 updatePlayState(); | 3496 updatePlayState(); |
| 3497 endProcessingMediaPlayerCallback(); | 3497 endProcessingMediaPlayerCallback(); |
| 3498 } | 3498 } |
| 3499 | 3499 |
| 3500 void HTMLMediaElement::mediaPlayerVolumeChanged(MediaPlayer*) | 3500 void HTMLMediaElement::mediaPlayerVolumeChanged(MediaPlayer*) |
| 3501 { | 3501 { |
| 3502 LOG(Media, "HTMLMediaElement::mediaPlayerVolumeChanged"); | 3502 LOG_INFO(Media, "HTMLMediaElement::mediaPlayerVolumeChanged"); |
| 3503 | 3503 |
| 3504 beginProcessingMediaPlayerCallback(); | 3504 beginProcessingMediaPlayerCallback(); |
| 3505 if (m_player) { | 3505 if (m_player) { |
| 3506 float vol = m_player->volume(); | 3506 float vol = m_player->volume(); |
| 3507 if (vol != m_volume) { | 3507 if (vol != m_volume) { |
| 3508 m_volume = vol; | 3508 m_volume = vol; |
| 3509 updateVolume(); | 3509 updateVolume(); |
| 3510 scheduleEvent(eventNames().volumechangeEvent); | 3510 scheduleEvent(eventNames().volumechangeEvent); |
| 3511 } | 3511 } |
| 3512 } | 3512 } |
| 3513 endProcessingMediaPlayerCallback(); | 3513 endProcessingMediaPlayerCallback(); |
| 3514 } | 3514 } |
| 3515 | 3515 |
| 3516 void HTMLMediaElement::mediaPlayerMuteChanged(MediaPlayer*) | 3516 void HTMLMediaElement::mediaPlayerMuteChanged(MediaPlayer*) |
| 3517 { | 3517 { |
| 3518 LOG(Media, "HTMLMediaElement::mediaPlayerMuteChanged"); | 3518 LOG_INFO(Media, "HTMLMediaElement::mediaPlayerMuteChanged"); |
| 3519 | 3519 |
| 3520 beginProcessingMediaPlayerCallback(); | 3520 beginProcessingMediaPlayerCallback(); |
| 3521 if (m_player) | 3521 if (m_player) |
| 3522 setMuted(m_player->muted()); | 3522 setMuted(m_player->muted()); |
| 3523 endProcessingMediaPlayerCallback(); | 3523 endProcessingMediaPlayerCallback(); |
| 3524 } | 3524 } |
| 3525 | 3525 |
| 3526 void HTMLMediaElement::mediaPlayerDurationChanged(MediaPlayer* player) | 3526 void HTMLMediaElement::mediaPlayerDurationChanged(MediaPlayer* player) |
| 3527 { | 3527 { |
| 3528 LOG(Media, "HTMLMediaElement::mediaPlayerDurationChanged"); | 3528 LOG_INFO(Media, "HTMLMediaElement::mediaPlayerDurationChanged"); |
| 3529 | 3529 |
| 3530 beginProcessingMediaPlayerCallback(); | 3530 beginProcessingMediaPlayerCallback(); |
| 3531 | 3531 |
| 3532 scheduleEvent(eventNames().durationchangeEvent); | 3532 scheduleEvent(eventNames().durationchangeEvent); |
| 3533 mediaPlayerCharacteristicChanged(player); | 3533 mediaPlayerCharacteristicChanged(player); |
| 3534 | 3534 |
| 3535 float now = currentTime(); | 3535 float now = currentTime(); |
| 3536 float dur = duration(); | 3536 float dur = duration(); |
| 3537 if (now > dur) | 3537 if (now > dur) |
| 3538 seek(dur, IGNORE_EXCEPTION); | 3538 seek(dur, IGNORE_EXCEPTION); |
| 3539 | 3539 |
| 3540 endProcessingMediaPlayerCallback(); | 3540 endProcessingMediaPlayerCallback(); |
| 3541 } | 3541 } |
| 3542 | 3542 |
| 3543 void HTMLMediaElement::mediaPlayerRateChanged(MediaPlayer*) | 3543 void HTMLMediaElement::mediaPlayerRateChanged(MediaPlayer*) |
| 3544 { | 3544 { |
| 3545 LOG(Media, "HTMLMediaElement::mediaPlayerRateChanged"); | 3545 LOG_INFO(Media, "HTMLMediaElement::mediaPlayerRateChanged"); |
| 3546 | 3546 |
| 3547 beginProcessingMediaPlayerCallback(); | 3547 beginProcessingMediaPlayerCallback(); |
| 3548 | 3548 |
| 3549 // Stash the rate in case the one we tried to set isn't what the engine is | 3549 // Stash the rate in case the one we tried to set isn't what the engine is |
| 3550 // using (eg. it can't handle the rate we set) | 3550 // using (eg. it can't handle the rate we set) |
| 3551 m_playbackRate = m_player->rate(); | 3551 m_playbackRate = m_player->rate(); |
| 3552 if (m_playing) | 3552 if (m_playing) |
| 3553 invalidateCachedTime(); | 3553 invalidateCachedTime(); |
| 3554 | 3554 |
| 3555 #if PLATFORM(MAC) | 3555 #if PLATFORM(MAC) |
| 3556 updateDisableSleep(); | 3556 updateDisableSleep(); |
| 3557 #endif | 3557 #endif |
| 3558 | 3558 |
| 3559 endProcessingMediaPlayerCallback(); | 3559 endProcessingMediaPlayerCallback(); |
| 3560 } | 3560 } |
| 3561 | 3561 |
| 3562 void HTMLMediaElement::mediaPlayerPlaybackStateChanged(MediaPlayer*) | 3562 void HTMLMediaElement::mediaPlayerPlaybackStateChanged(MediaPlayer*) |
| 3563 { | 3563 { |
| 3564 LOG(Media, "HTMLMediaElement::mediaPlayerPlaybackStateChanged"); | 3564 LOG_INFO(Media, "HTMLMediaElement::mediaPlayerPlaybackStateChanged"); |
| 3565 | 3565 |
| 3566 if (!m_player || m_pausedInternal) | 3566 if (!m_player || m_pausedInternal) |
| 3567 return; | 3567 return; |
| 3568 | 3568 |
| 3569 beginProcessingMediaPlayerCallback(); | 3569 beginProcessingMediaPlayerCallback(); |
| 3570 if (m_player->paused()) | 3570 if (m_player->paused()) |
| 3571 pauseInternal(); | 3571 pauseInternal(); |
| 3572 else | 3572 else |
| 3573 playInternal(); | 3573 playInternal(); |
| 3574 endProcessingMediaPlayerCallback(); | 3574 endProcessingMediaPlayerCallback(); |
| 3575 } | 3575 } |
| 3576 | 3576 |
| 3577 void HTMLMediaElement::mediaPlayerSawUnsupportedTracks(MediaPlayer*) | 3577 void HTMLMediaElement::mediaPlayerSawUnsupportedTracks(MediaPlayer*) |
| 3578 { | 3578 { |
| 3579 LOG(Media, "HTMLMediaElement::mediaPlayerSawUnsupportedTracks"); | 3579 LOG_INFO(Media, "HTMLMediaElement::mediaPlayerSawUnsupportedTracks"); |
| 3580 | 3580 |
| 3581 // The MediaPlayer came across content it cannot completely handle. | 3581 // The MediaPlayer came across content it cannot completely handle. |
| 3582 // This is normally acceptable except when we are in a standalone | 3582 // This is normally acceptable except when we are in a standalone |
| 3583 // MediaDocument. If so, tell the document what has happened. | 3583 // MediaDocument. If so, tell the document what has happened. |
| 3584 if (ownerDocument()->isMediaDocument()) { | 3584 if (ownerDocument()->isMediaDocument()) { |
| 3585 MediaDocument* mediaDocument = toMediaDocument(ownerDocument()); | 3585 MediaDocument* mediaDocument = toMediaDocument(ownerDocument()); |
| 3586 mediaDocument->mediaElementSawUnsupportedTracks(); | 3586 mediaDocument->mediaElementSawUnsupportedTracks(); |
| 3587 } | 3587 } |
| 3588 } | 3588 } |
| 3589 | 3589 |
| 3590 void HTMLMediaElement::mediaPlayerResourceNotSupported(MediaPlayer*) | 3590 void HTMLMediaElement::mediaPlayerResourceNotSupported(MediaPlayer*) |
| 3591 { | 3591 { |
| 3592 LOG(Media, "HTMLMediaElement::mediaPlayerResourceNotSupported"); | 3592 LOG_INFO(Media, "HTMLMediaElement::mediaPlayerResourceNotSupported"); |
| 3593 | 3593 |
| 3594 // The MediaPlayer came across content which no installed engine supports. | 3594 // The MediaPlayer came across content which no installed engine supports. |
| 3595 mediaLoadingFailed(MediaPlayer::FormatError); | 3595 mediaLoadingFailed(MediaPlayer::FormatError); |
| 3596 } | 3596 } |
| 3597 | 3597 |
| 3598 // MediaPlayerPresentation methods | 3598 // MediaPlayerPresentation methods |
| 3599 void HTMLMediaElement::mediaPlayerRepaint(MediaPlayer*) | 3599 void HTMLMediaElement::mediaPlayerRepaint(MediaPlayer*) |
| 3600 { | 3600 { |
| 3601 beginProcessingMediaPlayerCallback(); | 3601 beginProcessingMediaPlayerCallback(); |
| 3602 updateDisplayState(); | 3602 updateDisplayState(); |
| 3603 if (renderer()) | 3603 if (renderer()) |
| 3604 renderer()->repaint(); | 3604 renderer()->repaint(); |
| 3605 endProcessingMediaPlayerCallback(); | 3605 endProcessingMediaPlayerCallback(); |
| 3606 } | 3606 } |
| 3607 | 3607 |
| 3608 void HTMLMediaElement::mediaPlayerSizeChanged(MediaPlayer*) | 3608 void HTMLMediaElement::mediaPlayerSizeChanged(MediaPlayer*) |
| 3609 { | 3609 { |
| 3610 LOG(Media, "HTMLMediaElement::mediaPlayerSizeChanged"); | 3610 LOG_INFO(Media, "HTMLMediaElement::mediaPlayerSizeChanged"); |
| 3611 | 3611 |
| 3612 beginProcessingMediaPlayerCallback(); | 3612 beginProcessingMediaPlayerCallback(); |
| 3613 if (renderer()) | 3613 if (renderer()) |
| 3614 renderer()->updateFromElement(); | 3614 renderer()->updateFromElement(); |
| 3615 endProcessingMediaPlayerCallback(); | 3615 endProcessingMediaPlayerCallback(); |
| 3616 } | 3616 } |
| 3617 | 3617 |
| 3618 #if USE(ACCELERATED_COMPOSITING) | 3618 #if USE(ACCELERATED_COMPOSITING) |
| 3619 bool HTMLMediaElement::mediaPlayerRenderingCanBeAccelerated(MediaPlayer*) | 3619 bool HTMLMediaElement::mediaPlayerRenderingCanBeAccelerated(MediaPlayer*) |
| 3620 { | 3620 { |
| 3621 if (renderer() && renderer()->isVideo()) { | 3621 if (renderer() && renderer()->isVideo()) { |
| 3622 ASSERT(renderer()->view()); | 3622 ASSERT(renderer()->view()); |
| 3623 return renderer()->view()->compositor()->canAccelerateVideoRendering(toR
enderVideo(renderer())); | 3623 return renderer()->view()->compositor()->canAccelerateVideoRendering(toR
enderVideo(renderer())); |
| 3624 } | 3624 } |
| 3625 return false; | 3625 return false; |
| 3626 } | 3626 } |
| 3627 | 3627 |
| 3628 void HTMLMediaElement::mediaPlayerRenderingModeChanged(MediaPlayer*) | 3628 void HTMLMediaElement::mediaPlayerRenderingModeChanged(MediaPlayer*) |
| 3629 { | 3629 { |
| 3630 LOG(Media, "HTMLMediaElement::mediaPlayerRenderingModeChanged"); | 3630 LOG_INFO(Media, "HTMLMediaElement::mediaPlayerRenderingModeChanged"); |
| 3631 | 3631 |
| 3632 // Kick off a fake recalcStyle that will update the compositing tree. | 3632 // Kick off a fake recalcStyle that will update the compositing tree. |
| 3633 setNeedsStyleRecalc(SyntheticStyleChange); | 3633 setNeedsStyleRecalc(SyntheticStyleChange); |
| 3634 } | 3634 } |
| 3635 #endif | 3635 #endif |
| 3636 | 3636 |
| 3637 #if PLATFORM(WIN) && USE(AVFOUNDATION) | 3637 #if PLATFORM(WIN) && USE(AVFOUNDATION) |
| 3638 GraphicsDeviceAdapter* HTMLMediaElement::mediaPlayerGraphicsDeviceAdapter(const
MediaPlayer*) const | 3638 GraphicsDeviceAdapter* HTMLMediaElement::mediaPlayerGraphicsDeviceAdapter(const
MediaPlayer*) const |
| 3639 { | 3639 { |
| 3640 if (!document() || !document()->page()) | 3640 if (!document() || !document()->page()) |
| 3641 return 0; | 3641 return 0; |
| 3642 | 3642 |
| 3643 return document()->page()->chrome()->client()->graphicsDeviceAdapter(); | 3643 return document()->page()->chrome()->client()->graphicsDeviceAdapter(); |
| 3644 } | 3644 } |
| 3645 #endif | 3645 #endif |
| 3646 | 3646 |
| 3647 void HTMLMediaElement::mediaPlayerEngineUpdated(MediaPlayer*) | 3647 void HTMLMediaElement::mediaPlayerEngineUpdated(MediaPlayer*) |
| 3648 { | 3648 { |
| 3649 LOG(Media, "HTMLMediaElement::mediaPlayerEngineUpdated"); | 3649 LOG_INFO(Media, "HTMLMediaElement::mediaPlayerEngineUpdated"); |
| 3650 beginProcessingMediaPlayerCallback(); | 3650 beginProcessingMediaPlayerCallback(); |
| 3651 if (renderer()) | 3651 if (renderer()) |
| 3652 renderer()->updateFromElement(); | 3652 renderer()->updateFromElement(); |
| 3653 endProcessingMediaPlayerCallback(); | 3653 endProcessingMediaPlayerCallback(); |
| 3654 } | 3654 } |
| 3655 | 3655 |
| 3656 void HTMLMediaElement::mediaPlayerFirstVideoFrameAvailable(MediaPlayer*) | 3656 void HTMLMediaElement::mediaPlayerFirstVideoFrameAvailable(MediaPlayer*) |
| 3657 { | 3657 { |
| 3658 LOG(Media, "HTMLMediaElement::mediaPlayerFirstVideoFrameAvailable"); | 3658 LOG_INFO(Media, "HTMLMediaElement::mediaPlayerFirstVideoFrameAvailable"); |
| 3659 beginProcessingMediaPlayerCallback(); | 3659 beginProcessingMediaPlayerCallback(); |
| 3660 if (displayMode() == PosterWaitingForVideo) { | 3660 if (displayMode() == PosterWaitingForVideo) { |
| 3661 setDisplayMode(Video); | 3661 setDisplayMode(Video); |
| 3662 #if USE(ACCELERATED_COMPOSITING) | 3662 #if USE(ACCELERATED_COMPOSITING) |
| 3663 mediaPlayerRenderingModeChanged(m_player.get()); | 3663 mediaPlayerRenderingModeChanged(m_player.get()); |
| 3664 #endif | 3664 #endif |
| 3665 } | 3665 } |
| 3666 endProcessingMediaPlayerCallback(); | 3666 endProcessingMediaPlayerCallback(); |
| 3667 } | 3667 } |
| 3668 | 3668 |
| 3669 void HTMLMediaElement::mediaPlayerCharacteristicChanged(MediaPlayer*) | 3669 void HTMLMediaElement::mediaPlayerCharacteristicChanged(MediaPlayer*) |
| 3670 { | 3670 { |
| 3671 LOG(Media, "HTMLMediaElement::mediaPlayerCharacteristicChanged"); | 3671 LOG_INFO(Media, "HTMLMediaElement::mediaPlayerCharacteristicChanged"); |
| 3672 | 3672 |
| 3673 beginProcessingMediaPlayerCallback(); | 3673 beginProcessingMediaPlayerCallback(); |
| 3674 if (hasMediaControls()) | 3674 if (hasMediaControls()) |
| 3675 mediaControls()->reset(); | 3675 mediaControls()->reset(); |
| 3676 if (renderer()) | 3676 if (renderer()) |
| 3677 renderer()->updateFromElement(); | 3677 renderer()->updateFromElement(); |
| 3678 endProcessingMediaPlayerCallback(); | 3678 endProcessingMediaPlayerCallback(); |
| 3679 } | 3679 } |
| 3680 | 3680 |
| 3681 PassRefPtr<TimeRanges> HTMLMediaElement::buffered() const | 3681 PassRefPtr<TimeRanges> HTMLMediaElement::buffered() const |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3808 refreshCachedTime(); | 3808 refreshCachedTime(); |
| 3809 m_playbackProgressTimer.stop(); | 3809 m_playbackProgressTimer.stop(); |
| 3810 if (hasMediaControls()) | 3810 if (hasMediaControls()) |
| 3811 mediaControls()->playbackStopped(); | 3811 mediaControls()->playbackStopped(); |
| 3812 return; | 3812 return; |
| 3813 } | 3813 } |
| 3814 | 3814 |
| 3815 bool shouldBePlaying = potentiallyPlaying(); | 3815 bool shouldBePlaying = potentiallyPlaying(); |
| 3816 bool playerPaused = m_player->paused(); | 3816 bool playerPaused = m_player->paused(); |
| 3817 | 3817 |
| 3818 LOG(Media, "HTMLMediaElement::updatePlayState - shouldBePlaying = %s, player
Paused = %s", | 3818 LOG_INFO(Media, "HTMLMediaElement::updatePlayState - shouldBePlaying = %s, p
layerPaused = %s", |
| 3819 boolString(shouldBePlaying), boolString(playerPaused)); | 3819 boolString(shouldBePlaying), boolString(playerPaused)); |
| 3820 | 3820 |
| 3821 if (shouldBePlaying) { | 3821 if (shouldBePlaying) { |
| 3822 setDisplayMode(Video); | 3822 setDisplayMode(Video); |
| 3823 invalidateCachedTime(); | 3823 invalidateCachedTime(); |
| 3824 | 3824 |
| 3825 if (playerPaused) { | 3825 if (playerPaused) { |
| 3826 if (!m_isFullscreen && isVideo() && document() && document()->page()
&& document()->page()->chrome()->requiresFullscreenForVideoPlayback()) | 3826 if (!m_isFullscreen && isVideo() && document() && document()->page()
&& document()->page()->chrome()->requiresFullscreenForVideoPlayback()) |
| 3827 enterFullscreen(); | 3827 enterFullscreen(); |
| 3828 | 3828 |
| 3829 // Set rate, muted before calling play in case they were set before
the media engine was setup. | 3829 // Set rate, muted before calling play in case they were set before
the media engine was setup. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3870 } | 3870 } |
| 3871 | 3871 |
| 3872 void HTMLMediaElement::stopPeriodicTimers() | 3872 void HTMLMediaElement::stopPeriodicTimers() |
| 3873 { | 3873 { |
| 3874 m_progressEventTimer.stop(); | 3874 m_progressEventTimer.stop(); |
| 3875 m_playbackProgressTimer.stop(); | 3875 m_playbackProgressTimer.stop(); |
| 3876 } | 3876 } |
| 3877 | 3877 |
| 3878 void HTMLMediaElement::userCancelledLoad() | 3878 void HTMLMediaElement::userCancelledLoad() |
| 3879 { | 3879 { |
| 3880 LOG(Media, "HTMLMediaElement::userCancelledLoad"); | 3880 LOG_INFO(Media, "HTMLMediaElement::userCancelledLoad"); |
| 3881 | 3881 |
| 3882 if (m_networkState == NETWORK_EMPTY || m_completelyLoaded) | 3882 if (m_networkState == NETWORK_EMPTY || m_completelyLoaded) |
| 3883 return; | 3883 return; |
| 3884 | 3884 |
| 3885 // If the media data fetching process is aborted by the user: | 3885 // If the media data fetching process is aborted by the user: |
| 3886 | 3886 |
| 3887 // 1 - The user agent should cancel the fetching process. | 3887 // 1 - The user agent should cancel the fetching process. |
| 3888 clearMediaPlayer(-1); | 3888 clearMediaPlayer(-1); |
| 3889 | 3889 |
| 3890 // 2 - Set the error attribute to a new MediaError object whose code attribu
te is set to MEDIA_ERR_ABORTED. | 3890 // 2 - Set the error attribute to a new MediaError object whose code attribu
te is set to MEDIA_ERR_ABORTED. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3956 #endif | 3956 #endif |
| 3957 } | 3957 } |
| 3958 | 3958 |
| 3959 bool HTMLMediaElement::canSuspend() const | 3959 bool HTMLMediaElement::canSuspend() const |
| 3960 { | 3960 { |
| 3961 return true; | 3961 return true; |
| 3962 } | 3962 } |
| 3963 | 3963 |
| 3964 void HTMLMediaElement::stop() | 3964 void HTMLMediaElement::stop() |
| 3965 { | 3965 { |
| 3966 LOG(Media, "HTMLMediaElement::stop"); | 3966 LOG_INFO(Media, "HTMLMediaElement::stop"); |
| 3967 if (m_isFullscreen) | 3967 if (m_isFullscreen) |
| 3968 exitFullscreen(); | 3968 exitFullscreen(); |
| 3969 | 3969 |
| 3970 m_inActiveDocument = false; | 3970 m_inActiveDocument = false; |
| 3971 userCancelledLoad(); | 3971 userCancelledLoad(); |
| 3972 | 3972 |
| 3973 // Stop the playback without generating events | 3973 // Stop the playback without generating events |
| 3974 m_playing = false; | 3974 m_playing = false; |
| 3975 setPausedInternal(true); | 3975 setPausedInternal(true); |
| 3976 | 3976 |
| 3977 if (renderer()) | 3977 if (renderer()) |
| 3978 renderer()->updateFromElement(); | 3978 renderer()->updateFromElement(); |
| 3979 | 3979 |
| 3980 stopPeriodicTimers(); | 3980 stopPeriodicTimers(); |
| 3981 cancelPendingEventsAndCallbacks(); | 3981 cancelPendingEventsAndCallbacks(); |
| 3982 } | 3982 } |
| 3983 | 3983 |
| 3984 void HTMLMediaElement::suspend(ReasonForSuspension why) | 3984 void HTMLMediaElement::suspend(ReasonForSuspension why) |
| 3985 { | 3985 { |
| 3986 LOG(Media, "HTMLMediaElement::suspend"); | 3986 LOG_INFO(Media, "HTMLMediaElement::suspend"); |
| 3987 | 3987 |
| 3988 switch (why) | 3988 switch (why) |
| 3989 { | 3989 { |
| 3990 case DocumentWillBecomeInactive: | 3990 case DocumentWillBecomeInactive: |
| 3991 stop(); | 3991 stop(); |
| 3992 break; | 3992 break; |
| 3993 case PageWillBeSuspended: | 3993 case PageWillBeSuspended: |
| 3994 case JavaScriptDebuggerPaused: | 3994 case JavaScriptDebuggerPaused: |
| 3995 case WillDeferLoading: | 3995 case WillDeferLoading: |
| 3996 // Do nothing, we don't pause media playback in these cases. | 3996 // Do nothing, we don't pause media playback in these cases. |
| 3997 break; | 3997 break; |
| 3998 } | 3998 } |
| 3999 } | 3999 } |
| 4000 | 4000 |
| 4001 void HTMLMediaElement::resume() | 4001 void HTMLMediaElement::resume() |
| 4002 { | 4002 { |
| 4003 LOG(Media, "HTMLMediaElement::resume"); | 4003 LOG_INFO(Media, "HTMLMediaElement::resume"); |
| 4004 | 4004 |
| 4005 m_inActiveDocument = true; | 4005 m_inActiveDocument = true; |
| 4006 setPausedInternal(false); | 4006 setPausedInternal(false); |
| 4007 | 4007 |
| 4008 if (m_error && m_error->code() == MediaError::MEDIA_ERR_ABORTED) { | 4008 if (m_error && m_error->code() == MediaError::MEDIA_ERR_ABORTED) { |
| 4009 // Restart the load if it was aborted in the middle by moving the docume
nt to the page cache. | 4009 // Restart the load if it was aborted in the middle by moving the docume
nt to the page cache. |
| 4010 // m_error is only left at MEDIA_ERR_ABORTED when the document becomes i
nactive (it is set to | 4010 // m_error is only left at MEDIA_ERR_ABORTED when the document becomes i
nactive (it is set to |
| 4011 // MEDIA_ERR_ABORTED while the abortEvent is being sent, but cleared im
mediately afterwards). | 4011 // MEDIA_ERR_ABORTED while the abortEvent is being sent, but cleared im
mediately afterwards). |
| 4012 // This behavior is not specified but it seems like a sensible thing to
do. | 4012 // This behavior is not specified but it seems like a sensible thing to
do. |
| 4013 // As it is not safe to immedately start loading now, let's schedule a l
oad. | 4013 // As it is not safe to immedately start loading now, let's schedule a l
oad. |
| 4014 scheduleDelayedAction(LoadMediaResource); | 4014 scheduleDelayedAction(LoadMediaResource); |
| 4015 } | 4015 } |
| 4016 | 4016 |
| 4017 if (renderer()) | 4017 if (renderer()) |
| 4018 renderer()->updateFromElement(); | 4018 renderer()->updateFromElement(); |
| 4019 } | 4019 } |
| 4020 | 4020 |
| 4021 bool HTMLMediaElement::hasPendingActivity() const | 4021 bool HTMLMediaElement::hasPendingActivity() const |
| 4022 { | 4022 { |
| 4023 return (hasAudio() && isPlaying()) || m_asyncEventQueue->hasPendingEvents(); | 4023 return (hasAudio() && isPlaying()) || m_asyncEventQueue->hasPendingEvents(); |
| 4024 } | 4024 } |
| 4025 | 4025 |
| 4026 void HTMLMediaElement::mediaVolumeDidChange() | 4026 void HTMLMediaElement::mediaVolumeDidChange() |
| 4027 { | 4027 { |
| 4028 LOG(Media, "HTMLMediaElement::mediaVolumeDidChange"); | 4028 LOG_INFO(Media, "HTMLMediaElement::mediaVolumeDidChange"); |
| 4029 updateVolume(); | 4029 updateVolume(); |
| 4030 } | 4030 } |
| 4031 | 4031 |
| 4032 void HTMLMediaElement::defaultEventHandler(Event* event) | 4032 void HTMLMediaElement::defaultEventHandler(Event* event) |
| 4033 { | 4033 { |
| 4034 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) | 4034 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) |
| 4035 RenderObject* r = renderer(); | 4035 RenderObject* r = renderer(); |
| 4036 if (!r || !r->isWidget()) | 4036 if (!r || !r->isWidget()) |
| 4037 return; | 4037 return; |
| 4038 | 4038 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4126 { | 4126 { |
| 4127 ensureMediaPlayer(); | 4127 ensureMediaPlayer(); |
| 4128 | 4128 |
| 4129 if (m_proxyWidget || (inDocument() && !m_needWidgetUpdate)) | 4129 if (m_proxyWidget || (inDocument() && !m_needWidgetUpdate)) |
| 4130 return; | 4130 return; |
| 4131 | 4131 |
| 4132 Frame* frame = document()->frame(); | 4132 Frame* frame = document()->frame(); |
| 4133 if (!frame) | 4133 if (!frame) |
| 4134 return; | 4134 return; |
| 4135 | 4135 |
| 4136 LOG(Media, "HTMLMediaElement::createMediaPlayerProxy"); | 4136 LOG_INFO(Media, "HTMLMediaElement::createMediaPlayerProxy"); |
| 4137 | 4137 |
| 4138 KURL url; | 4138 KURL url; |
| 4139 Vector<String> paramNames; | 4139 Vector<String> paramNames; |
| 4140 Vector<String> paramValues; | 4140 Vector<String> paramValues; |
| 4141 | 4141 |
| 4142 getPluginProxyParams(url, paramNames, paramValues); | 4142 getPluginProxyParams(url, paramNames, paramValues); |
| 4143 | 4143 |
| 4144 // Hang onto the proxy widget so it won't be destroyed if the plug-in is set
to | 4144 // Hang onto the proxy widget so it won't be destroyed if the plug-in is set
to |
| 4145 // display:none | 4145 // display:none |
| 4146 m_proxyWidget = frame->loader()->subframeLoader()->loadMediaPlayerProxyPlugi
n(this, url, paramNames, paramValues); | 4146 m_proxyWidget = frame->loader()->subframeLoader()->loadMediaPlayerProxyPlugi
n(this, url, paramNames, paramValues); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 4173 #if ENABLE(FULLSCREEN_API) | 4173 #if ENABLE(FULLSCREEN_API) |
| 4174 if (document()->webkitIsFullScreen() && document()->webkitCurrentFullScreenE
lement() == this) | 4174 if (document()->webkitIsFullScreen() && document()->webkitCurrentFullScreenE
lement() == this) |
| 4175 return true; | 4175 return true; |
| 4176 #endif | 4176 #endif |
| 4177 | 4177 |
| 4178 return false; | 4178 return false; |
| 4179 } | 4179 } |
| 4180 | 4180 |
| 4181 void HTMLMediaElement::enterFullscreen() | 4181 void HTMLMediaElement::enterFullscreen() |
| 4182 { | 4182 { |
| 4183 LOG(Media, "HTMLMediaElement::enterFullscreen"); | 4183 LOG_INFO(Media, "HTMLMediaElement::enterFullscreen"); |
| 4184 | 4184 |
| 4185 #if ENABLE(FULLSCREEN_API) | 4185 #if ENABLE(FULLSCREEN_API) |
| 4186 if (document() && document()->settings() && document()->settings()->fullScre
enEnabled()) { | 4186 if (document() && document()->settings() && document()->settings()->fullScre
enEnabled()) { |
| 4187 document()->requestFullScreenForElement(this, 0, Document::ExemptIFrameA
llowFullScreenRequirement); | 4187 document()->requestFullScreenForElement(this, 0, Document::ExemptIFrameA
llowFullScreenRequirement); |
| 4188 return; | 4188 return; |
| 4189 } | 4189 } |
| 4190 #endif | 4190 #endif |
| 4191 ASSERT(!m_isFullscreen); | 4191 ASSERT(!m_isFullscreen); |
| 4192 m_isFullscreen = true; | 4192 m_isFullscreen = true; |
| 4193 if (hasMediaControls()) | 4193 if (hasMediaControls()) |
| 4194 mediaControls()->enteredFullscreen(); | 4194 mediaControls()->enteredFullscreen(); |
| 4195 if (document() && document()->page()) { | 4195 if (document() && document()->page()) { |
| 4196 document()->page()->chrome()->client()->enterFullscreenForNode(this); | 4196 document()->page()->chrome()->client()->enterFullscreenForNode(this); |
| 4197 scheduleEvent(eventNames().webkitbeginfullscreenEvent); | 4197 scheduleEvent(eventNames().webkitbeginfullscreenEvent); |
| 4198 } | 4198 } |
| 4199 } | 4199 } |
| 4200 | 4200 |
| 4201 void HTMLMediaElement::exitFullscreen() | 4201 void HTMLMediaElement::exitFullscreen() |
| 4202 { | 4202 { |
| 4203 LOG(Media, "HTMLMediaElement::exitFullscreen"); | 4203 LOG_INFO(Media, "HTMLMediaElement::exitFullscreen"); |
| 4204 | 4204 |
| 4205 #if ENABLE(FULLSCREEN_API) | 4205 #if ENABLE(FULLSCREEN_API) |
| 4206 if (document() && document()->settings() && document()->settings()->fullScre
enEnabled()) { | 4206 if (document() && document()->settings() && document()->settings()->fullScre
enEnabled()) { |
| 4207 if (document()->webkitIsFullScreen() && document()->webkitCurrentFullScr
eenElement() == this) | 4207 if (document()->webkitIsFullScreen() && document()->webkitCurrentFullScr
eenElement() == this) |
| 4208 document()->webkitCancelFullScreen(); | 4208 document()->webkitCancelFullScreen(); |
| 4209 return; | 4209 return; |
| 4210 } | 4210 } |
| 4211 #endif | 4211 #endif |
| 4212 ASSERT(m_isFullscreen); | 4212 ASSERT(m_isFullscreen); |
| 4213 m_isFullscreen = false; | 4213 m_isFullscreen = false; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4274 { | 4274 { |
| 4275 if (!hasMediaControls() && !createMediaControls()) | 4275 if (!hasMediaControls() && !createMediaControls()) |
| 4276 return; | 4276 return; |
| 4277 | 4277 |
| 4278 mediaControls()->updateTextTrackDisplay(); | 4278 mediaControls()->updateTextTrackDisplay(); |
| 4279 } | 4279 } |
| 4280 #endif | 4280 #endif |
| 4281 | 4281 |
| 4282 void HTMLMediaElement::setClosedCaptionsVisible(bool closedCaptionVisible) | 4282 void HTMLMediaElement::setClosedCaptionsVisible(bool closedCaptionVisible) |
| 4283 { | 4283 { |
| 4284 LOG(Media, "HTMLMediaElement::setClosedCaptionsVisible(%s)", boolString(clos
edCaptionVisible)); | 4284 LOG_INFO(Media, "HTMLMediaElement::setClosedCaptionsVisible(%s)", boolString
(closedCaptionVisible)); |
| 4285 | 4285 |
| 4286 if (!m_player || !hasClosedCaptions()) | 4286 if (!m_player || !hasClosedCaptions()) |
| 4287 return; | 4287 return; |
| 4288 | 4288 |
| 4289 m_closedCaptionsVisible = closedCaptionVisible; | 4289 m_closedCaptionsVisible = closedCaptionVisible; |
| 4290 m_player->setClosedCaptionsVisible(closedCaptionVisible); | 4290 m_player->setClosedCaptionsVisible(closedCaptionVisible); |
| 4291 | 4291 |
| 4292 #if ENABLE(VIDEO_TRACK) | 4292 #if ENABLE(VIDEO_TRACK) |
| 4293 if (RuntimeEnabledFeatures::webkitVideoTrackEnabled()) { | 4293 if (RuntimeEnabledFeatures::webkitVideoTrackEnabled()) { |
| 4294 m_processingPreferenceChange = true; | 4294 m_processingPreferenceChange = true; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4328 unsigned HTMLMediaElement::webkitVideoDecodedByteCount() const | 4328 unsigned HTMLMediaElement::webkitVideoDecodedByteCount() const |
| 4329 { | 4329 { |
| 4330 if (!m_player) | 4330 if (!m_player) |
| 4331 return 0; | 4331 return 0; |
| 4332 return m_player->videoDecodedByteCount(); | 4332 return m_player->videoDecodedByteCount(); |
| 4333 } | 4333 } |
| 4334 #endif | 4334 #endif |
| 4335 | 4335 |
| 4336 void HTMLMediaElement::mediaCanStart() | 4336 void HTMLMediaElement::mediaCanStart() |
| 4337 { | 4337 { |
| 4338 LOG(Media, "HTMLMediaElement::mediaCanStart"); | 4338 LOG_INFO(Media, "HTMLMediaElement::mediaCanStart"); |
| 4339 | 4339 |
| 4340 ASSERT(m_isWaitingUntilMediaCanStart); | 4340 ASSERT(m_isWaitingUntilMediaCanStart); |
| 4341 m_isWaitingUntilMediaCanStart = false; | 4341 m_isWaitingUntilMediaCanStart = false; |
| 4342 loadInternal(); | 4342 loadInternal(); |
| 4343 } | 4343 } |
| 4344 | 4344 |
| 4345 bool HTMLMediaElement::isURLAttribute(const Attribute& attribute) const | 4345 bool HTMLMediaElement::isURLAttribute(const Attribute& attribute) const |
| 4346 { | 4346 { |
| 4347 return attribute.name() == srcAttr || HTMLElement::isURLAttribute(attribute)
; | 4347 return attribute.name() == srcAttr || HTMLElement::isURLAttribute(attribute)
; |
| 4348 } | 4348 } |
| 4349 | 4349 |
| 4350 void HTMLMediaElement::setShouldDelayLoadEvent(bool shouldDelay) | 4350 void HTMLMediaElement::setShouldDelayLoadEvent(bool shouldDelay) |
| 4351 { | 4351 { |
| 4352 if (m_shouldDelayLoadEvent == shouldDelay) | 4352 if (m_shouldDelayLoadEvent == shouldDelay) |
| 4353 return; | 4353 return; |
| 4354 | 4354 |
| 4355 LOG(Media, "HTMLMediaElement::setShouldDelayLoadEvent(%s)", boolString(shoul
dDelay)); | 4355 LOG_INFO(Media, "HTMLMediaElement::setShouldDelayLoadEvent(%s)", boolString(
shouldDelay)); |
| 4356 | 4356 |
| 4357 m_shouldDelayLoadEvent = shouldDelay; | 4357 m_shouldDelayLoadEvent = shouldDelay; |
| 4358 if (shouldDelay) | 4358 if (shouldDelay) |
| 4359 document()->incrementLoadEventDelayCount(); | 4359 document()->incrementLoadEventDelayCount(); |
| 4360 else | 4360 else |
| 4361 document()->decrementLoadEventDelayCount(); | 4361 document()->decrementLoadEventDelayCount(); |
| 4362 } | 4362 } |
| 4363 | 4363 |
| 4364 | 4364 |
| 4365 void HTMLMediaElement::getSitesInMediaCache(Vector<String>& sites) | 4365 void HTMLMediaElement::getSitesInMediaCache(Vector<String>& sites) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 4382 MediaPlayer::resetMediaEngines(); | 4382 MediaPlayer::resetMediaEngines(); |
| 4383 } | 4383 } |
| 4384 | 4384 |
| 4385 void HTMLMediaElement::privateBrowsingStateDidChange() | 4385 void HTMLMediaElement::privateBrowsingStateDidChange() |
| 4386 { | 4386 { |
| 4387 if (!m_player) | 4387 if (!m_player) |
| 4388 return; | 4388 return; |
| 4389 | 4389 |
| 4390 Settings* settings = document()->settings(); | 4390 Settings* settings = document()->settings(); |
| 4391 bool privateMode = !settings || settings->privateBrowsingEnabled(); | 4391 bool privateMode = !settings || settings->privateBrowsingEnabled(); |
| 4392 LOG(Media, "HTMLMediaElement::privateBrowsingStateDidChange(%s)", boolString
(privateMode)); | 4392 LOG_INFO(Media, "HTMLMediaElement::privateBrowsingStateDidChange(%s)", boolS
tring(privateMode)); |
| 4393 m_player->setPrivateBrowsingMode(privateMode); | 4393 m_player->setPrivateBrowsingMode(privateMode); |
| 4394 } | 4394 } |
| 4395 | 4395 |
| 4396 MediaControls* HTMLMediaElement::mediaControls() const | 4396 MediaControls* HTMLMediaElement::mediaControls() const |
| 4397 { | 4397 { |
| 4398 return toMediaControls(userAgentShadowRoot()->firstChild()); | 4398 return toMediaControls(userAgentShadowRoot()->firstChild()); |
| 4399 } | 4399 } |
| 4400 | 4400 |
| 4401 bool HTMLMediaElement::hasMediaControls() const | 4401 bool HTMLMediaElement::hasMediaControls() const |
| 4402 { | 4402 { |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4896 info.addMember(m_sleepDisabler, "sleepDisabler"); | 4896 info.addMember(m_sleepDisabler, "sleepDisabler"); |
| 4897 #endif | 4897 #endif |
| 4898 #if ENABLE(WEB_AUDIO) | 4898 #if ENABLE(WEB_AUDIO) |
| 4899 info.addMember(m_audioSourceNode, "audioSourceNode"); | 4899 info.addMember(m_audioSourceNode, "audioSourceNode"); |
| 4900 #endif | 4900 #endif |
| 4901 | 4901 |
| 4902 } | 4902 } |
| 4903 | 4903 |
| 4904 } | 4904 } |
| 4905 #endif | 4905 #endif |
| OLD | NEW |