Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (221589 => 221590)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2017-09-04 16:27:38 UTC (rev 221589)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2017-09-04 17:54:25 UTC (rev 221590)
@@ -88,7 +88,6 @@
#include "UserContentController.h"
#include "UserGestureIndicator.h"
#include <limits>
-#include <pal/Logger.h>
#include <pal/SessionID.h>
#include <pal/system/SleepDisabler.h>
#include <runtime/Uint8Array.h>
@@ -165,27 +164,8 @@
#include "VideoFullscreenModel.h"
#endif
-namespace PAL {
-template <>
-struct LogArgument<WebCore::URL> {
- static String toString(const WebCore::URL& url)
- {
-#if !LOG_DISABLED
- static const unsigned maximumURLLengthForLogging = 512;
+#define RELEASE_LOG_IF_ALLOWED(fmt, ...) RELEASE_LOG_IF(document().page() && document().page()->isAlwaysOnLoggingAllowed(), Media, "%p - HTMLMediaElement::" fmt, this, ##__VA_ARGS__)
- if (url.string().length() < maximumURLLengthForLogging)
- return url.string();
- return url.string().substring(0, maximumURLLengthForLogging) + "...";
-#else
- UNUSED_PARAM(url);
- return "[url]";
-#endif
- }
-};
-}
-
-using namespace PAL;
-
namespace WebCore {
static const Seconds SeekRepeatDelay { 100_ms };
@@ -206,7 +186,21 @@
value &= ~flags;
}
-#if !RELEASE_LOG_DISABLED
+#if !LOG_DISABLED
+static String urlForLoggingMedia(const URL& url)
+{
+ static const unsigned maximumURLLengthForLogging = 128;
+
+ if (url.string().length() < maximumURLLengthForLogging)
+ return url.string();
+ return url.string().substring(0, maximumURLLengthForLogging) + "...";
+}
+
+static const char* boolString(bool val)
+{
+ return val ? "true" : "false";
+}
+
static String actionName(HTMLMediaElementEnums::DelayedActionType action)
{
StringBuilder actionBuilder;
@@ -218,7 +212,6 @@
actionBuilder.append(#_actionType); \
} \
- ACTION(LoadMediaResource);
ACTION(ConfigureTextTracks);
ACTION(TextTrackChangesNotification);
ACTION(ConfigureTextTrackDisplay);
@@ -225,16 +218,20 @@
ACTION(CheckPlaybackTargetCompatablity);
ACTION(CheckMediaState);
ACTION(MediaEngineUpdated);
- ACTION(UpdatePlayState);
+ return actionBuilder.toString();
+
#undef ACTION
+}
- String name = actionBuilder.toString();
- ASSERT(!name.isEmpty());
- return name;
-}
#endif
+#ifndef LOG_MEDIA_EVENTS
+// Default to not logging events because so many are generated they can overwhelm the rest of
+// the logging.
+#define LOG_MEDIA_EVENTS 0
+#endif
+
#ifndef LOG_CACHED_TIME_WARNINGS
// Default to not logging warnings about excessive drift in the cached media time because it adds a
// fair amount of overhead and logging.
@@ -450,14 +447,10 @@
, m_processingPreferenceChange(false)
#endif
, m_mediaSession(std::make_unique<MediaElementSession>(*this))
-#if !RELEASE_LOG_DISABLED
- , m_logger(&document.logger())
-#endif
{
allMediaElements().add(this);
- ALWAYS_LOG(THIS);
-
+ LOG(Media, "HTMLMediaElement::HTMLMediaElement(%p)", this);
setHasCustomStyleResolveCallbacks();
m_mediaSession->addBehaviorRestriction(MediaElementSession::RequireUserGestureForFullscreen);
@@ -533,7 +526,7 @@
HTMLMediaElement::~HTMLMediaElement()
{
- ALWAYS_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::~HTMLMediaElement(%p)", this);
beginIgnoringTrackDisplayUpdateRequests();
allMediaElements().remove(this);
@@ -865,7 +858,7 @@
Node::InsertionNotificationRequest HTMLMediaElement::insertedInto(ContainerNode& insertionPoint)
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::insertedInto(%p)", this);
HTMLElement::insertedInto(insertionPoint);
if (insertionPoint.isConnected()) {
@@ -924,7 +917,7 @@
void HTMLMediaElement::removedFrom(ContainerNode& insertionPoint)
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::removedFrom(%p)", this);
m_inActiveDocument = false;
if (insertionPoint.isConnected()) {
@@ -974,8 +967,7 @@
void HTMLMediaElement::scheduleDelayedAction(DelayedActionType actionType)
{
- if (actionType ^ m_pendingActionFlags)
- ALWAYS_LOG(THIS, "setting ", actionName(actionType), " flag");
+ LOG(Media, "HTMLMediaElement::scheduleDelayedAction(%p) - setting %s flag", this, actionName(actionType).utf8().data());
#if ENABLE(VIDEO_TRACK)
if (actionType & ConfigureTextTracks)
@@ -1015,6 +1007,9 @@
void HTMLMediaElement::scheduleEvent(const AtomicString& eventName)
{
+#if LOG_MEDIA_EVENTS
+ LOG(Media, "HTMLMediaElement::scheduleEvent(%p) - scheduling '%s'", this, eventName.string().ascii().data());
+#endif
RefPtr<Event> event = Event::create(eventName, false, true);
// Don't set the event target, the event queue will set it in GenericEventQueue::timerFired and setting it here
@@ -1071,11 +1066,6 @@
PendingActionFlags pendingActions = m_pendingActionFlags;
m_pendingActionFlags = 0;
- if (!pendingActions)
- return;
-
- ALWAYS_LOG(THIS, "setting ", actionName(static_cast<DelayedActionType>(pendingActions)), " flag");
-
#if ENABLE(VIDEO_TRACK)
if (pendingActions & ConfigureTextTracks)
configureTextTracks();
@@ -1083,7 +1073,7 @@
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
if (pendingActions & CheckPlaybackTargetCompatablity && m_isPlayingToWirelessTarget && !m_player->canPlayToWirelessPlaybackTarget()) {
- NOTICE_LOG(THIS, "calling setShouldPlayToPlaybackTarget(false)");
+ LOG(Media, "HTMLMediaElement::pendingActionTimerFired(%p) - calling setShouldPlayToPlaybackTarget(false)", this);
m_failedToPlayToWirelessTarget = true;
m_player->setShouldPlayToPlaybackTarget(false);
}
@@ -1160,7 +1150,7 @@
break;
}
- DEBUG_LOG(THIS, "[", mimeType, "] -> ", canPlay);
+ LOG(Media, "HTMLMediaElement::canPlayType(%p) - [%s] -> %s", this, mimeType.utf8().data(), canPlay.utf8().data());
return canPlay;
}
@@ -1176,7 +1166,7 @@
{
Ref<HTMLMediaElement> protectedThis(*this); // prepareForLoad may result in a 'beforeload' event, which can make arbitrary DOM mutations.
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::load(%p)", this);
if (!m_mediaSession->dataLoadingPermitted(*this))
return;
@@ -1195,7 +1185,7 @@
// The Media Element Load Algorithm
// 12 February 2017
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::prepareForLoad(%p)", this);
// 1 - Abort any already-running instance of the resource selection algorithm for this element.
// Perform the cleanup required for the resource load algorithm to run.
@@ -1314,7 +1304,7 @@
return;
if (!m_mediaSession->pageAllowsDataLoading(*this)) {
- ALWAYS_LOG(THIS, "not allowed to load in background, waiting");
+ LOG(Media, "HTMLMediaElement::selectMediaResource(%p) - not allowed to load in background, waiting", this);
setShouldDelayLoadEvent(false);
if (m_isWaitingUntilMediaCanStart)
return;
@@ -1359,7 +1349,7 @@
mode = Attribute;
ASSERT(m_player);
if (!m_player) {
- ERROR_LOG(THIS, " - has srcAttr but m_player is not created");
+ RELEASE_LOG_ERROR(Media, "HTMLMediaElement::selectMediaResource(%p) - has srcAttr but m_player is not created", this);
return;
}
} else if (auto firstSource = childrenOfType<HTMLSourceElement>(*this).first()) {
@@ -1376,7 +1366,7 @@
setShouldDelayLoadEvent(false);
m_networkState = NETWORK_EMPTY;
- ALWAYS_LOG(THIS, "nothing to load");
+ LOG(Media, "HTMLMediaElement::selectMediaResource(%p) - nothing to load", this);
return;
}
@@ -1406,7 +1396,7 @@
ContentType contentType;
loadResource(URL(), contentType, String());
- ALWAYS_LOG(THIS, "using 'srcObject' property");
+ LOG(Media, "HTMLMediaElement::selectMediaResource(%p) - using 'srcObject' property", this);
// If that algorithm returns without aborting this one, then the load failed.
// 4. Failed with media provider: Reaching this step indicates that the media resource
@@ -1429,7 +1419,7 @@
URL absoluteURL = getNonEmptyURLAttribute(srcAttr);
if (absoluteURL.isEmpty()) {
mediaLoadingFailed(MediaPlayer::FormatError);
- ALWAYS_LOG(THIS, "empty 'src'");
+ LOG(Media, "HTMLMediaElement::selectMediaResource(%p) - empty 'src'", this);
return;
}
@@ -1450,7 +1440,7 @@
// will have to pick a media engine based on the file extension.
ContentType contentType;
loadResource(absoluteURL, contentType, String());
- ALWAYS_LOG(THIS, "using 'src' attribute url");
+ LOG(Media, "HTMLMediaElement::selectMediaResource(%p) - using 'src' attribute url", this);
// 6. Failed with attribute: Reaching this step indicates that the media resource failed to load
// or that the given URL could not be resolved. Queue a task to run the dedicated media source failure steps.
@@ -1486,7 +1476,7 @@
{
ASSERT(initialURL.isEmpty() || isSafeToLoadURL(initialURL, Complain));
- NOTICE_LOG(THIS, initialURL, contentType.raw(), keySystem);
+ LOG(Media, "HTMLMediaElement::loadResource(%p) - %s, %s, %s", this, urlForLoggingMedia(initialURL).utf8().data(), contentType.raw().utf8().data(), keySystem.utf8().data());
Frame* frame = document().frame();
if (!frame) {
@@ -1540,10 +1530,10 @@
if (resource) {
url = ""
- NOTICE_LOG(THIS, "will load ", url, " from app cache");
+ LOG(Media, "HTMLMediaElement::loadResource(%p) - will load from app cache -> %s", this, urlForLoggingMedia(url).utf8().data());
}
- NOTICE_LOG(THIS, "m_currentSrc is ", m_currentSrc);
+ LOG(Media, "HTMLMediaElement::loadResource(%p) - m_currentSrc -> %s", this, urlForLoggingMedia(m_currentSrc).utf8().data());
startProgressEventTimer();
@@ -1651,7 +1641,7 @@
if (ignoreTrackDisplayUpdateRequests())
return;
- DEBUG_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::updateActiveTextTrackCues(%p)", this);
// 1 - Let current cues be a list of cues, initialized to contain all the
// cues of all the hidden, showing, or showing by default text tracks of the
@@ -2051,7 +2041,7 @@
bool HTMLMediaElement::isSafeToLoadURL(const URL& url, InvalidURLAction actionIfInvalid)
{
if (!url.isValid()) {
- ERROR_LOG(THIS, url, " is invalid");
+ LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%p) - %s -> FALSE because url is invalid", this, urlForLoggingMedia(url).utf8().data());
return false;
}
@@ -2059,12 +2049,12 @@
if (!frame || !document().securityOrigin().canDisplay(url)) {
if (actionIfInvalid == Complain)
FrameLoader::reportLocalLoadFailed(frame, url.stringCenterEllipsizedToLength());
- ERROR_LOG(THIS, url , " was rejected by SecurityOrigin");
+ LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%p) - %s -> FALSE rejected by SecurityOrigin", this, urlForLoggingMedia(url).utf8().data());
return false;
}
if (!isAllowedToLoadMediaURL(*this, url, isInUserAgentShadowTree())) {
- ERROR_LOG(THIS, url, " was rejected by Content Security Policy");
+ LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%p) - %s -> rejected by Content Security Policy", this, urlForLoggingMedia(url).utf8().data());
return false;
}
@@ -2083,7 +2073,7 @@
void HTMLMediaElement::waitForSourceChange()
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::waitForSourceChange(%p)", this);
stopPeriodicTimers();
m_loadState = WaitingForSource;
@@ -2100,7 +2090,7 @@
void HTMLMediaElement::noneSupported()
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::noneSupported(%p)", this);
stopPeriodicTimers();
m_loadState = WaitingForSource;
@@ -2141,6 +2131,8 @@
void HTMLMediaElement::mediaLoadingFailedFatally(MediaPlayer::NetworkState error)
{
+ LOG(Media, "HTMLMediaElement::mediaLoadingFailedFatally(%p) - error = %d", this, static_cast<int>(error));
+
// 1 - The user agent should cancel the fetching process.
stopPeriodicTimers();
m_loadState = WaitingForSource;
@@ -2180,7 +2172,7 @@
void HTMLMediaElement::cancelPendingEventsAndCallbacks()
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::cancelPendingEventsAndCallbacks(%p)", this);
m_asyncEventQueue.cancelAllEvents();
for (auto& source : childrenOfType<HTMLSourceElement>(*this))
@@ -2245,7 +2237,7 @@
if (m_currentSourceNode)
m_currentSourceNode->scheduleErrorEvent();
else
- NOTICE_LOG(THIS, "error event not sent, <source> was removed");
+ LOG(Media, "HTMLMediaElement::setNetworkState(%p) - error event not sent, <source> was removed", this);
// 9.Otherwise.10 - Asynchronously await a stable state. The synchronous section consists of all the remaining steps of this algorithm until the algorithm says the synchronous section has ended.
@@ -2253,10 +2245,10 @@
forgetResourceSpecificTracks();
if (havePotentialSourceChild()) {
- NOTICE_LOG(THIS, "scheduling next <source>");
+ LOG(Media, "HTMLMediaElement::setNetworkState(%p) - scheduling next <source>", this);
scheduleNextSourceChild();
} else {
- NOTICE_LOG(THIS, "no more <source> elements, waiting");
+ LOG(Media, "HTMLMediaElement::setNetworkState(%p) - no more <source> elements, waiting", this);
waitForSourceChange();
}
@@ -2274,8 +2266,6 @@
mediaControls()->reportedError();
}
- ERROR_LOG(THIS, "error = ", static_cast<int>(error));
-
logMediaLoadRequest(document().page(), String(), stringForNetworkState(error), false);
m_mediaSession->clientCharacteristicsChanged();
@@ -2283,8 +2273,7 @@
void HTMLMediaElement::setNetworkState(MediaPlayer::NetworkState state)
{
- if (static_cast<int>(state) != static_cast<int>(m_networkState))
- ALWAYS_LOG(THIS, "new state = ", static_cast<int>(state), ", current state = ", static_cast<int>(m_networkState));
+ LOG(Media, "HTMLMediaElement::setNetworkState(%p) - new state = %d, current state = %d", this, static_cast<int>(state), static_cast<int>(m_networkState));
if (state == MediaPlayer::Empty) {
// Just update the cached state and leave, we can't do anything.
@@ -2355,7 +2344,7 @@
&& m_readyState == HAVE_ENOUGH_DATA)
return mediaSession().playbackPermitted(*this);
- ALWAYS_LOG(THIS, "page consent required");
+ RELEASE_LOG(Media, "HTMLMediaElement::canTransitionFromAutoplayToPlay - page consent required");
return MediaPlaybackDenialReason::PageConsentRequired;
}
@@ -2371,6 +2360,8 @@
void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state)
{
+ LOG(Media, "HTMLMediaElement::setReadyState(%p) - new state = %d, current state = %d,", this, static_cast<int>(state), static_cast<int>(m_readyState));
+
// Set "wasPotentiallyPlaying" BEFORE updating m_readyState, potentiallyPlaying() uses it
bool wasPotentiallyPlaying = potentiallyPlaying();
@@ -2390,8 +2381,6 @@
bool tracksAreReady = true;
#endif
- ALWAYS_LOG(THIS, "new state = ", static_cast<int>(state), ", current state = ", static_cast<int>(m_readyState));
-
if (tracksAreReady)
m_readyState = newState;
else {
@@ -2771,17 +2760,19 @@
void HTMLMediaElement::rewind(double timeDelta)
{
+ LOG(Media, "HTMLMediaElement::rewind(%p) - %f", this, timeDelta);
setCurrentTime(std::max(currentMediaTime() - MediaTime::createWithDouble(timeDelta), minTimeSeekable()));
}
void HTMLMediaElement::returnToRealtime()
{
+ LOG(Media, "HTMLMediaElement::returnToRealtime(%p)", this);
setCurrentTime(maxTimeSeekable());
}
void HTMLMediaElement::addPlayedRange(const MediaTime& start, const MediaTime& end)
{
- DEBUG_LOG(THIS, "[", start, ", ", end, "]");
+ LOG(Media, "HTMLMediaElement::addPlayedRange(%p) - [%s, %s]", this, toString(start).utf8().data(), toString(end).utf8().data());
if (!m_playedTimeRanges)
m_playedTimeRanges = TimeRanges::create();
m_playedTimeRanges->ranges().add(start, end);
@@ -2794,7 +2785,7 @@
void HTMLMediaElement::prepareToPlay()
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::prepareToPlay(%p)", this);
if (m_havePreparedToPlay)
return;
m_havePreparedToPlay = true;
@@ -2809,7 +2800,7 @@
void HTMLMediaElement::fastSeek(const MediaTime& time)
{
- NOTICE_LOG(THIS, time);
+ LOG(Media, "HTMLMediaElement::fastSeek(%p) - %s", this, toString(time).utf8().data());
// 4.7.10.9 Seeking
// 9. If the approximate-for-speed flag is set, adjust the new playback position to a value that will
// allow for playback to resume promptly. If new playback position before this step is before current
@@ -2825,13 +2816,13 @@
void HTMLMediaElement::seek(const MediaTime& time)
{
- NOTICE_LOG(THIS, time);
+ LOG(Media, "HTMLMediaElement::seek(%p) - %s", this, toString(time).utf8().data());
seekWithTolerance(time, MediaTime::zeroTime(), MediaTime::zeroTime(), true);
}
void HTMLMediaElement::seekInternal(const MediaTime& time)
{
- NOTICE_LOG(THIS, time);
+ LOG(Media, "HTMLMediaElement::seekInternal(%p) - %s", this, toString(time).utf8().data());
seekWithTolerance(time, MediaTime::zeroTime(), MediaTime::zeroTime(), false);
}
@@ -2859,7 +2850,7 @@
// already running. Abort that other instance of the algorithm without waiting for the step that
// it is running to complete.
if (m_seekTaskQueue.hasPendingTasks()) {
- NOTICE_LOG(THIS, "cancelling pending seeks");
+ LOG(Media, "HTMLMediaElement::seekWithTolerance(%p) - cancelling pending seeks", this);
m_seekTaskQueue.cancelAllTasks();
if (m_pendingSeek) {
now = m_pendingSeek->now;
@@ -2881,7 +2872,7 @@
// the script. The remainder of these steps must be run asynchronously.
m_pendingSeek = std::make_unique<PendingSeek>(now, time, negativeTolerance, positiveTolerance);
if (fromDOM) {
- NOTICE_LOG(THIS, "enqueuing seek from ", now, " to ", time);
+ LOG(Media, "HTMLMediaElement::seekWithTolerance(%p) - enqueuing seek from %s to %s", this, toString(now).utf8().data(), toString(time).utf8().data());
m_seekTaskQueue.enqueueTask(std::bind(&HTMLMediaElement::seekTask, this));
} else
seekTask();
@@ -2892,7 +2883,7 @@
void HTMLMediaElement::seekTask()
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::seekTask(%p)", this);
if (!m_player) {
clearSeeking();
@@ -2921,12 +2912,11 @@
// time scale, we will ask the media engine to "seek" to the current movie time, which may be a noop and
// not generate a timechanged callback. This means m_seeking will never be cleared and we will never
// fire a 'seeked' event.
- if (willLog(WTFLogLevelDebug)) {
- MediaTime mediaTime = m_player->mediaTimeForTimeValue(time);
- if (time != mediaTime)
- DEBUG_LOG(THIS, time, " media timeline equivalent is ", mediaTime);
- }
-
+#if !LOG_DISABLED
+ MediaTime mediaTime = m_player->mediaTimeForTimeValue(time);
+ if (time != mediaTime)
+ LOG(Media, "HTMLMediaElement::seekTask(%p) - %s - media timeline equivalent is %s", this, toString(time).utf8().data(), toString(mediaTime).utf8().data());
+#endif
time = m_player->mediaTimeForTimeValue(time);
// 8 - If the (possibly now changed) new playback position is not in one of the ranges given in the
@@ -2951,7 +2941,7 @@
#endif
if (noSeekRequired) {
- NOTICE_LOG(THIS, "seek to ", time, " ignored");
+ LOG(Media, "HTMLMediaElement::seekTask(%p) - seek to %s ignored", this, toString(time).utf8().data());
if (time == now) {
scheduleEvent(eventNames().seekingEvent);
scheduleTimeupdateEvent(false);
@@ -2993,7 +2983,7 @@
// 14 - Set the seeking IDL attribute to false.
clearSeeking();
- NOTICE_LOG(THIS, "current time = ", currentMediaTime());
+ LOG(Media, "HTMLMediaElement::finishSeek(%p) - current time = %s", this, toString(currentMediaTime()).utf8().data());
// 15 - Run the time maches on steps.
// Handled by mediaPlayerTimeChanged().
@@ -3052,6 +3042,11 @@
if (!m_player || !m_player->maximumDurationToCacheMediaTime())
return;
+#if !LOG_DISABLED
+ if (m_cachedTime.isValid())
+ LOG(Media, "HTMLMediaElement::invalidateCachedTime(%p)", this);
+#endif
+
// Don't try to cache movie time when playback first starts as the time reported by the engine
// sometimes fluctuates for a short amount of time, so the cached time will be off if we take it
// too early.
@@ -3076,7 +3071,7 @@
return MediaTime::zeroTime();
if (m_seeking) {
- NOTICE_LOG(THIS, "seeking, returning", m_lastSeekTime);
+ LOG(Media, "HTMLMediaElement::currentTime(%p) - seeking, returning %s", this, toString(m_lastSeekTime).utf8().data());
return m_lastSeekTime;
}
@@ -3084,7 +3079,7 @@
#if LOG_CACHED_TIME_WARNINGS
MediaTime delta = m_cachedTime - m_player->currentTime();
if (delta > minCachedDeltaForWarning)
- WARNING_LOG(THIS, "cached time is ", delta, " seconds off of media time when paused");
+ LOG(Media, "HTMLMediaElement::currentTime(%p) - WARNING, cached time is %s seconds off of media time when paused", this, toString(delta).utf8().data());
#endif
return m_cachedTime;
}
@@ -3103,7 +3098,7 @@
#if LOG_CACHED_TIME_WARNINGS
MediaTime delta = adjustedCacheTime - m_player->currentTime();
if (delta > minCachedDeltaForWarning)
- WARNING_LOG(THIS, "cached time is ", delta, " seconds off of media time when playing");
+ LOG(Media, "HTMLMediaElement::currentTime(%p) - WARNING, cached time is %f seconds off of media time when playing", this, delta);
#endif
return adjustedCacheTime;
}
@@ -3113,7 +3108,7 @@
if (maximumDurationToCacheMediaTime && now > m_minimumClockTimeToUpdateCachedTime && m_cachedTime != MediaPlayer::invalidTime()) {
double clockDelta = now - m_clockTimeAtLastCachedTimeUpdate;
MediaTime delta = m_cachedTime + MediaTime::createWithDouble(effectivePlaybackRate() * clockDelta) - m_player->currentTime();
- WARNING_LOG(THIS, "cached time was ", delta, " seconds off of media time when it expired");
+ LOG(Media, "HTMLMediaElement::currentTime(%p) - cached time was %s seconds off of media time when it expired", this, toString(delta).utf8().data());
}
#endif
@@ -3198,12 +3193,11 @@
return;
#endif
- if (m_defaultPlaybackRate == rate)
- return;
-
- ALWAYS_LOG(THIS, rate);
- m_defaultPlaybackRate = rate;
- scheduleEvent(eventNames().ratechangeEvent);
+ if (m_defaultPlaybackRate != rate) {
+ LOG(Media, "HTMLMediaElement::setDefaultPlaybackRate(%p) - %f", this, rate);
+ m_defaultPlaybackRate = rate;
+ scheduleEvent(eventNames().ratechangeEvent);
+ }
}
double HTMLMediaElement::effectivePlaybackRate() const
@@ -3232,7 +3226,7 @@
void HTMLMediaElement::setPlaybackRate(double rate)
{
- ALWAYS_LOG(THIS, rate);
+ LOG(Media, "HTMLMediaElement::setPlaybackRate(%p) - %f", this, rate);
#if ENABLE(MEDIA_STREAM)
// http://w3c.github.io/mediacapture-main/#mediastreams-in-media-elements
@@ -3267,7 +3261,7 @@
void HTMLMediaElement::setWebkitPreservesPitch(bool preservesPitch)
{
- NOTICE_LOG(THIS, preservesPitch);
+ LOG(Media, "HTMLMediaElement::setWebkitPreservesPitch(%p) - %s", this, boolString(preservesPitch));
m_webkitPreservesPitch = preservesPitch;
@@ -3322,7 +3316,7 @@
void HTMLMediaElement::setPreload(const String& preload)
{
- NOTICE_LOG(THIS, preload);
+ LOG(Media, "HTMLMediaElement::setPreload(%p) - %s", this, preload.utf8().data());
#if ENABLE(MEDIA_STREAM)
// http://w3c.github.io/mediacapture-main/#mediastreams-in-media-elements
// "preload" - On getting: none. On setting: ignored.
@@ -3335,7 +3329,7 @@
void HTMLMediaElement::play(DOMPromiseDeferred<void>&& promise)
{
- ALWAYS_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::play(%p)", this);
auto success = m_mediaSession->playbackPermitted(*this);
if (!success) {
@@ -3363,7 +3357,7 @@
void HTMLMediaElement::play()
{
- ALWAYS_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::play(%p)", this);
auto success = m_mediaSession->playbackPermitted(*this);
if (!success) {
@@ -3379,10 +3373,10 @@
bool HTMLMediaElement::playInternal()
{
- ALWAYS_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::playInternal(%p)", this);
if (!m_mediaSession->clientWillBeginPlayback()) {
- ALWAYS_LOG(THIS, " returning because of interruption");
+ LOG(Media, " returning because of interruption");
return true; // Treat as success because we will begin playback on cessation of the interruption.
}
@@ -3451,7 +3445,7 @@
void HTMLMediaElement::pause()
{
- ALWAYS_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::pause(%p)", this);
m_temporarilyAllowingInlinePlaybackAfterFullscreen = false;
@@ -3467,10 +3461,10 @@
void HTMLMediaElement::pauseInternal()
{
- ALWAYS_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::pauseInternal(%p)", this);
if (!m_mediaSession->clientWillPausePlayback()) {
- ALWAYS_LOG(THIS, " returning because of interruption");
+ LOG(Media, " returning because of interruption");
return;
}
@@ -3524,7 +3518,7 @@
void HTMLMediaElement::setLoop(bool b)
{
- NOTICE_LOG(THIS, b);
+ LOG(Media, "HTMLMediaElement::setLoop(%p) - %s", this, boolString(b));
setBooleanAttribute(loopAttr, b);
}
@@ -3541,7 +3535,7 @@
void HTMLMediaElement::setControls(bool b)
{
- NOTICE_LOG(THIS, b);
+ LOG(Media, "HTMLMediaElement::setControls(%p) - %s", this, boolString(b));
setBooleanAttribute(controlsAttr, b);
}
@@ -3552,7 +3546,7 @@
ExceptionOr<void> HTMLMediaElement::setVolume(double volume)
{
- NOTICE_LOG(THIS, volume);
+ LOG(Media, "HTMLMediaElement::setVolume(%p) - %f", this, volume);
if (!(volume >= 0 && volume <= 1))
return Exception { IndexSizeError };
@@ -3576,7 +3570,7 @@
void HTMLMediaElement::setMuted(bool muted)
{
- NOTICE_LOG(THIS, muted);
+ LOG(Media, "HTMLMediaElement::setMuted(%p) - %s", this, boolString(muted));
bool mutedStateChanged = m_muted != muted;
if (mutedStateChanged || !m_explicitlyMuted) {
@@ -3637,7 +3631,7 @@
void HTMLMediaElement::togglePlayState()
{
- NOTICE_LOG(THIS, "canPlay() is ", canPlay());
+ LOG(Media, "HTMLMediaElement::togglePlayState(%p) - canPlay() is %s", this, boolString(canPlay()));
// We can safely call the internal play/pause methods, which don't check restrictions, because
// this method is only called from the built-in media controller
@@ -3650,7 +3644,7 @@
void HTMLMediaElement::beginScrubbing()
{
- NOTICE_LOG(THIS, "paused() is ", paused());
+ LOG(Media, "HTMLMediaElement::beginScrubbing(%p) - paused() is %s", this, boolString(paused()));
if (!paused()) {
if (ended()) {
@@ -3671,7 +3665,7 @@
void HTMLMediaElement::endScrubbing()
{
- NOTICE_LOG(THIS, "m_pausedInternal is", m_pausedInternal);
+ LOG(Media, "HTMLMediaElement::endScrubbing(%p) - m_pausedInternal is %s", this, boolString(m_pausedInternal));
if (m_pausedInternal)
setPausedInternal(false);
@@ -4040,6 +4034,13 @@
{
ASSERT(trackElement.hasTagName(trackTag));
+#if !LOG_DISABLED
+ if (trackElement.hasTagName(trackTag)) {
+ URL url = ""
+ LOG(Media, "HTMLMediaElement::didRemoveTrack(%p) - 'src' is %s", this, urlForLoggingMedia(url).utf8().data());
+ }
+#endif
+
auto& textTrack = trackElement.track();
textTrack.setHasBeenConfigured(false);
@@ -4060,6 +4061,8 @@
{
ASSERT(group.tracks.size());
+ LOG(Media, "HTMLMediaElement::configureTextTrackGroup(%p)", this);
+
Page* page = document().page();
CaptionUserPreferences* captionPreferences = page ? &page->group().captionPreferences() : 0;
CaptionUserPreferences::CaptionDisplayMode displayMode = captionPreferences ? captionPreferences->captionDisplayMode() : CaptionUserPreferences::Automatic;
@@ -4088,7 +4091,7 @@
currentlyEnabledTracks.append(textTrack);
int trackScore = captionPreferences ? captionPreferences->textTrackSelectionScore(textTrack.get(), this) : 0;
- NOTICE_LOG(THIS, "'", textTrack->kindKeyword(), "' track with language '", textTrack->language(), "' and BCP 47 language '", textTrack->validBCP47Language(), "' has score ", trackScore);
+ LOG(Media, "HTMLMediaElement::configureTextTrackGroup(%p) - '%s' track with language '%s' and BCP 47 language '%s' has score %d", this, textTrack->kindKeyword().string().utf8().data(), textTrack->language().string().utf8().data(), textTrack->validBCP47Language().string().utf8().data(), trackScore);
if (trackScore) {
@@ -4205,6 +4208,7 @@
void HTMLMediaElement::updateCaptionContainer()
{
+ LOG(Media, "HTMLMediaElement::updateCaptionContainer(%p)", this);
#if ENABLE(MEDIA_CONTROLS_SCRIPT)
if (m_haveSetUpCaptionContainer)
return;
@@ -4417,15 +4421,18 @@
URL HTMLMediaElement::selectNextSourceChild(ContentType* contentType, String* keySystem, InvalidURLAction actionIfInvalid)
{
UNUSED_PARAM(keySystem);
-
+#if !LOG_DISABLED
// Don't log if this was just called to find out if there are any valid <source> elements.
- bool shouldLog = willLog(WTFLogLevelDebug) && actionIfInvalid != DoNothing;
+ bool shouldLog = actionIfInvalid != DoNothing;
if (shouldLog)
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p)", this);
+#endif
if (!m_nextChildNodeToConsider) {
+#if !LOG_DISABLED
if (shouldLog)
- NOTICE_LOG(THIS, "end of list, stopping");
+ LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p) - end of list, stopping", this);
+#endif
return URL();
}
@@ -4444,14 +4451,18 @@
// 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
auto mediaURL = source->getNonEmptyURLAttribute(srcAttr);
String type;
+#if !LOG_DISABLED
if (shouldLog)
- NOTICE_LOG(THIS, "'src' is ", mediaURL);
+ LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p) - 'src' is %s", this, urlForLoggingMedia(mediaURL).utf8().data());
+#endif
if (mediaURL.isEmpty())
goto CheckAgain;
if (auto* media = source->parsedMediaAttribute()) {
+#if !LOG_DISABLED
if (shouldLog)
- NOTICE_LOG(THIS, "'media' is ", source->attributeWithoutSynchronization(mediaAttr));
+ LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p) - 'media' is %s", this, source->attributeWithoutSynchronization(mediaAttr).string().utf8().data());
+#endif
auto* renderer = this->renderer();
LOG(MediaQueries, "HTMLMediaElement %p selectNextSourceChild evaluating media queries", this);
if (!MediaQueryEvaluator { "screen", document(), renderer ? &renderer->style() : nullptr }.evaluate(*media))
@@ -4462,8 +4473,10 @@
if (type.isEmpty() && mediaURL.protocolIsData())
type = mimeTypeFromDataURL(mediaURL);
if (!type.isEmpty()) {
+#if !LOG_DISABLED
if (shouldLog)
- NOTICE_LOG(THIS, "'type' is ", type);
+ LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p) - 'type' is '%s'", this, type.utf8().data());
+#endif
MediaEngineSupportParameters parameters;
parameters.type = ContentType(type);
parameters.url = ""
@@ -4486,7 +4499,7 @@
// A 'beforeload' event handler can mutate the DOM, so check to see if the source element is still a child node.
if (source->parentNode() != this) {
- NOTICE_LOG(THIS, "'beforeload' removed current element");
+ LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p) - 'beforeload' removed current element", this);
continue;
}
@@ -4496,8 +4509,10 @@
m_nextChildNodeToConsider = Traversal<HTMLSourceElement>::nextSkippingChildren(source);
m_currentSourceNode = WTFMove(source);
+#if !LOG_DISABLED
if (shouldLog)
- NOTICE_LOG(THIS, " = ", mediaURL);
+ LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p) -> %p, %s", this, m_currentSourceNode.get(), urlForLoggingMedia(mediaURL).utf8().data());
+#endif
return mediaURL;
@@ -4511,7 +4526,7 @@
#if !LOG_DISABLED
if (shouldLog)
- NOTICE_LOG(THIS, "failed");
+ LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p) -> %p, failed", this, m_currentSourceNode.get());
#endif
return URL();
}
@@ -4518,10 +4533,14 @@
void HTMLMediaElement::sourceWasAdded(HTMLSourceElement& source)
{
- if (willLog(WTFLogLevelNotice) && source.hasTagName(sourceTag)) {
+ LOG(Media, "HTMLMediaElement::sourceWasAdded(%p) - %p", this, &source);
+
+#if !LOG_DISABLED
+ if (source.hasTagName(sourceTag)) {
URL url = ""
- NOTICE_LOG(THIS, "'src' is ", url);
+ LOG(Media, "HTMLMediaElement::sourceWasAdded(%p) - 'src' is %s", this, urlForLoggingMedia(url).utf8().data());
}
+#endif
// We should only consider a <source> element when there is not src attribute at all.
if (hasAttributeWithoutSynchronization(srcAttr))
@@ -4540,7 +4559,7 @@
}
if (m_currentSourceNode && &source == Traversal<HTMLSourceElement>::nextSibling(*m_currentSourceNode)) {
- NOTICE_LOG(THIS, "<source> inserted immediately after current source");
+ LOG(Media, "HTMLMediaElement::sourceWasAdded(%p) - <source> inserted immediately after current source", this);
m_nextChildNodeToConsider = &source;
return;
}
@@ -4565,10 +4584,14 @@
void HTMLMediaElement::sourceWasRemoved(HTMLSourceElement& source)
{
- if (willLog(WTFLogLevelNotice) && source.hasTagName(sourceTag)) {
+ LOG(Media, "HTMLMediaElement::sourceWasRemoved(%p) - %p", this, &source);
+
+#if !LOG_DISABLED
+ if (source.hasTagName(sourceTag)) {
URL url = ""
- NOTICE_LOG(THIS, "'src' is ", url);
+ LOG(Media, "HTMLMediaElement::sourceWasRemoved(%p) - 'src' is %s", this, urlForLoggingMedia(url).utf8().data());
}
+#endif
if (&source != m_currentSourceNode && &source != m_nextChildNodeToConsider)
return;
@@ -4575,19 +4598,19 @@
if (&source == m_nextChildNodeToConsider) {
m_nextChildNodeToConsider = m_currentSourceNode ? Traversal<HTMLSourceElement>::nextSibling(*m_currentSourceNode) : nullptr;
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::sourceRemoved(%p) - m_nextChildNodeToConsider set to %p", this, m_nextChildNodeToConsider.get());
} else if (&source == m_currentSourceNode) {
// Clear the current source node pointer, but don't change the movie as the spec says:
// 4.8.8 - Dynamically modifying a source element and its attribute when the element is already
// inserted in a video or audio element will have no effect.
m_currentSourceNode = nullptr;
- NOTICE_LOG(THIS, "m_currentSourceNode set to 0");
+ LOG(Media, "HTMLMediaElement::sourceRemoved(%p) - m_currentSourceNode set to 0", this);
}
}
void HTMLMediaElement::mediaPlayerTimeChanged(MediaPlayer*)
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::mediaPlayerTimeChanged(%p)", this);
#if ENABLE(VIDEO_TRACK)
updateActiveTextTrackCues(currentMediaTime());
@@ -4715,7 +4738,7 @@
void HTMLMediaElement::mediaPlayerVolumeChanged(MediaPlayer*)
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::mediaPlayerVolumeChanged(%p)", this);
beginProcessingMediaPlayerCallback();
if (m_player) {
@@ -4731,7 +4754,7 @@
void HTMLMediaElement::mediaPlayerMuteChanged(MediaPlayer*)
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::mediaPlayerMuteChanged(%p)", this);
beginProcessingMediaPlayerCallback();
if (m_player)
@@ -4741,7 +4764,7 @@
void HTMLMediaElement::mediaPlayerDurationChanged(MediaPlayer* player)
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::mediaPlayerDurationChanged(%p)", this);
beginProcessingMediaPlayerCallback();
@@ -4764,7 +4787,7 @@
// using (eg. it can't handle the rate we set)
m_reportedPlaybackRate = m_player->rate();
- NOTICE_LOG(THIS, "rate: ", m_reportedPlaybackRate);
+ LOG(Media, "HTMLMediaElement::mediaPlayerRateChanged(%p) - rate: %lf", this, m_reportedPlaybackRate);
if (m_playing)
invalidateCachedTime();
@@ -4776,7 +4799,7 @@
void HTMLMediaElement::mediaPlayerPlaybackStateChanged(MediaPlayer*)
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::mediaPlayerPlaybackStateChanged(%p)", this);
if (!m_player || m_pausedInternal)
return;
@@ -4791,7 +4814,7 @@
void HTMLMediaElement::mediaPlayerSawUnsupportedTracks(MediaPlayer*)
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::mediaPlayerSawUnsupportedTracks(%p)", this);
// The MediaPlayer came across content it cannot completely handle.
// This is normally acceptable except when we are in a standalone
@@ -4802,7 +4825,7 @@
void HTMLMediaElement::mediaPlayerResourceNotSupported(MediaPlayer*)
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::mediaPlayerResourceNotSupported(%p)", this);
// The MediaPlayer came across content which no installed engine supports.
mediaLoadingFailed(MediaPlayer::FormatError);
@@ -4820,7 +4843,7 @@
void HTMLMediaElement::mediaPlayerSizeChanged(MediaPlayer*)
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::mediaPlayerSizeChanged(%p)", this);
if (is<MediaDocument>(document()) && m_player)
downcast<MediaDocument>(document()).mediaElementNaturalSizeChanged(expandedIntSize(m_player->naturalSize()));
@@ -4841,7 +4864,7 @@
void HTMLMediaElement::mediaPlayerRenderingModeChanged(MediaPlayer*)
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::mediaPlayerRenderingModeChanged(%p)", this);
// Kick off a fake recalcStyle that will update the compositing tree.
invalidateStyleAndLayerComposition();
@@ -4866,7 +4889,7 @@
void HTMLMediaElement::mediaEngineWasUpdated()
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::mediaEngineWasUpdated(%p)", this);
beginProcessingMediaPlayerCallback();
updateRenderer();
endProcessingMediaPlayerCallback();
@@ -4896,7 +4919,7 @@
void HTMLMediaElement::mediaPlayerEngineUpdated(MediaPlayer*)
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::mediaPlayerEngineUpdated(%p)", this);
#if ENABLE(MEDIA_SOURCE)
m_droppedVideoFrames = 0;
@@ -4909,7 +4932,7 @@
void HTMLMediaElement::mediaPlayerFirstVideoFrameAvailable(MediaPlayer*)
{
- NOTICE_LOG(THIS, "current display mode = ", (int)displayMode());
+ LOG(Media, "HTMLMediaElement::mediaPlayerFirstVideoFrameAvailable(%p) - current display mode = %i", this, (int)displayMode());
beginProcessingMediaPlayerCallback();
if (displayMode() == PosterWaitingForVideo) {
@@ -4921,7 +4944,7 @@
void HTMLMediaElement::mediaPlayerCharacteristicChanged(MediaPlayer*)
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::mediaPlayerCharacteristicChanged(%p)", this);
beginProcessingMediaPlayerCallback();
@@ -5171,7 +5194,7 @@
bool shouldBePlaying = potentiallyPlaying();
bool playerPaused = m_player->paused();
- NOTICE_LOG(THIS, "shouldBePlaying = ", shouldBePlaying, " playerPaused = ", playerPaused);
+ LOG(Media, "HTMLMediaElement::updatePlayState(%p) - shouldBePlaying = %s, playerPaused = %s", this, boolString(shouldBePlaying), boolString(playerPaused));
if (shouldBePlaying) {
scheduleUpdatePlaybackControlsManager();
@@ -5267,7 +5290,7 @@
void HTMLMediaElement::userCancelledLoad()
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::userCancelledLoad(%p)", this);
// FIXME: We should look to reconcile the iOS and non-iOS code (below).
#if PLATFORM(IOS)
@@ -5320,7 +5343,7 @@
void HTMLMediaElement::clearMediaPlayer(DelayedActionType flags)
{
- NOTICE_LOG(THIS, "flags = ", actionName(flags));
+ LOG(Media, "HTMLMediaElement::clearMediaPlayer(%p) - flags = %s", this, actionName(flags).utf8().data());
#if ENABLE(MEDIA_STREAM)
if (!m_settingMediaStreamSrcObject)
@@ -5395,7 +5418,7 @@
void HTMLMediaElement::stopWithoutDestroyingMediaPlayer()
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::stopWithoutDestroyingMediaPlayer(%p)", this);
if (m_videoFullscreenMode != VideoFullscreenModeNone)
exitFullscreen();
@@ -5439,7 +5462,7 @@
void HTMLMediaElement::stop()
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::stop(%p)", this);
Ref<HTMLMediaElement> protectedThis(*this);
stopWithoutDestroyingMediaPlayer();
@@ -5459,7 +5482,7 @@
void HTMLMediaElement::suspend(ReasonForSuspension why)
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::suspend(%p)", this);
Ref<HTMLMediaElement> protectedThis(*this);
switch (why)
@@ -5480,7 +5503,7 @@
void HTMLMediaElement::resume()
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::resume(%p)", this);
m_inActiveDocument = true;
@@ -5514,7 +5537,7 @@
void HTMLMediaElement::mediaVolumeDidChange()
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::mediaVolumeDidChange(%p)", this);
updateVolume();
}
@@ -5521,7 +5544,7 @@
void HTMLMediaElement::visibilityStateChanged()
{
m_elementIsHidden = document().hidden() && m_videoFullscreenMode != VideoFullscreenModePictureInPicture;
- NOTICE_LOG(THIS, "visible = ", !m_elementIsHidden);
+ LOG(Media, "HTMLMediaElement::visibilityStateChanged(%p) - visible = %s", this, boolString(!m_elementIsHidden));
updateSleepDisabling();
m_mediaSession->visibilityChanged();
if (m_player)
@@ -5530,10 +5553,10 @@
bool isPlayingAudio = isPlaying() && hasAudio() && !muted() && volume();
if (!isPlayingAudio) {
if (m_elementIsHidden) {
- ALWAYS_LOG(THIS, "visibilityStateChanged() Suspending playback after going to the background");
+ RELEASE_LOG_IF_ALLOWED("visibilityStateChanged() Suspending playback after going to the background");
m_mediaSession->beginInterruption(PlatformMediaSession::EnteringBackground);
} else {
- ALWAYS_LOG(THIS, "visibilityStateChanged() Resuming playback after entering foreground");
+ RELEASE_LOG_IF_ALLOWED("visibilityStateChanged() Resuming playback after entering foreground");
m_mediaSession->endInterruption(PlatformMediaSession::MayResumePlaying);
}
}
@@ -5561,7 +5584,7 @@
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
void HTMLMediaElement::webkitShowPlaybackTargetPicker()
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::webkitShowPlaybackTargetPicker(%p)", this);
if (processingUserGestureForMedia())
removeBehaviorsRestrictionsAfterFirstUserGesture();
m_mediaSession->showPlaybackTargetPicker(*this);
@@ -5581,7 +5604,7 @@
{
m_isPlayingToWirelessTarget = m_player && m_player->isCurrentPlaybackTargetWireless();
- NOTICE_LOG(THIS, "webkitCurrentPlaybackTargetIsWireless = ", m_isPlayingToWirelessTarget);
+ LOG(Media, "HTMLMediaElement::mediaPlayerCurrentPlaybackTargetIsWirelessChanged(%p) - webkitCurrentPlaybackTargetIsWireless = %s", this, boolString(m_isPlayingToWirelessTarget));
ASSERT(m_player);
configureMediaControls();
scheduleEvent(eventNames().webkitcurrentplaybacktargetiswirelesschangedEvent);
@@ -5597,9 +5620,6 @@
m_failedToPlayToWirelessTarget = false;
scheduleDelayedAction(CheckPlaybackTargetCompatablity);
}
-
- DEBUG_LOG(THIS, "dispatching '", event.type(), "'");
-
return HTMLElement::dispatchEvent(event);
}
@@ -5617,7 +5637,7 @@
m_mediaSession->setHasPlaybackTargetAvailabilityListeners(*this, true);
}
- NOTICE_LOG(THIS, "'webkitplaybacktargetavailabilitychanged'");
+ LOG(Media, "HTMLMediaElement::addEventListener(%p) - 'webkitplaybacktargetavailabilitychanged'", this);
enqueuePlaybackTargetAvailabilityChangedEvent(); // Ensure the event listener gets at least one event.
return true;
@@ -5632,7 +5652,7 @@
return false;
bool didRemoveLastAvailabilityChangedListener = !hasEventListeners(eventNames().webkitplaybacktargetavailabilitychangedEvent);
- NOTICE_LOG(THIS, "removed last listener = ", didRemoveLastAvailabilityChangedListener);
+ LOG(Media, "HTMLMediaElement::removeEventListener(%p) - removed last listener = %s", this, boolString(didRemoveLastAvailabilityChangedListener));
if (didRemoveLastAvailabilityChangedListener) {
m_hasPlaybackTargetAvailabilityListeners = false;
m_mediaSession->setHasPlaybackTargetAvailabilityListeners(*this, false);
@@ -5645,7 +5665,7 @@
void HTMLMediaElement::enqueuePlaybackTargetAvailabilityChangedEvent()
{
bool hasTargets = m_mediaSession->hasWirelessPlaybackTargets(*this);
- NOTICE_LOG(THIS, "hasTargets = ", hasTargets);
+ LOG(Media, "HTMLMediaElement::enqueuePlaybackTargetAvailabilityChangedEvent(%p) - hasTargets = %s", this, boolString(hasTargets));
auto event = WebKitPlaybackTargetAvailabilityEvent::create(eventNames().webkitplaybacktargetavailabilitychangedEvent, hasTargets);
event->setTarget(this);
m_asyncEventQueue.enqueueEvent(WTFMove(event));
@@ -5654,7 +5674,7 @@
void HTMLMediaElement::setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&& device)
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::setWirelessPlaybackTarget(%p)", this);
if (m_player)
m_player->setWirelessPlaybackTarget(WTFMove(device));
}
@@ -5663,7 +5683,7 @@
{
bool canPlay = m_player && m_player->canPlayToWirelessPlaybackTarget();
- NOTICE_LOG(THIS, "returning ", canPlay);
+ LOG(Media, "HTMLMediaElement::canPlayToWirelessPlaybackTarget(%p) - returning %s", this, boolString(canPlay));
return canPlay;
}
@@ -5675,7 +5695,7 @@
void HTMLMediaElement::setShouldPlayToPlaybackTarget(bool shouldPlay)
{
- NOTICE_LOG(THIS, "shouldPlay = ", shouldPlay);
+ LOG(Media, "HTMLMediaElement::setShouldPlayToPlaybackTarget(%p) - shouldPlay = %s", this, boolString(shouldPlay));
if (m_player)
m_player->setShouldPlayToPlaybackTarget(shouldPlay);
@@ -5724,6 +5744,8 @@
void HTMLMediaElement::toggleStandardFullscreenState()
{
+ LOG(Media, "HTMLMediaElement::toggleStandardFullscreenState(%p) - isStandardFullscreen() is %s", this, boolString(isStandardFullscreen()));
+
if (isStandardFullscreen())
exitFullscreen();
else
@@ -5732,7 +5754,7 @@
void HTMLMediaElement::enterFullscreen(VideoFullscreenMode mode)
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::enterFullscreen(%p)", this);
ASSERT(mode != VideoFullscreenModeNone);
if (m_videoFullscreenMode == mode)
@@ -5777,7 +5799,7 @@
void HTMLMediaElement::exitFullscreen()
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::exitFullscreen(%p)", this);
#if ENABLE(FULLSCREEN_API)
if (document().settings().fullScreenEnabled() && document().webkitCurrentFullScreenElement() == this) {
@@ -5983,7 +6005,7 @@
void HTMLMediaElement::setClosedCaptionsVisible(bool closedCaptionVisible)
{
- NOTICE_LOG(THIS, closedCaptionVisible);
+ LOG(Media, "HTMLMediaElement::setClosedCaptionsVisible(%p) - %s", this, boolString(closedCaptionVisible));
m_closedCaptionsVisible = false;
@@ -6038,7 +6060,8 @@
void HTMLMediaElement::mediaCanStart(Document& document)
{
ASSERT_UNUSED(document, &document == &this->document());
- NOTICE_LOG(THIS, "m_isWaitingUntilMediaCanStart = ", m_isWaitingUntilMediaCanStart, ", m_pausedInternal = ", m_pausedInternal);
+ LOG(Media, "HTMLMediaElement::mediaCanStart(%p) - m_isWaitingUntilMediaCanStart = %s, m_pausedInternal = %s",
+ this, boolString(m_isWaitingUntilMediaCanStart), boolString(m_pausedInternal) );
ASSERT(m_isWaitingUntilMediaCanStart || m_pausedInternal);
if (m_isWaitingUntilMediaCanStart) {
@@ -6059,7 +6082,7 @@
if (m_shouldDelayLoadEvent == shouldDelay)
return;
- NOTICE_LOG(THIS, shouldDelay);
+ LOG(Media, "HTMLMediaElement::setShouldDelayLoadEvent(%p) - %s", this, boolString(shouldDelay));
m_shouldDelayLoadEvent = shouldDelay;
if (shouldDelay)
@@ -6110,6 +6133,7 @@
return;
bool privateMode = document().page() && document().page()->usesEphemeralSession();
+ LOG(Media, "HTMLMediaElement::privateBrowsingStateDidChange(%p) - %s", this, boolString(privateMode));
m_player->setPrivateBrowsingMode(privateMode);
}
@@ -6291,7 +6315,7 @@
if (!m_textTracks)
return;
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured(%p)", this);
// Mark all tracks as not "configured" so that configureTextTracks()
// will reconsider which tracks to display in light of new user preferences
@@ -6317,7 +6341,7 @@
void HTMLMediaElement::createMediaPlayer()
{
- NOTICE_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::createMediaPlayer(%p)", this);
#if ENABLE(WEB_AUDIO)
if (m_audioSourceNode)
@@ -6923,7 +6947,7 @@
bool HTMLMediaElement::ensureMediaControlsInjectedScript()
{
- DEBUG_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::ensureMediaControlsInjectedScript(%p)", this);
Page* page = document().page();
if (!page)
return false;
@@ -7000,7 +7024,7 @@
void HTMLMediaElement::didAddUserAgentShadowRoot(ShadowRoot* root)
{
- DEBUG_LOG(THIS);
+ LOG(Media, "HTMLMediaElement::didAddUserAgentShadowRoot(%p)", this);
Page* page = document().page();
if (!page)
@@ -7083,10 +7107,10 @@
void HTMLMediaElement::setMediaControlsDependOnPageScaleFactor(bool dependsOnPageScale)
{
- DEBUG_LOG(THIS, "MediaElement::setMediaControlsDependPageScaleFactor", dependsOnPageScale);
+ LOG(Media, "MediaElement::setMediaControlsDependPageScaleFactor(%p) = %s", this, boolString(dependsOnPageScale));
if (document().settings().mediaControlsScaleWithPageZoom()) {
- DEBUG_LOG(THIS, "MediaElement::setMediaControlsDependPageScaleFactor", "forced to false by Settings value");
+ LOG(Media, "MediaElement::setMediaControlsDependPageScaleFactor(%p) forced to false by Settings value", this);
m_mediaControlsDependOnPageScaleFactor = false;
return;
}
@@ -7267,7 +7291,7 @@
void HTMLMediaElement::suspendPlayback()
{
- NOTICE_LOG(THIS, "paused = ", paused());
+ LOG(Media, "HTMLMediaElement::suspendPlayback(%p) - paused = %s", this, boolString(paused()));
if (!paused())
pause();
}
@@ -7274,7 +7298,7 @@
void HTMLMediaElement::resumeAutoplaying()
{
- NOTICE_LOG(THIS, "paused = ", paused());
+ LOG(Media, "HTMLMediaElement::resumeAutoplaying(%p) - paused = %s", this, boolString(paused()));
m_autoplaying = true;
if (canTransitionFromAutoplayToPlay())
@@ -7283,7 +7307,7 @@
void HTMLMediaElement::mayResumePlayback(bool shouldResume)
{
- NOTICE_LOG(THIS, "paused = ", paused());
+ LOG(Media, "HTMLMediaElement::mayResumePlayback(%p) - paused = %s", this, boolString(paused()));
if (paused() && shouldResume)
play();
}
@@ -7298,7 +7322,7 @@
void HTMLMediaElement::didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType command, const PlatformMediaSession::RemoteCommandArgument* argument)
{
- NOTICE_LOG(THIS, static_cast<int>(command));
+ LOG(Media, "HTMLMediaElement::didReceiveRemoteControlCommand(%p) - %i", this, static_cast<int>(command));
UserGestureIndicator remoteControlUserGesture(ProcessingUserGesture, &document());
switch (command) {
@@ -7351,7 +7375,7 @@
if (type == PlatformMediaSession::EnteringBackground) {
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
if (m_isPlayingToWirelessTarget) {
- NOTICE_LOG(THIS, "returning true because m_isPlayingToWirelessTarget is true");
+ LOG(Media, "HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction(%p) - returning true because m_isPlayingToWirelessTarget is true", this);
return true;
}
#endif
@@ -7364,7 +7388,7 @@
} else if (type == PlatformMediaSession::SuspendedUnderLock) {
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
if (m_isPlayingToWirelessTarget) {
- NOTICE_LOG(THIS, "returning true because m_isPlayingToWirelessTarget is true");
+ LOG(Media, "HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction(%p) - returning true because m_isPlayingToWirelessTarget is true", this);
return true;
}
#endif
@@ -7525,7 +7549,7 @@
return;
if (m_isPlayingToWirelessTarget) {
- NOTICE_LOG(THIS, "early return because playing to wireless target");
+ LOG(Media, "HTMLMediaElement::purgeBufferedDataIfPossible(%p) - early return because m_isPlayingToWirelessTarget is true", this);
return;
}
@@ -7532,7 +7556,6 @@
// This is called to relieve memory pressure. Turning off buffering causes the media playback
// daemon to release memory associated with queued-up video frames.
// We turn it back on right away, but new frames won't get loaded unless playback is resumed.
- NOTICE_LOG(THIS, "toggling data buffering");
setShouldBufferData(false);
setShouldBufferData(true);
#endif
@@ -7732,23 +7755,6 @@
scheduleUpdatePlaybackControlsManager();
}
-#if !RELEASE_LOG_DISABLED
-WTFLogChannel& HTMLMediaElement::logChannel() const
-{
- return LogMedia;
}
-#endif
-bool HTMLMediaElement::willLog(WTFLogLevel level) const
-{
-#if !RELEASE_LOG_DISABLED
- return m_logger->willLog(logChannel(), level);
-#else
- UNUSED_PARAM(level);
- return false;
#endif
-}
-
-}
-
-#endif