Skip to content
Permalink
Browse files
Switch MediaPlayerPrivateAVFoundation to release logging
https://bugs.webkit.org/show_bug.cgi?id=176621
<rdar://problem/34335311>

Reviewed by Jer Noble.

Source/WebCore:

* html/HTMLMediaElement.h:
* platform/graphics/MediaPlayer.cpp:
(WebCore::nullLogger):
(WebCore::MediaPlayer::mediaPlayerLogger):
* platform/graphics/MediaPlayer.h:
(WebCore::MediaPlayerClient::mediaPlayerLogIdentifier):
(WebCore::MediaPlayerClient::mediaPlayerLogger):
(WebCore::MediaPlayer::mediaPlayerLogIdentifier):
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation):
(WebCore::MediaPlayerPrivateAVFoundation::~MediaPlayerPrivateAVFoundation):
(WebCore::MediaPlayerPrivateAVFoundation::setUpVideoRendering):
(WebCore::MediaPlayerPrivateAVFoundation::tearDownVideoRendering):
(WebCore::MediaPlayerPrivateAVFoundation::load):
(WebCore::MediaPlayerPrivateAVFoundation::playabilityKnown):
(WebCore::MediaPlayerPrivateAVFoundation::prepareToPlay):
(WebCore::MediaPlayerPrivateAVFoundation::play):
(WebCore::MediaPlayerPrivateAVFoundation::pause):
(WebCore::MediaPlayerPrivateAVFoundation::durationMediaTime const):
(WebCore::MediaPlayerPrivateAVFoundation::seekWithTolerance):
(WebCore::MediaPlayerPrivateAVFoundation::setNaturalSize):
(WebCore::MediaPlayerPrivateAVFoundation::maxMediaTimeSeekable const):
(WebCore::MediaPlayerPrivateAVFoundation::minMediaTimeSeekable const):
(WebCore::MediaPlayerPrivateAVFoundation::updateStates):
(WebCore::MediaPlayerPrivateAVFoundation::rateChanged):
(WebCore::MediaPlayerPrivateAVFoundation::timeChanged):
(WebCore::MediaPlayerPrivateAVFoundation::seekCompleted):
(WebCore::MediaPlayerPrivateAVFoundation::invalidateCachedDuration):
(WebCore::MediaPlayerPrivateAVFoundation::setPreload):
(WebCore::MediaPlayerPrivateAVFoundation::mainThreadCallback):
(WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification):
(WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification):
(WebCore::MediaPlayerPrivateAVFoundation::processNewAndRemovedTextTracks):
(WebCore::MediaPlayerPrivateAVFoundation::logChannel const):
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
(WebCore::MediaPlayerPrivateAVFoundation::logClassName const):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::clearMediaCache):
(WebCore::MediaPlayerPrivateAVFoundationObjC::clearMediaCacheForOrigins):
(WebCore::MediaPlayerPrivateAVFoundationObjC::cancelLoad):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createImageGenerator):
(WebCore::MediaPlayerPrivateAVFoundationObjC::destroyImageGenerator):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem):
(WebCore::MediaPlayerPrivateAVFoundationObjC::checkPlayability):
(WebCore::MediaPlayerPrivateAVFoundationObjC::beginLoadingMetadata):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformMedia const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformPlay):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformPause):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformDuration const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::seekToTime):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setMuted):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setClosedCaptionsVisible):
(WebCore::MediaPlayerPrivateAVFoundationObjC::assetStatus const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithImageGenerator):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect):
(WebCore::MediaPlayerPrivateAVFoundationObjC::getSupportedTypes):
(WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged):
(WebCore::MediaPlayerPrivateAVFoundationObjC::updateAudioTracks):
(WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoTracks):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoOutput):
(WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoOutput):
(WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage):
(WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createOpenGLVideoOutput):
(WebCore::MediaPlayerPrivateAVFoundationObjC::destroyOpenGLVideoOutput):
(WebCore::MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange):
(WebCore::MediaPlayerPrivateAVFoundationObjC::processMediaSelectionOptions):
(WebCore::MediaPlayerPrivateAVFoundationObjC::flushCues):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setCurrentTextTrack):
(WebCore::MediaPlayerPrivateAVFoundationObjC::languageOfPrimaryAudioTrack const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::isCurrentPlaybackTargetWireless const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::wirelessPlaybackTargetName const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::wirelessVideoPlaybackDisabled const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessVideoPlaybackDisabled):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessPlaybackTarget):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldBufferData):
(WebCore::MediaPlayerPrivateAVFoundationObjC::metadataDidArrive):
(-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
(WebCore::boolString): Deleted.

Source/WebCore/PAL:

* pal/Logger.h:
(PAL::LogArgument::toString):
* pal/LoggerHelper.h:


Canonical link: https://commits.webkit.org/193269@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221929 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
eric-carlson committed Sep 12, 2017
1 parent 01979e5 commit f6b232dc26814ef8b3a1a28afc9e88d6a5dae725
Showing 11 changed files with 322 additions and 176 deletions.
@@ -1,3 +1,97 @@
2017-09-12 Eric Carlson <eric.carlson@apple.com>

Switch MediaPlayerPrivateAVFoundation to release logging
https://bugs.webkit.org/show_bug.cgi?id=176621
<rdar://problem/34335311>

Reviewed by Jer Noble.

* html/HTMLMediaElement.h:
* platform/graphics/MediaPlayer.cpp:
(WebCore::nullLogger):
(WebCore::MediaPlayer::mediaPlayerLogger):
* platform/graphics/MediaPlayer.h:
(WebCore::MediaPlayerClient::mediaPlayerLogIdentifier):
(WebCore::MediaPlayerClient::mediaPlayerLogger):
(WebCore::MediaPlayer::mediaPlayerLogIdentifier):
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation):
(WebCore::MediaPlayerPrivateAVFoundation::~MediaPlayerPrivateAVFoundation):
(WebCore::MediaPlayerPrivateAVFoundation::setUpVideoRendering):
(WebCore::MediaPlayerPrivateAVFoundation::tearDownVideoRendering):
(WebCore::MediaPlayerPrivateAVFoundation::load):
(WebCore::MediaPlayerPrivateAVFoundation::playabilityKnown):
(WebCore::MediaPlayerPrivateAVFoundation::prepareToPlay):
(WebCore::MediaPlayerPrivateAVFoundation::play):
(WebCore::MediaPlayerPrivateAVFoundation::pause):
(WebCore::MediaPlayerPrivateAVFoundation::durationMediaTime const):
(WebCore::MediaPlayerPrivateAVFoundation::seekWithTolerance):
(WebCore::MediaPlayerPrivateAVFoundation::setNaturalSize):
(WebCore::MediaPlayerPrivateAVFoundation::maxMediaTimeSeekable const):
(WebCore::MediaPlayerPrivateAVFoundation::minMediaTimeSeekable const):
(WebCore::MediaPlayerPrivateAVFoundation::updateStates):
(WebCore::MediaPlayerPrivateAVFoundation::rateChanged):
(WebCore::MediaPlayerPrivateAVFoundation::timeChanged):
(WebCore::MediaPlayerPrivateAVFoundation::seekCompleted):
(WebCore::MediaPlayerPrivateAVFoundation::invalidateCachedDuration):
(WebCore::MediaPlayerPrivateAVFoundation::setPreload):
(WebCore::MediaPlayerPrivateAVFoundation::mainThreadCallback):
(WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification):
(WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification):
(WebCore::MediaPlayerPrivateAVFoundation::processNewAndRemovedTextTracks):
(WebCore::MediaPlayerPrivateAVFoundation::logChannel const):
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
(WebCore::MediaPlayerPrivateAVFoundation::logClassName const):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::clearMediaCache):
(WebCore::MediaPlayerPrivateAVFoundationObjC::clearMediaCacheForOrigins):
(WebCore::MediaPlayerPrivateAVFoundationObjC::cancelLoad):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createImageGenerator):
(WebCore::MediaPlayerPrivateAVFoundationObjC::destroyImageGenerator):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem):
(WebCore::MediaPlayerPrivateAVFoundationObjC::checkPlayability):
(WebCore::MediaPlayerPrivateAVFoundationObjC::beginLoadingMetadata):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformMedia const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformPlay):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformPause):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformDuration const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::seekToTime):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setMuted):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setClosedCaptionsVisible):
(WebCore::MediaPlayerPrivateAVFoundationObjC::assetStatus const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithImageGenerator):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect):
(WebCore::MediaPlayerPrivateAVFoundationObjC::getSupportedTypes):
(WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged):
(WebCore::MediaPlayerPrivateAVFoundationObjC::updateAudioTracks):
(WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoTracks):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoOutput):
(WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoOutput):
(WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage):
(WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createOpenGLVideoOutput):
(WebCore::MediaPlayerPrivateAVFoundationObjC::destroyOpenGLVideoOutput):
(WebCore::MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange):
(WebCore::MediaPlayerPrivateAVFoundationObjC::processMediaSelectionOptions):
(WebCore::MediaPlayerPrivateAVFoundationObjC::flushCues):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setCurrentTextTrack):
(WebCore::MediaPlayerPrivateAVFoundationObjC::languageOfPrimaryAudioTrack const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::isCurrentPlaybackTargetWireless const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::wirelessPlaybackTargetName const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::wirelessVideoPlaybackDisabled const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessVideoPlaybackDisabled):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessPlaybackTarget):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldBufferData):
(WebCore::MediaPlayerPrivateAVFoundationObjC::metadataDidArrive):
(-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
(WebCore::boolString): Deleted.

2017-09-12 Daniel Bates <dabates@apple.com>

REGRESSION (r215784): The title of right-to-left pages are empty
@@ -1,3 +1,15 @@
2017-09-12 Eric Carlson <eric.carlson@apple.com>

Switch MediaPlayerPrivateAVFoundation to release logging
https://bugs.webkit.org/show_bug.cgi?id=176621
<rdar://problem/34335311>

Reviewed by Jer Noble.

* pal/Logger.h:
(PAL::LogArgument::toString):
* pal/LoggerHelper.h:

2017-09-11 Andy Estes <aestes@apple.com>

[Mac] Upstream QTKit-related WebKitSystemInterface functions
@@ -39,6 +39,8 @@ template<typename T>
struct LogArgument {
template<typename U = T> static typename std::enable_if<std::is_same<U, bool>::value, String>::type toString(bool argument) { return argument ? ASCIILiteral("true") : ASCIILiteral("false"); }
template<typename U = T> static typename std::enable_if<std::is_same<U, int>::value, String>::type toString(int argument) { return String::number(argument); }
template<typename U = T> static typename std::enable_if<std::is_same<U, unsigned>::value, String>::type toString(unsigned argument) { return String::number(argument); }
template<typename U = T> static typename std::enable_if<std::is_same<U, unsigned long>::value, String>::type toString(unsigned long argument) { return String::number(argument); }
template<typename U = T> static typename std::enable_if<std::is_same<U, float>::value, String>::type toString(float argument) { return String::number(argument); }
template<typename U = T> static typename std::enable_if<std::is_same<U, double>::value, String>::type toString(double argument) { return String::number(argument); }
template<typename U = T> static typename std::enable_if<std::is_same<typename std::remove_reference<U>::type, AtomicString>::value, String>::type toString(AtomicString argument) { return argument.string(); }
@@ -27,6 +27,8 @@

namespace PAL {

class Logger;

class LoggerHelper {
public:
virtual ~LoggerHelper() = default;
@@ -39,14 +41,15 @@ class LoggerHelper {

#if !RELEASE_LOG_DISABLED

#define LOGIDENTIFIER Logger::LogSiteIdentifier(logClassName(), __func__, logIdentifier())
#define LOGIDENTIFIER PAL::Logger::LogSiteIdentifier(logClassName(), __func__, logIdentifier())

#define ALWAYS_LOG(...) logger().logAlways(logChannel(), __VA_ARGS__)
#define ERROR_LOG(...) logger().error(logChannel(), __VA_ARGS__)
#define WARNING_LOG(...) logger().warning(logChannel(), __VA_ARGS__)
#define NOTICE_LOG(...) logger().notice(logChannel(), __VA_ARGS__)
#define INFO_LOG(...) logger().info(logChannel(), __VA_ARGS__)
#define DEBUG_LOG(...) logger().debug(logChannel(), __VA_ARGS__)
#define WILL_LOG(_level_) logger().willLog(logChannel(), _level_)

#else

@@ -59,6 +62,7 @@ class LoggerHelper {
#define NOTICE_LOG(...) ((void)0)
#define INFO_LOG(...) ((void)0)
#define DEBUG_LOG(...) ((void)0)
#define WILL_LOG(_level_) false

#endif

@@ -899,6 +899,9 @@ class HTMLMediaElement
const char* logClassName() const final { return "HTMLMediaElement"; }
const void* logIdentifier() const final { return reinterpret_cast<const void*>(m_logIdentifier); }
WTFLogChannel& logChannel() const final;

const void* mediaPlayerLogIdentifier() final { return logIdentifier(); }
const PAL::Logger& mediaPlayerLogger() final { return logger(); }
#endif

bool willLog(WTFLogLevel) const;
@@ -94,6 +94,14 @@ namespace WebCore {

const PlatformMedia NoPlatformMedia = { PlatformMedia::None, {0} };

#if !RELEASE_LOG_DISABLED
static RefPtr<PAL::Logger>& nullLogger()
{
static NeverDestroyed<RefPtr<PAL::Logger>> logger;
return logger;
}
#endif

// a null player to make MediaPlayer logic simpler

class NullMediaPlayerPrivate : public MediaPlayerPrivateInterface {
@@ -164,6 +172,21 @@ class NullMediaPlayerPrivate : public MediaPlayerPrivateInterface {
bool hasSingleSecurityOrigin() const override { return true; }
};

class NullMediaPlayerClient : public MediaPlayerClient {
public:
#if !RELEASE_LOG_DISABLED
const PAL::Logger& mediaPlayerLogger() final
{
if (!nullLogger().get()) {
nullLogger() = PAL::Logger::create(this);
nullLogger()->setEnabled(this, false);
}

return *nullLogger().get();
}
#endif
};

const Vector<ContentType>& MediaPlayerClient::mediaContentTypesRequiringHardwareSupport() const
{
static NeverDestroyed<Vector<ContentType>> contentTypes;
@@ -172,7 +195,7 @@ const Vector<ContentType>& MediaPlayerClient::mediaContentTypesRequiringHardware

static MediaPlayerClient& nullMediaPlayerClient()
{
static NeverDestroyed<MediaPlayerClient> client;
static NeverDestroyed<NullMediaPlayerClient> client;
return client.get();
}

@@ -1487,6 +1510,13 @@ bool MediaPlayer::shouldCheckHardwareSupport() const
return client().mediaPlayerShouldCheckHardwareSupport();
}

#if !RELEASE_LOG_DISABLED
const PAL::Logger& MediaPlayer::mediaPlayerLogger()
{
return client().mediaPlayerLogger();
}
#endif

}

#endif
@@ -44,6 +44,7 @@
#include "SecurityOriginHash.h"
#include "Timer.h"
#include "VideoTrackPrivate.h"
#include <pal/Logger.h>
#include <runtime/Uint8Array.h>
#include <wtf/Forward.h>
#include <wtf/Function.h>
@@ -299,6 +300,11 @@ class MediaPlayerClient {
virtual bool mediaPlayerShouldDisableSleep() const { return false; }
virtual const Vector<ContentType>& mediaContentTypesRequiringHardwareSupport() const;
virtual bool mediaPlayerShouldCheckHardwareSupport() const { return false; }

#if !RELEASE_LOG_DISABLED
virtual const void* mediaPlayerLogIdentifier() { return nullptr; }
virtual const PAL::Logger& mediaPlayerLogger() = 0;
#endif
};

class MediaPlayerSupportsTypeClient {
@@ -626,6 +632,11 @@ class MediaPlayer : public MediaPlayerEnums, public RefCounted<MediaPlayer> {
const Vector<ContentType>& mediaContentTypesRequiringHardwareSupport() const;
bool shouldCheckHardwareSupport() const;

#if !RELEASE_LOG_DISABLED
const PAL::Logger& mediaPlayerLogger();
const void* mediaPlayerLogIdentifier() { return client().mediaPlayerLogIdentifier(); }
#endif

private:
MediaPlayer(MediaPlayerClient&);

0 comments on commit f6b232d

Please sign in to comment.