<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[243033] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/243033">243033</a></dd>
<dt>Author</dt> <dd>eric.carlson@apple.com</dd>
<dt>Date</dt> <dd>2019-03-15 22:21:43 -0700 (Fri, 15 Mar 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add media stream release logging
https://bugs.webkit.org/show_bug.cgi?id=195823
Source/WebCore:

<rdar://problem/48939406>

Reviewed by Youenn Fablet.

No new tests, no behavioral change.

* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::MediaStream):
(WebCore::MediaStream::clone):
(WebCore::MediaStream::addTrack):
(WebCore::MediaStream::removeTrack):
(WebCore::MediaStream::addTrackFromPlatform):
(WebCore::MediaStream::setIsActive):
(WebCore::MediaStream::mediaCanStart):
(WebCore::MediaStream::startProducingData):
(WebCore::MediaStream::stopProducingData):
(WebCore::MediaStream::endCaptureTracks):
(WebCore::MediaStream::stop):
(WebCore::MediaStream::logChannel const):
* Modules/mediastream/MediaStream.h:
* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::MediaStreamTrack):
(WebCore::MediaStreamTrack::logChannel const):
* Modules/mediastream/MediaStreamTrack.h:
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::addTrack):
(WebCore::LibWebRTCMediaEndpoint::sourceFromNewReceiver):
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::AudioContext):
(WebCore::nextLogIdentifier): Deleted.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement):
(WebCore::nextLogIdentifier): Deleted.
* html/HTMLMediaElement.h:
* platform/audio/PlatformMediaSession.cpp:
(WebCore::PlatformMediaSession::PlatformMediaSession):
(WebCore::nextLogIdentifier): Deleted.
* platform/audio/PlatformMediaSession.h:
* platform/graphics/IntSize.cpp:
(WebCore::IntSize::toJSONObject const):
(WebCore::IntSize::toJSONString const):
* platform/graphics/IntSize.h:
(WTF::LogArgument<WebCore::IntSize>::toString):
* platform/mediastream/MediaStreamPrivate.cpp:
(WebCore::MediaStreamPrivate::addTrack):
(WebCore::MediaStreamPrivate::removeTrack):
(WebCore::MediaStreamPrivate::startProducingData):
(WebCore::MediaStreamPrivate::stopProducingData):
(WebCore::MediaStreamPrivate::setCaptureTracksMuted):
(WebCore::MediaStreamPrivate::trackMutedChanged):
(WebCore::MediaStreamPrivate::trackEnabledChanged):
(WebCore::MediaStreamPrivate::trackStarted):
(WebCore::MediaStreamPrivate::trackEnded):
(WebCore::MediaStreamPrivate::setLogger):
(WebCore::MediaStreamPrivate::logChannel const):
* platform/mediastream/MediaStreamPrivate.h:
* platform/mediastream/MediaStreamTrackPrivate.cpp:
(WebCore::MediaStreamTrackPrivate::setLogger):
(WebCore::MediaStreamTrackPrivate::logChannel const):
* platform/mediastream/MediaStreamTrackPrivate.h:
* platform/mediastream/RealtimeIncomingAudioSource.cpp:
(WebCore::RealtimeIncomingAudioSource::RealtimeIncomingAudioSource):
(WebCore::RealtimeIncomingAudioSource::logChannel const): Deleted.
(WebCore::RealtimeIncomingAudioSource::logger const): Deleted.
* platform/mediastream/RealtimeIncomingAudioSource.h:
(WebCore::RealtimeIncomingAudioSource::setLogger): Deleted.
* platform/mediastream/RealtimeIncomingVideoSource.cpp:
(WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
(WebCore::RealtimeIncomingVideoSource::logChannel const): Deleted.
(WebCore::RealtimeIncomingVideoSource::logger const): Deleted.
* platform/mediastream/RealtimeIncomingVideoSource.h:
(WebCore::RealtimeIncomingVideoSource::setLogger): Deleted.
* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::RealtimeMediaSource):
(WebCore::RealtimeMediaSource::setInterrupted):
(WebCore::RealtimeMediaSource::setMuted):
(WebCore::RealtimeMediaSource::notifyMutedChange):
(WebCore::RealtimeMediaSource::notifySettingsDidChangeObservers):
(WebCore::RealtimeMediaSource::videoSampleAvailable):
(WebCore::RealtimeMediaSource::start):
(WebCore::RealtimeMediaSource::stop):
(WebCore::RealtimeMediaSource::captureFailed):
(WebCore::RealtimeMediaSource::applyConstraint):
(WebCore::RealtimeMediaSource::supportsConstraints):
(WebCore::RealtimeMediaSource::applyConstraints):
(WebCore::RealtimeMediaSource::setSize):
(WebCore::RealtimeMediaSource::setIntrinsicSize):
(WebCore::RealtimeMediaSource::setFrameRate):
(WebCore::RealtimeMediaSource::setAspectRatio):
(WebCore::RealtimeMediaSource::setFacingMode):
(WebCore::RealtimeMediaSource::setVolume):
(WebCore::RealtimeMediaSource::setSampleRate):
(WebCore::RealtimeMediaSource::setSampleSize):
(WebCore::RealtimeMediaSource::setEchoCancellation):
(WebCore::RealtimeMediaSource::setLogger):
(WebCore::RealtimeMediaSource::logChannel const):
(WebCore::convertEnumerationToString):
* platform/mediastream/RealtimeMediaSource.h:
(WTF::LogArgument<WebCore::RealtimeMediaSource::Type>::toString):
* platform/mediastream/RealtimeMediaSourceSettings.cpp:
(WebCore::RealtimeMediaSourceSettings::convertFlagsToString):
(WebCore::convertEnumerationToString):
* platform/mediastream/RealtimeMediaSourceSettings.h:
(WTF::LogArgument<WebCore::RealtimeMediaSourceSettings::VideoFacingMode>::toString):
(WTF::LogArgument<OptionSet<WebCore::RealtimeMediaSourceSettings::Flag>>::toString):
* platform/mediastream/RealtimeOutgoingAudioSource.cpp:
(WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
(WebCore::RealtimeOutgoingAudioSource::logChannel const):
(WebCore::RealtimeOutgoingAudioSource::logger const): Deleted.
* platform/mediastream/RealtimeOutgoingAudioSource.h:
(WebCore::RealtimeOutgoingAudioSource::setLogger): Deleted.
* platform/mediastream/RealtimeOutgoingVideoSource.cpp:
(WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource):
(WebCore::RealtimeOutgoingVideoSource::sendOneBlackFrame):
(WebCore::RealtimeOutgoingVideoSource::sendFrame):
(WebCore::RealtimeOutgoingVideoSource::logChannel const):
(WebCore::RealtimeOutgoingVideoSource::logger const): Deleted.
* platform/mediastream/RealtimeOutgoingVideoSource.h:
(WebCore::RealtimeOutgoingVideoSource::setLogger): Deleted.
* platform/mediastream/RealtimeVideoSource.cpp:
(WebCore::RealtimeVideoSource::setSizeAndFrameRate):
(WebCore::SizeAndFrameRate::toJSONObject const):
(WebCore::SizeAndFrameRate::toJSONString const):
* platform/mediastream/RealtimeVideoSource.h:
(WTF::LogArgument<WebCore::SizeAndFrameRate>::toString):
* platform/mediastream/mac/AVVideoCaptureSource.h:
* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::clearSession):
(WebCore::AVVideoCaptureSource::startProducingData):
(WebCore::AVVideoCaptureSource::stopProducingData):
(WebCore::AVVideoCaptureSource::setSizeAndFrameRateWithPreset):
(WebCore::AVVideoCaptureSource::setupSession):
(WebCore::AVVideoCaptureSource::frameDurationForFrameRate):
(WebCore::AVVideoCaptureSource::setupCaptureSession):
(WebCore::AVVideoCaptureSource::captureSessionIsRunningDidChange):
(WebCore::AVVideoCaptureSource::captureDeviceSuspendedDidChange):
(WebCore::AVVideoCaptureSource::captureSessionRuntimeError):
(WebCore::AVVideoCaptureSource::captureSessionBeginInterruption):
(WebCore::AVVideoCaptureSource::captureSessionEndInterruption):
(WebCore::AVVideoCaptureSource::deviceDisconnected):
(-[WebCoreAVVideoCaptureSourceObserver observeValueForKeyPath:ofObject:change:context:]):
(-[WebCoreAVVideoCaptureSourceObserver deviceConnectedDidChange:]):
(-[WebCoreAVVideoCaptureSourceObserver sessionRuntimeError:]):
(-[WebCoreAVVideoCaptureSourceObserver beginSessionInterrupted:]):
(-[WebCoreAVVideoCaptureSourceObserver endSessionInterrupted:]):
(WebCore::AVVideoCaptureSource::initializeSession): Deleted.
* platform/mediastream/mac/CoreAudioCaptureSource.cpp:
(WebCore::CoreAudioSharedUnit::setupAudioUnit):
(WebCore::CoreAudioSharedUnit::verifyIsCapturing):
(WebCore::CoreAudioSharedUnit::captureFailed):
(WebCore::CoreAudioCaptureSource::initializeToStartProducingData):
(WebCore::CoreAudioCaptureSource::addEchoCancellationSource):
(WebCore::CoreAudioCaptureSource::removeEchoCancellationSource):
(WebCore::CoreAudioCaptureSource::startProducingData):
(WebCore::CoreAudioCaptureSource::stopProducingData):
(WebCore::CoreAudioCaptureSource::scheduleReconfiguration):
(WebCore::CoreAudioCaptureSource::beginInterruption):
(WebCore::CoreAudioCaptureSource::endInterruption):
* platform/mediastream/mac/CoreAudioCaptureSource.h:
* platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
* platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
(WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream):
(WebCore::ScreenDisplayCaptureSourceMac::startProducingData):
(WebCore::ScreenDisplayCaptureSourceMac::stopProducingData):
(WebCore::ScreenDisplayCaptureSourceMac::startDisplayStream):

Source/WTF:

Reviewed by Youenn Fablet.

* wtf/LoggerHelper.h: Add LOG_IF variants that check a condition before logging.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfLoggerHelperh">trunk/Source/WTF/wtf/LoggerHelper.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaStreamcpp">trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaStreamh">trunk/Source/WebCore/Modules/mediastream/MediaStream.h</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaStreamTrackcpp">trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaStreamTrackh">trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.h</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamlibwebrtcLibWebRTCMediaEndpointcpp">trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioContextcpp">trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementcpp">trunk/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementh">trunk/Source/WebCore/html/HTMLMediaElement.h</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioPlatformMediaSessioncpp">trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioPlatformMediaSessionh">trunk/Source/WebCore/platform/audio/PlatformMediaSession.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsIntSizecpp">trunk/Source/WebCore/platform/graphics/IntSize.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsIntSizeh">trunk/Source/WebCore/platform/graphics/IntSize.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamMediaStreamPrivatecpp">trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamMediaStreamPrivateh">trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamMediaStreamTrackPrivatecpp">trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamMediaStreamTrackPrivateh">trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamRealtimeIncomingAudioSourcecpp">trunk/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamRealtimeIncomingAudioSourceh">trunk/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamRealtimeIncomingVideoSourcecpp">trunk/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamRealtimeIncomingVideoSourceh">trunk/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamRealtimeMediaSourcecpp">trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamRealtimeMediaSourceh">trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamRealtimeMediaSourceSettingscpp">trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceSettings.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamRealtimeMediaSourceSettingsh">trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceSettings.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamRealtimeOutgoingAudioSourcecpp">trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamRealtimeOutgoingAudioSourceh">trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamRealtimeOutgoingVideoSourcecpp">trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamRealtimeOutgoingVideoSourceh">trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamRealtimeVideoSourcecpp">trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamRealtimeVideoSourceh">trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamlibwebrtcLibWebRTCProvidercpp">trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreammacAVVideoCaptureSourceh">trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreammacAVVideoCaptureSourcemm">trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreammacCoreAudioCaptureSourcecpp">trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreammacCoreAudioCaptureSourceh">trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreammacScreenDisplayCaptureSourceMach">trunk/Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreammacScreenDisplayCaptureSourceMacmm">trunk/Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog       2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WTF/ChangeLog  2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2019-03-15  Eric Carlson  <eric.carlson@apple.com>
+
+        Add media stream release logging
+        https://bugs.webkit.org/show_bug.cgi?id=195823
+
+        Reviewed by Youenn Fablet.
+
+        * wtf/LoggerHelper.h: Add LOG_IF variants that check a condition before logging.
+
</ins><span class="cx"> 2019-03-15  Truitt Savell  <tsavell@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r243008.
</span></span></pre></div>
<a id="trunkSourceWTFwtfLoggerHelperh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/LoggerHelper.h (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/LoggerHelper.h      2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WTF/wtf/LoggerHelper.h 2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2017 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2017-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><ins>+#include <wtf/CryptographicallyRandomNumber.h>
</ins><span class="cx"> #include <wtf/Logger.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span><span class="lines">@@ -45,11 +46,16 @@
</span><span class="cx"> #define ALWAYS_LOG(...)     logger().logAlways(logChannel(), __VA_ARGS__)
</span><span class="cx"> #define ERROR_LOG(...)      logger().error(logChannel(), __VA_ARGS__)
</span><span class="cx"> #define WARNING_LOG(...)    logger().warning(logChannel(), __VA_ARGS__)
</span><del>-#define NOTICE_LOG(...)     logger().notice(logChannel(), __VA_ARGS__)
</del><span class="cx"> #define INFO_LOG(...)       logger().info(logChannel(), __VA_ARGS__)
</span><span class="cx"> #define DEBUG_LOG(...)      logger().debug(logChannel(), __VA_ARGS__)
</span><span class="cx"> #define WILL_LOG(_level_)   logger().willLog(logChannel(), _level_)
</span><span class="cx"> 
</span><ins>+#define ALWAYS_LOG_IF(condition, ...)     if (condition) logger().logAlways(logChannel(), __VA_ARGS__)
+#define ERROR_LOG_IF(condition, ...)      if (condition) logger().error(logChannel(), __VA_ARGS__)
+#define WARNING_LOG_IF(condition, ...)    if (condition) logger().warning(logChannel(), __VA_ARGS__)
+#define INFO_LOG_IF(condition, ...)       if (condition) logger().info(logChannel(), __VA_ARGS__)
+#define DEBUG_LOG_IF(condition, ...)      if (condition) logger().debug(logChannel(), __VA_ARGS__)
+
</ins><span class="cx">     const void* childLogIdentifier(uint64_t identifier) const
</span><span class="cx">     {
</span><span class="cx">         static const int64_t parentMask = 0xffffffffffff0000l;
</span><span class="lines">@@ -56,6 +62,12 @@
</span><span class="cx">         static const int64_t maskLowerWord = 0xffffl;
</span><span class="cx">         return reinterpret_cast<const void*>((reinterpret_cast<uint64_t>(logIdentifier()) & parentMask) | (identifier & maskLowerWord));
</span><span class="cx">     }
</span><ins>+
+    static const void* uniqueLogIdentifier()
+    {
+        static uint64_t logIdentifier = cryptographicallyRandomNumber();
+        return reinterpret_cast<const void*>(++logIdentifier);
+    }
</ins><span class="cx"> #else
</span><span class="cx"> 
</span><span class="cx"> #define LOGIDENTIFIER (WTF::nullopt)
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/ChangeLog      2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,3 +1,173 @@
</span><ins>+2019-03-15  Eric Carlson  <eric.carlson@apple.com>
+
+        Add media stream release logging
+        https://bugs.webkit.org/show_bug.cgi?id=195823
+        <rdar://problem/48939406>
+
+        Reviewed by Youenn Fablet.
+
+        No new tests, no behavioral change.
+
+        * Modules/mediastream/MediaStream.cpp:
+        (WebCore::MediaStream::MediaStream):
+        (WebCore::MediaStream::clone):
+        (WebCore::MediaStream::addTrack):
+        (WebCore::MediaStream::removeTrack):
+        (WebCore::MediaStream::addTrackFromPlatform):
+        (WebCore::MediaStream::setIsActive):
+        (WebCore::MediaStream::mediaCanStart):
+        (WebCore::MediaStream::startProducingData):
+        (WebCore::MediaStream::stopProducingData):
+        (WebCore::MediaStream::endCaptureTracks):
+        (WebCore::MediaStream::stop):
+        (WebCore::MediaStream::logChannel const):
+        * Modules/mediastream/MediaStream.h:
+        * Modules/mediastream/MediaStreamTrack.cpp:
+        (WebCore::MediaStreamTrack::MediaStreamTrack):
+        (WebCore::MediaStreamTrack::logChannel const):
+        * Modules/mediastream/MediaStreamTrack.h:
+        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
+        (WebCore::LibWebRTCMediaEndpoint::addTrack):
+        (WebCore::LibWebRTCMediaEndpoint::sourceFromNewReceiver):
+        * Modules/webaudio/AudioContext.cpp:
+        (WebCore::AudioContext::AudioContext):
+        (WebCore::nextLogIdentifier): Deleted.
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::HTMLMediaElement):
+        (WebCore::nextLogIdentifier): Deleted.
+        * html/HTMLMediaElement.h:
+        * platform/audio/PlatformMediaSession.cpp:
+        (WebCore::PlatformMediaSession::PlatformMediaSession):
+        (WebCore::nextLogIdentifier): Deleted.
+        * platform/audio/PlatformMediaSession.h:
+        * platform/graphics/IntSize.cpp:
+        (WebCore::IntSize::toJSONObject const):
+        (WebCore::IntSize::toJSONString const):
+        * platform/graphics/IntSize.h:
+        (WTF::LogArgument<WebCore::IntSize>::toString):
+        * platform/mediastream/MediaStreamPrivate.cpp:
+        (WebCore::MediaStreamPrivate::addTrack):
+        (WebCore::MediaStreamPrivate::removeTrack):
+        (WebCore::MediaStreamPrivate::startProducingData):
+        (WebCore::MediaStreamPrivate::stopProducingData):
+        (WebCore::MediaStreamPrivate::setCaptureTracksMuted):
+        (WebCore::MediaStreamPrivate::trackMutedChanged):
+        (WebCore::MediaStreamPrivate::trackEnabledChanged):
+        (WebCore::MediaStreamPrivate::trackStarted):
+        (WebCore::MediaStreamPrivate::trackEnded):
+        (WebCore::MediaStreamPrivate::setLogger):
+        (WebCore::MediaStreamPrivate::logChannel const):
+        * platform/mediastream/MediaStreamPrivate.h:
+        * platform/mediastream/MediaStreamTrackPrivate.cpp:
+        (WebCore::MediaStreamTrackPrivate::setLogger):
+        (WebCore::MediaStreamTrackPrivate::logChannel const):
+        * platform/mediastream/MediaStreamTrackPrivate.h:
+        * platform/mediastream/RealtimeIncomingAudioSource.cpp:
+        (WebCore::RealtimeIncomingAudioSource::RealtimeIncomingAudioSource):
+        (WebCore::RealtimeIncomingAudioSource::logChannel const): Deleted.
+        (WebCore::RealtimeIncomingAudioSource::logger const): Deleted.
+        * platform/mediastream/RealtimeIncomingAudioSource.h:
+        (WebCore::RealtimeIncomingAudioSource::setLogger): Deleted.
+        * platform/mediastream/RealtimeIncomingVideoSource.cpp:
+        (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
+        (WebCore::RealtimeIncomingVideoSource::logChannel const): Deleted.
+        (WebCore::RealtimeIncomingVideoSource::logger const): Deleted.
+        * platform/mediastream/RealtimeIncomingVideoSource.h:
+        (WebCore::RealtimeIncomingVideoSource::setLogger): Deleted.
+        * platform/mediastream/RealtimeMediaSource.cpp:
+        (WebCore::RealtimeMediaSource::RealtimeMediaSource):
+        (WebCore::RealtimeMediaSource::setInterrupted):
+        (WebCore::RealtimeMediaSource::setMuted):
+        (WebCore::RealtimeMediaSource::notifyMutedChange):
+        (WebCore::RealtimeMediaSource::notifySettingsDidChangeObservers):
+        (WebCore::RealtimeMediaSource::videoSampleAvailable):
+        (WebCore::RealtimeMediaSource::start):
+        (WebCore::RealtimeMediaSource::stop):
+        (WebCore::RealtimeMediaSource::captureFailed):
+        (WebCore::RealtimeMediaSource::applyConstraint):
+        (WebCore::RealtimeMediaSource::supportsConstraints):
+        (WebCore::RealtimeMediaSource::applyConstraints):
+        (WebCore::RealtimeMediaSource::setSize):
+        (WebCore::RealtimeMediaSource::setIntrinsicSize):
+        (WebCore::RealtimeMediaSource::setFrameRate):
+        (WebCore::RealtimeMediaSource::setAspectRatio):
+        (WebCore::RealtimeMediaSource::setFacingMode):
+        (WebCore::RealtimeMediaSource::setVolume):
+        (WebCore::RealtimeMediaSource::setSampleRate):
+        (WebCore::RealtimeMediaSource::setSampleSize):
+        (WebCore::RealtimeMediaSource::setEchoCancellation):
+        (WebCore::RealtimeMediaSource::setLogger):
+        (WebCore::RealtimeMediaSource::logChannel const):
+        (WebCore::convertEnumerationToString):
+        * platform/mediastream/RealtimeMediaSource.h:
+        (WTF::LogArgument<WebCore::RealtimeMediaSource::Type>::toString):
+        * platform/mediastream/RealtimeMediaSourceSettings.cpp:
+        (WebCore::RealtimeMediaSourceSettings::convertFlagsToString):
+        (WebCore::convertEnumerationToString):
+        * platform/mediastream/RealtimeMediaSourceSettings.h:
+        (WTF::LogArgument<WebCore::RealtimeMediaSourceSettings::VideoFacingMode>::toString):
+        (WTF::LogArgument<OptionSet<WebCore::RealtimeMediaSourceSettings::Flag>>::toString):
+        * platform/mediastream/RealtimeOutgoingAudioSource.cpp:
+        (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
+        (WebCore::RealtimeOutgoingAudioSource::logChannel const):
+        (WebCore::RealtimeOutgoingAudioSource::logger const): Deleted.
+        * platform/mediastream/RealtimeOutgoingAudioSource.h:
+        (WebCore::RealtimeOutgoingAudioSource::setLogger): Deleted.
+        * platform/mediastream/RealtimeOutgoingVideoSource.cpp:
+        (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource):
+        (WebCore::RealtimeOutgoingVideoSource::sendOneBlackFrame):
+        (WebCore::RealtimeOutgoingVideoSource::sendFrame):
+        (WebCore::RealtimeOutgoingVideoSource::logChannel const):
+        (WebCore::RealtimeOutgoingVideoSource::logger const): Deleted.
+        * platform/mediastream/RealtimeOutgoingVideoSource.h:
+        (WebCore::RealtimeOutgoingVideoSource::setLogger): Deleted.
+        * platform/mediastream/RealtimeVideoSource.cpp:
+        (WebCore::RealtimeVideoSource::setSizeAndFrameRate):
+        (WebCore::SizeAndFrameRate::toJSONObject const):
+        (WebCore::SizeAndFrameRate::toJSONString const):
+        * platform/mediastream/RealtimeVideoSource.h:
+        (WTF::LogArgument<WebCore::SizeAndFrameRate>::toString):
+        * platform/mediastream/mac/AVVideoCaptureSource.h:
+        * platform/mediastream/mac/AVVideoCaptureSource.mm:
+        (WebCore::AVVideoCaptureSource::clearSession):
+        (WebCore::AVVideoCaptureSource::startProducingData):
+        (WebCore::AVVideoCaptureSource::stopProducingData):
+        (WebCore::AVVideoCaptureSource::setSizeAndFrameRateWithPreset):
+        (WebCore::AVVideoCaptureSource::setupSession):
+        (WebCore::AVVideoCaptureSource::frameDurationForFrameRate):
+        (WebCore::AVVideoCaptureSource::setupCaptureSession):
+        (WebCore::AVVideoCaptureSource::captureSessionIsRunningDidChange):
+        (WebCore::AVVideoCaptureSource::captureDeviceSuspendedDidChange):
+        (WebCore::AVVideoCaptureSource::captureSessionRuntimeError):
+        (WebCore::AVVideoCaptureSource::captureSessionBeginInterruption):
+        (WebCore::AVVideoCaptureSource::captureSessionEndInterruption):
+        (WebCore::AVVideoCaptureSource::deviceDisconnected):
+        (-[WebCoreAVVideoCaptureSourceObserver observeValueForKeyPath:ofObject:change:context:]):
+        (-[WebCoreAVVideoCaptureSourceObserver deviceConnectedDidChange:]):
+        (-[WebCoreAVVideoCaptureSourceObserver sessionRuntimeError:]):
+        (-[WebCoreAVVideoCaptureSourceObserver beginSessionInterrupted:]):
+        (-[WebCoreAVVideoCaptureSourceObserver endSessionInterrupted:]):
+        (WebCore::AVVideoCaptureSource::initializeSession): Deleted.
+        * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
+        (WebCore::CoreAudioSharedUnit::setupAudioUnit):
+        (WebCore::CoreAudioSharedUnit::verifyIsCapturing):
+        (WebCore::CoreAudioSharedUnit::captureFailed):
+        (WebCore::CoreAudioCaptureSource::initializeToStartProducingData):
+        (WebCore::CoreAudioCaptureSource::addEchoCancellationSource):
+        (WebCore::CoreAudioCaptureSource::removeEchoCancellationSource):
+        (WebCore::CoreAudioCaptureSource::startProducingData):
+        (WebCore::CoreAudioCaptureSource::stopProducingData):
+        (WebCore::CoreAudioCaptureSource::scheduleReconfiguration):
+        (WebCore::CoreAudioCaptureSource::beginInterruption):
+        (WebCore::CoreAudioCaptureSource::endInterruption):
+        * platform/mediastream/mac/CoreAudioCaptureSource.h:
+        * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
+        * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
+        (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream):
+        (WebCore::ScreenDisplayCaptureSourceMac::startProducingData):
+        (WebCore::ScreenDisplayCaptureSourceMac::stopProducingData):
+        (WebCore::ScreenDisplayCaptureSourceMac::startDisplayStream):
+
</ins><span class="cx"> 2019-03-15  Devin Rousso  <drousso@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Canvas: remove agent as observer when disabling
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaStreamcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp 2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp    2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2011 Google Inc. All rights reserved.
</span><span class="cx">  * Copyright (C) 2011, 2012, 2015 Ericsson AB. All rights reserved.
</span><del>- * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
</span><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -78,10 +78,19 @@
</span><span class="cx">     : ActiveDOMObject(&context)
</span><span class="cx">     , m_private(MediaStreamPrivate::create(createTrackPrivateVector(tracks)))
</span><span class="cx">     , m_mediaSession(PlatformMediaSession::create(*this))
</span><ins>+#if !RELEASE_LOG_DISABLED
+    , m_logger(document()->logger())
+    , m_logIdentifier(uniqueLogIdentifier())
+#endif
</ins><span class="cx"> {
</span><span class="cx">     // This constructor preserves MediaStreamTrack instances and must be used by calls originating
</span><span class="cx">     // from the JavaScript MediaStream constructor.
</span><span class="cx"> 
</span><ins>+#if !RELEASE_LOG_DISABLED
+    ALWAYS_LOG(LOGIDENTIFIER);
+    m_private->setLogger(logger(), logIdentifier());
+#endif
+
</ins><span class="cx">     for (auto& track : tracks) {
</span><span class="cx">         track->addObserver(*this);
</span><span class="cx">         m_trackSet.add(track->id(), track);
</span><span class="lines">@@ -97,7 +106,15 @@
</span><span class="cx">     : ActiveDOMObject(&context)
</span><span class="cx">     , m_private(WTFMove(streamPrivate))
</span><span class="cx">     , m_mediaSession(PlatformMediaSession::create(*this))
</span><ins>+#if !RELEASE_LOG_DISABLED
+    , m_logger(document()->logger())
+    , m_logIdentifier(uniqueLogIdentifier())
+#endif
</ins><span class="cx"> {
</span><ins>+#if !RELEASE_LOG_DISABLED
+    ALWAYS_LOG(LOGIDENTIFIER);
+    m_private->setLogger(logger(), logIdentifier());
+#endif
</ins><span class="cx">     setIsActive(m_private->active());
</span><span class="cx">     if (document()->page() && document()->page()->isMediaCaptureMuted())
</span><span class="cx">         m_private->setCaptureTracksMuted(true);
</span><span class="lines">@@ -129,6 +146,8 @@
</span><span class="cx"> 
</span><span class="cx"> RefPtr<MediaStream> MediaStream::clone()
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG(LOGIDENTIFIER);
+
</ins><span class="cx">     MediaStreamTrackVector clonedTracks;
</span><span class="cx">     clonedTracks.reserveInitialCapacity(m_trackSet.size());
</span><span class="cx"> 
</span><span class="lines">@@ -140,6 +159,8 @@
</span><span class="cx"> 
</span><span class="cx"> void MediaStream::addTrack(MediaStreamTrack& track)
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG(LOGIDENTIFIER, track.logIdentifier());
+
</ins><span class="cx">     if (!internalAddTrack(track, StreamModifier::DomAPI))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -149,6 +170,8 @@
</span><span class="cx"> 
</span><span class="cx"> void MediaStream::removeTrack(MediaStreamTrack& track)
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG(LOGIDENTIFIER, track.logIdentifier());
+
</ins><span class="cx">     if (!internalRemoveTrack(track.id(), StreamModifier::DomAPI))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -207,6 +230,8 @@
</span><span class="cx"> 
</span><span class="cx"> void MediaStream::addTrackFromPlatform(Ref<MediaStreamTrack>&& track)
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG(LOGIDENTIFIER, track->logIdentifier());
+
</ins><span class="cx">     auto* privateTrack = &track->privateTrack();
</span><span class="cx">     internalAddTrack(WTFMove(track), StreamModifier::Platform);
</span><span class="cx">     m_private->addTrack(privateTrack, MediaStreamPrivate::NotifyClientOption::Notify);
</span><span class="lines">@@ -255,6 +280,8 @@
</span><span class="cx">     if (m_isActive == active)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG(LOGIDENTIFIER, active);
+
</ins><span class="cx">     m_isActive = active;
</span><span class="cx">     statusDidChange();
</span><span class="cx"> }
</span><span class="lines">@@ -261,6 +288,8 @@
</span><span class="cx"> 
</span><span class="cx"> void MediaStream::mediaCanStart(Document& document)
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG(LOGIDENTIFIER);
+
</ins><span class="cx">     ASSERT_UNUSED(document, &document == this->document());
</span><span class="cx">     ASSERT(m_isWaitingUntilMediaCanStart);
</span><span class="cx">     if (m_isWaitingUntilMediaCanStart) {
</span><span class="lines">@@ -275,9 +304,11 @@
</span><span class="cx">     if (!document || !document->page())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG(LOGIDENTIFIER);
+
</ins><span class="cx">     // If we can't start a load right away, start it later.
</span><span class="cx">     if (!document->page()->canStartMedia()) {
</span><del>-        LOG(Media, "MediaStream::startProducingData(%p) - not allowed to start in background, waiting", this);
</del><ins>+        ALWAYS_LOG(LOGIDENTIFIER, "not allowed to start in background, waiting");
</ins><span class="cx">         if (m_isWaitingUntilMediaCanStart)
</span><span class="cx">             return;
</span><span class="cx"> 
</span><span class="lines">@@ -301,6 +332,9 @@
</span><span class="cx"> {
</span><span class="cx">     if (!m_isProducingData)
</span><span class="cx">         return;
</span><ins>+
+    ALWAYS_LOG(LOGIDENTIFIER);
+
</ins><span class="cx">     m_isProducingData = false;
</span><span class="cx"> 
</span><span class="cx">     m_mediaSession->canProduceAudioChanged();
</span><span class="lines">@@ -310,6 +344,8 @@
</span><span class="cx"> 
</span><span class="cx"> void MediaStream::endCaptureTracks()
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG(LOGIDENTIFIER);
+
</ins><span class="cx">     for (auto& track : m_trackSet.values()) {
</span><span class="cx">         if (track->isCaptureTrack())
</span><span class="cx">             track->stopTrack(MediaStreamTrack::StopMode::PostEvent);
</span><span class="lines">@@ -482,6 +518,13 @@
</span><span class="cx">     return m_isActive;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if !RELEASE_LOG_DISABLED
+WTFLogChannel& MediaStream::logChannel() const
+{
+    return LogWebRTC;
+}
+#endif
+    
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(MEDIA_STREAM)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaStreamh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaStream.h (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaStream.h   2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStream.h      2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2011 Google Inc. All rights reserved.
</span><span class="cx">  * Copyright (C) 2011, 2015 Ericsson AB. All rights reserved.
</span><del>- * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
</span><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> #include "Timer.h"
</span><span class="cx"> #include "URLRegistry.h"
</span><span class="cx"> #include <wtf/HashMap.h>
</span><ins>+#include <wtf/LoggerHelper.h>
</ins><span class="cx"> #include <wtf/RefCounted.h>
</span><span class="cx"> #include <wtf/RefPtr.h>
</span><span class="cx"> 
</span><span class="lines">@@ -55,6 +56,9 @@
</span><span class="cx">     , public MediaStreamPrivate::Observer
</span><span class="cx">     , private MediaCanStartListener
</span><span class="cx">     , private PlatformMediaSessionClient
</span><ins>+#if !RELEASE_LOG_DISABLED
+    , private LoggerHelper
+#endif
</ins><span class="cx">     , public RefCounted<MediaStream> {
</span><span class="cx"> public:
</span><span class="cx">     class Observer {
</span><span class="lines">@@ -119,6 +123,13 @@
</span><span class="cx">     MediaStream(ScriptExecutionContext&, const MediaStreamTrackVector&);
</span><span class="cx">     MediaStream(ScriptExecutionContext&, Ref<MediaStreamPrivate>&&);
</span><span class="cx"> 
</span><ins>+#if !RELEASE_LOG_DISABLED
+    const Logger& logger() const final { return m_logger.get(); }
+    const void* logIdentifier() const final { return m_logIdentifier; }
+    WTFLogChannel& logChannel() const final;
+    const char* logClassName() const final { return "MediaStream"; }
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx"> 
</span><span class="cx">     // EventTarget
</span><span class="lines">@@ -175,6 +186,11 @@
</span><span class="cx"> 
</span><span class="cx">     MediaProducer::MediaStateFlags m_state { MediaProducer::IsNotPlaying };
</span><span class="cx"> 
</span><ins>+#if !RELEASE_LOG_DISABLED
+    Ref<Logger> m_logger;
+    const void* m_logIdentifier;
+#endif
+
</ins><span class="cx">     bool m_isActive { false };
</span><span class="cx">     bool m_isProducingData { false };
</span><span class="cx">     bool m_isWaitingUntilMediaCanStart { false };
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaStreamTrackcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp    2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp       2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2011 Google Inc. All rights reserved.
</span><span class="cx">  * Copyright (C) 2011, 2015 Ericsson AB. All rights reserved.
</span><del>- * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
</span><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -54,10 +54,18 @@
</span><span class="cx"> MediaStreamTrack::MediaStreamTrack(ScriptExecutionContext& context, Ref<MediaStreamTrackPrivate>&& privateTrack)
</span><span class="cx">     : ActiveDOMObject(&context)
</span><span class="cx">     , m_private(WTFMove(privateTrack))
</span><ins>+#if !RELEASE_LOG_DISABLED
+    , m_logger(document()->logger())
+    , m_logIdentifier(uniqueLogIdentifier())
+#endif
</ins><span class="cx">     , m_taskQueue(context)
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG(LOGIDENTIFIER);
</ins><span class="cx">     suspendIfNeeded();
</span><span class="cx"> 
</span><ins>+#if !RELEASE_LOG_DISABLED
+    m_private->setLogger(logger(), logIdentifier());
+#endif
</ins><span class="cx">     m_private->addObserver(*this);
</span><span class="cx"> 
</span><span class="cx">     if (auto document = this->document())
</span><span class="lines">@@ -489,6 +497,13 @@
</span><span class="cx">     return downcast<Document>(scriptExecutionContext());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if !RELEASE_LOG_DISABLED
+WTFLogChannel& MediaStreamTrack::logChannel() const
+{
+    return LogWebRTC;
+}
+#endif
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(MEDIA_STREAM)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaStreamTrackh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.h (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.h      2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.h 2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2011 Google Inc. All rights reserved.
</span><span class="cx">  * Copyright (C) 2011, 2015 Ericsson AB. All rights reserved.
</span><del>- * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
</span><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> #include "MediaProducer.h"
</span><span class="cx"> #include "MediaStreamTrackPrivate.h"
</span><span class="cx"> #include "MediaTrackConstraints.h"
</span><ins>+#include <wtf/LoggerHelper.h>
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -46,13 +47,17 @@
</span><span class="cx"> 
</span><span class="cx"> struct MediaTrackConstraints;
</span><span class="cx"> 
</span><del>-class MediaStreamTrack :
-    public RefCounted<MediaStreamTrack>,
-    public ActiveDOMObject,
-    public EventTargetWithInlineData,
-    public CanMakeWeakPtr<MediaStreamTrack>,
-    private MediaProducer,
-    private MediaStreamTrackPrivate::Observer {
</del><ins>+class MediaStreamTrack
+    : public RefCounted<MediaStreamTrack>
+    , public ActiveDOMObject
+    , public EventTargetWithInlineData
+    , public CanMakeWeakPtr<MediaStreamTrack>
+    , private MediaProducer
+    , private MediaStreamTrackPrivate::Observer
+#if !RELEASE_LOG_DISABLED
+    , private LoggerHelper
+#endif
+{
</ins><span class="cx"> public:
</span><span class="cx">     class Observer {
</span><span class="cx">     public:
</span><span class="lines">@@ -69,7 +74,6 @@
</span><span class="cx">     WEBCORE_EXPORT const String& id() const;
</span><span class="cx">     const String& label() const;
</span><span class="cx"> 
</span><del>-
</del><span class="cx">     const AtomicString& contentHint() const;
</span><span class="cx">     void setContentHint(const String&);
</span><span class="cx">         
</span><span class="lines">@@ -145,6 +149,11 @@
</span><span class="cx"> 
</span><span class="cx">     void setIdForTesting(String&& id) { m_private->setIdForTesting(WTFMove(id)); }
</span><span class="cx"> 
</span><ins>+#if !RELEASE_LOG_DISABLED
+    const Logger& logger() const final { return m_logger.get(); }
+    const void* logIdentifier() const final { return m_logIdentifier; }
+#endif
+
</ins><span class="cx"> protected:
</span><span class="cx">     MediaStreamTrack(ScriptExecutionContext&, Ref<MediaStreamTrackPrivate>&&);
</span><span class="cx"> 
</span><span class="lines">@@ -176,9 +185,16 @@
</span><span class="cx">     void trackSettingsChanged(MediaStreamTrackPrivate&) final;
</span><span class="cx">     void trackEnabledChanged(MediaStreamTrackPrivate&) final;
</span><span class="cx"> 
</span><ins>+#if !RELEASE_LOG_DISABLED
+    const char* logClassName() const final { return "MediaStreamTrack"; }
+    WTFLogChannel& logChannel() const final;
+    
+    Ref<const Logger> m_logger;
+    const void* m_logIdentifier;
+#endif
+
</ins><span class="cx">     Vector<Observer*> m_observers;
</span><span class="cx"> 
</span><del>-
</del><span class="cx">     MediaTrackConstraints m_constraints;
</span><span class="cx">     Optional<DOMPromiseDeferred<void>> m_promise;
</span><span class="cx">     GenericTaskQueue<ScriptExecutionContext> m_taskQueue;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamlibwebrtcLibWebRTCMediaEndpointcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp    2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp       2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -219,9 +219,6 @@
</span><span class="cx">     switch (track.privateTrack().type()) {
</span><span class="cx">     case RealtimeMediaSource::Type::Audio: {
</span><span class="cx">         auto audioSource = RealtimeOutgoingAudioSource::create(track.privateTrack());
</span><del>-#if !RELEASE_LOG_DISABLED
-        audioSource->setLogger(m_logger.copyRef());
-#endif
</del><span class="cx">         rtcTrack = m_peerConnectionFactory.CreateAudioTrack(track.id().utf8().data(), audioSource.ptr());
</span><span class="cx">         source = WTFMove(audioSource);
</span><span class="cx">         break;
</span><span class="lines">@@ -228,9 +225,6 @@
</span><span class="cx">     }
</span><span class="cx">     case RealtimeMediaSource::Type::Video: {
</span><span class="cx">         auto videoSource = RealtimeOutgoingVideoSource::create(track.privateTrack());
</span><del>-#if !RELEASE_LOG_DISABLED
-        videoSource->setLogger(m_logger.copyRef());
-#endif
</del><span class="cx">         rtcTrack = m_peerConnectionFactory.CreateVideoTrack(track.id().utf8().data(), videoSource.ptr());
</span><span class="cx">         source = WTFMove(videoSource);
</span><span class="cx">         break;
</span><span class="lines">@@ -462,19 +456,11 @@
</span><span class="cx">         return nullptr;
</span><span class="cx">     case cricket::MEDIA_TYPE_AUDIO: {
</span><span class="cx">         rtc::scoped_refptr<webrtc::AudioTrackInterface> audioTrack = static_cast<webrtc::AudioTrackInterface*>(rtcTrack.get());
</span><del>-        auto audioSource = RealtimeIncomingAudioSource::create(WTFMove(audioTrack), fromStdString(rtcTrack->id()));
-#if !RELEASE_LOG_DISABLED
-        audioSource->setLogger(m_logger.copyRef());
-#endif
-        return audioSource;
</del><ins>+        return RealtimeIncomingAudioSource::create(WTFMove(audioTrack), fromStdString(rtcTrack->id()));
</ins><span class="cx">     }
</span><span class="cx">     case cricket::MEDIA_TYPE_VIDEO: {
</span><span class="cx">         rtc::scoped_refptr<webrtc::VideoTrackInterface> videoTrack = static_cast<webrtc::VideoTrackInterface*>(rtcTrack.get());
</span><del>-        auto videoSource =  RealtimeIncomingVideoSource::create(WTFMove(videoTrack), fromStdString(rtcTrack->id()));
-#if !RELEASE_LOG_DISABLED
-        videoSource->setLogger(m_logger.copyRef());
-#endif
-        return videoSource;
</del><ins>+        return RealtimeIncomingVideoSource::create(WTFMove(videoTrack), fromStdString(rtcTrack->id()));
</ins><span class="cx">     }
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp   2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp      2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -106,14 +106,6 @@
</span><span class="cx"> 
</span><span class="cx"> #define RELEASE_LOG_IF_ALLOWED(fmt, ...) RELEASE_LOG_IF(document()->page() && document()->page()->isAlwaysOnLoggingAllowed(), Media, "%p - AudioContext::" fmt, this, ##__VA_ARGS__)
</span><span class="cx">     
</span><del>-#if !RELEASE_LOG_DISABLED
-static const void* nextLogIdentifier()
-{
-    static uint64_t logIdentifier = cryptographicallyRandomNumber();
-    return reinterpret_cast<const void*>(++logIdentifier);
-}
-#endif
-
</del><span class="cx"> bool AudioContext::isSampleRateRangeGood(float sampleRate)
</span><span class="cx"> {
</span><span class="cx">     // FIXME: It would be nice if the minimum sample-rate could be less than 44.1KHz,
</span><span class="lines">@@ -141,7 +133,7 @@
</span><span class="cx">     : ActiveDOMObject(document)
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><span class="cx">     , m_logger(document.logger())
</span><del>-    , m_logIdentifier(nextLogIdentifier())
</del><ins>+    , m_logIdentifier(uniqueLogIdentifier())
</ins><span class="cx"> #endif
</span><span class="cx">     , m_mediaSession(PlatformMediaSession::create(*this))
</span><span class="cx">     , m_eventQueue(std::make_unique<GenericEventQueue>(*this))
</span><span class="lines">@@ -159,7 +151,7 @@
</span><span class="cx">     : ActiveDOMObject(document)
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><span class="cx">     , m_logger(document.logger())
</span><del>-    , m_logIdentifier(nextLogIdentifier())
</del><ins>+    , m_logIdentifier(uniqueLogIdentifier())
</ins><span class="cx"> #endif
</span><span class="cx">     , m_isOfflineContext(true)
</span><span class="cx">     , m_mediaSession(PlatformMediaSession::create(*this))
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp   2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp      2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -416,14 +416,6 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if !RELEASE_LOG_DISABLED
-static uint64_t nextLogIdentifier()
-{
-    static uint64_t logIdentifier = cryptographicallyRandomNumber();
-    return ++logIdentifier;
-}
-#endif
-
</del><span class="cx"> HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& document, bool createdByParser)
</span><span class="cx">     : HTMLElement(tagName, document)
</span><span class="cx">     , ActiveDOMObject(document)
</span><span class="lines">@@ -474,7 +466,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><span class="cx">     , m_logger(&document.logger())
</span><del>-    , m_logIdentifier(nextLogIdentifier())
</del><ins>+    , m_logIdentifier(uniqueLogIdentifier())
</ins><span class="cx"> #endif
</span><span class="cx"> {
</span><span class="cx">     allMediaElements().add(this);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.h     2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h        2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -561,7 +561,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><span class="cx">     const Logger& logger() const final { return *m_logger.get(); }
</span><del>-    const void* logIdentifier() const final { return reinterpret_cast<const void*>(m_logIdentifier); }
</del><ins>+    const void* logIdentifier() const final { return m_logIdentifier; }
</ins><span class="cx">     WTFLogChannel& logChannel() const final;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -1176,7 +1176,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><span class="cx">     RefPtr<Logger> m_logger;
</span><del>-    uint64_t m_logIdentifier;
</del><ins>+    const void* m_logIdentifier;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(MEDIA_CONTROLS_SCRIPT)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioPlatformMediaSessioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp     2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp        2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -31,7 +31,6 @@
</span><span class="cx"> #include "Logging.h"
</span><span class="cx"> #include "MediaPlayer.h"
</span><span class="cx"> #include "PlatformMediaSessionManager.h"
</span><del>-#include <wtf/CryptographicallyRandomNumber.h>
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -38,12 +37,6 @@
</span><span class="cx"> static const Seconds clientDataBufferingTimerThrottleDelay { 100_ms };
</span><span class="cx"> 
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><del>-static uint64_t nextLogIdentifier()
-{
-    static uint64_t logIdentifier = cryptographicallyRandomNumber();
-    return ++logIdentifier;
-}
-
</del><span class="cx"> String convertEnumerationToString(PlatformMediaSession::State state)
</span><span class="cx"> {
</span><span class="cx">     static const NeverDestroyed<String> values[] = {
</span><span class="lines">@@ -126,7 +119,7 @@
</span><span class="cx">     , m_notifyingClient(false)
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><span class="cx">     , m_logger(client.hostingDocument()->logger())
</span><del>-    , m_logIdentifier(nextLogIdentifier())
</del><ins>+    , m_logIdentifier(uniqueLogIdentifier())
</ins><span class="cx"> #endif
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_client.mediaType() >= None && m_client.mediaType() <= MediaStreamCapturingAudio);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioPlatformMediaSessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSession.h (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/PlatformMediaSession.h       2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSession.h  2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -184,7 +184,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><span class="cx">     const Logger& logger() const final { return m_logger.get(); }
</span><del>-    const void* logIdentifier() const override { return reinterpret_cast<const void*>(m_logIdentifier); }
</del><ins>+    const void* logIdentifier() const override { return m_logIdentifier; }
</ins><span class="cx">     const char* logClassName() const override { return "PlatformMediaSession"; }
</span><span class="cx">     WTFLogChannel& logChannel() const final;
</span><span class="cx"> #endif
</span><span class="lines">@@ -204,7 +204,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><span class="cx">     Ref<const Logger> m_logger;
</span><del>-    uint64_t m_logIdentifier;
</del><ins>+    const void* m_logIdentifier;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     friend class PlatformMediaSessionManager;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsIntSizecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/IntSize.cpp (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/IntSize.cpp       2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/graphics/IntSize.cpp  2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #include "IntSize.h"
</span><span class="cx"> 
</span><span class="cx"> #include "FloatSize.h"
</span><ins>+#include <wtf/JSONValues.h>
</ins><span class="cx"> #include <wtf/text/TextStream.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -50,4 +51,19 @@
</span><span class="cx">     return ts << "width=" << size.width() << " height=" << size.height();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+Ref<JSON::Object> IntSize::toJSONObject() const
+{
+    auto object = JSON::Object::create();
+
+    object->setDouble("width"_s, m_width);
+    object->setDouble("height"_s, m_height);
+
+    return object;
</ins><span class="cx"> }
</span><ins>+
+String IntSize::toJSONString() const
+{
+    return toJSONObject()->toJSONString();
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsIntSizeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/IntSize.h (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/IntSize.h 2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/graphics/IntSize.h    2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><span class="cx"> #include <algorithm>
</span><ins>+#include <wtf/JSONValues.h>
</ins><span class="cx"> #include <wtf/Forward.h>
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC) && defined __OBJC__
</span><span class="lines">@@ -173,6 +174,9 @@
</span><span class="cx">     operator D2D1_SIZE_F() const;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    String toJSONString() const;
+    Ref<JSON::Object> toJSONObject() const;
+
</ins><span class="cx"> private:
</span><span class="cx">     int m_width, m_height;
</span><span class="cx"> };
</span><span class="lines">@@ -223,4 +227,14 @@
</span><span class="cx"> namespace WTF {
</span><span class="cx"> template<> struct DefaultHash<WebCore::IntSize>;
</span><span class="cx"> template<> struct HashTraits<WebCore::IntSize>;
</span><ins>+
+template<typename Type> struct LogArgument;
+template <>
+struct LogArgument<WebCore::IntSize> {
+    static String toString(const WebCore::IntSize& size)
+    {
+        return size.toJSONString();
+    }
+};
</ins><span class="cx"> }
</span><ins>+
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamMediaStreamPrivatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp 2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp    2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx">  * Copyright (C) 2011, 2015 Ericsson AB. All rights reserved.
</span><span class="cx">  * Copyright (C) 2013 Google Inc. All rights reserved.
</span><span class="cx">  * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
</span><del>- * Copyright (C) 2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions are
</span><span class="lines">@@ -136,6 +136,8 @@
</span><span class="cx">     if (m_trackSet.contains(track->id()))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG(LOGIDENTIFIER, track->logIdentifier());
+
</ins><span class="cx">     track->addObserver(*this);
</span><span class="cx">     m_trackSet.add(track->id(), track);
</span><span class="cx"> 
</span><span class="lines">@@ -154,6 +156,7 @@
</span><span class="cx">     if (!m_trackSet.remove(track.id()))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG(LOGIDENTIFIER, track.logIdentifier());
</ins><span class="cx">     track.removeObserver(*this);
</span><span class="cx"> 
</span><span class="cx">     if (notifyClientOption == NotifyClientOption::Notify) {
</span><span class="lines">@@ -168,6 +171,7 @@
</span><span class="cx"> 
</span><span class="cx"> void MediaStreamPrivate::startProducingData()
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG(LOGIDENTIFIER);
</ins><span class="cx">     for (auto& track : m_trackSet.values())
</span><span class="cx">         track->startProducingData();
</span><span class="cx"> }
</span><span class="lines">@@ -174,6 +178,7 @@
</span><span class="cx"> 
</span><span class="cx"> void MediaStreamPrivate::stopProducingData()
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG(LOGIDENTIFIER);
</ins><span class="cx">     for (auto& track : m_trackSet.values())
</span><span class="cx">         track->stopProducingData();
</span><span class="cx"> }
</span><span class="lines">@@ -189,6 +194,7 @@
</span><span class="cx"> 
</span><span class="cx"> void MediaStreamPrivate::setCaptureTracksMuted(bool muted)
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG(LOGIDENTIFIER, muted);
</ins><span class="cx">     for (auto& track : m_trackSet.values()) {
</span><span class="cx">         if (track->isCaptureTrack())
</span><span class="cx">             track->setMuted(muted);
</span><span class="lines">@@ -271,8 +277,13 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaStreamPrivate::trackMutedChanged(MediaStreamTrackPrivate&)
</del><ins>+void MediaStreamPrivate::trackMutedChanged(MediaStreamTrackPrivate& track)
</ins><span class="cx"> {
</span><ins>+#if RELEASE_LOG_DISABLED
+    UNUSED_PARAM(track);
+#endif
+
+    ALWAYS_LOG(LOGIDENTIFIER, track.logIdentifier(), " ", track.muted());
</ins><span class="cx">     scheduleDeferredTask([this] {
</span><span class="cx">         characteristicsChanged();
</span><span class="cx">     });
</span><span class="lines">@@ -283,8 +294,13 @@
</span><span class="cx">     characteristicsChanged();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaStreamPrivate::trackEnabledChanged(MediaStreamTrackPrivate&)
</del><ins>+void MediaStreamPrivate::trackEnabledChanged(MediaStreamTrackPrivate& track)
</ins><span class="cx"> {
</span><ins>+#if RELEASE_LOG_DISABLED
+    UNUSED_PARAM(track);
+#endif
+
+    ALWAYS_LOG(LOGIDENTIFIER, track.logIdentifier(), " ", track.enabled());
</ins><span class="cx">     updateActiveVideoTrack();
</span><span class="cx"> 
</span><span class="cx">     scheduleDeferredTask([this] {
</span><span class="lines">@@ -292,15 +308,25 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaStreamPrivate::trackStarted(MediaStreamTrackPrivate&)
</del><ins>+void MediaStreamPrivate::trackStarted(MediaStreamTrackPrivate& track)
</ins><span class="cx"> {
</span><ins>+#if RELEASE_LOG_DISABLED
+    UNUSED_PARAM(track);
+#endif
+
+    ALWAYS_LOG(LOGIDENTIFIER, track.logIdentifier());
</ins><span class="cx">     scheduleDeferredTask([this] {
</span><span class="cx">         characteristicsChanged();
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaStreamPrivate::trackEnded(MediaStreamTrackPrivate&)
</del><ins>+void MediaStreamPrivate::trackEnded(MediaStreamTrackPrivate& track)
</ins><span class="cx"> {
</span><ins>+#if RELEASE_LOG_DISABLED
+    UNUSED_PARAM(track);
+#endif
+
+    ALWAYS_LOG(LOGIDENTIFIER, track.logIdentifier());
</ins><span class="cx">     scheduleDeferredTask([this] {
</span><span class="cx">         updateActiveState(NotifyClientOption::Notify);
</span><span class="cx">         characteristicsChanged();
</span><span class="lines">@@ -326,6 +352,20 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if !RELEASE_LOG_DISABLED
+void MediaStreamPrivate::setLogger(const Logger& newLogger, const void* newLogIdentifier)
+{
+    m_logger = &newLogger;
+    m_logIdentifier = newLogIdentifier;
+    ALWAYS_LOG(LOGIDENTIFIER);
+}
+
+WTFLogChannel& MediaStreamPrivate::logChannel() const
+{
+    return LogWebRTC;
+}
+#endif
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(MEDIA_STREAM)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamMediaStreamPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.h (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.h   2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.h      2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx">  * Copyright (C) 2011, 2015 Ericsson AB. All rights reserved.
</span><span class="cx">  * Copyright (C) 2012 Google Inc. All rights reserved.
</span><span class="cx">  * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
</span><del>- * Copyright (C) 2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -41,6 +41,7 @@
</span><span class="cx"> #include "MediaStreamTrackPrivate.h"
</span><span class="cx"> #include <wtf/Function.h>
</span><span class="cx"> #include <wtf/HashMap.h>
</span><ins>+#include <wtf/LoggerHelper.h>
</ins><span class="cx"> #include <wtf/MediaTime.h>
</span><span class="cx"> #include <wtf/RefCounted.h>
</span><span class="cx"> #include <wtf/RefPtr.h>
</span><span class="lines">@@ -53,7 +54,14 @@
</span><span class="cx"> class MediaStream;
</span><span class="cx"> class OrientationNotifier;
</span><span class="cx"> 
</span><del>-class MediaStreamPrivate : public MediaStreamTrackPrivate::Observer, public RefCounted<MediaStreamPrivate>, public CanMakeWeakPtr<MediaStreamPrivate> {
</del><ins>+class MediaStreamPrivate final
+    : public MediaStreamTrackPrivate::Observer
+    , public RefCounted<MediaStreamPrivate>
+    , public CanMakeWeakPtr<MediaStreamPrivate>
+#if !RELEASE_LOG_DISABLED
+    , private LoggerHelper
+#endif
+{
</ins><span class="cx"> public:
</span><span class="cx">     class Observer {
</span><span class="cx">     public:
</span><span class="lines">@@ -103,6 +111,10 @@
</span><span class="cx"> 
</span><span class="cx">     void monitorOrientation(OrientationNotifier&);
</span><span class="cx"> 
</span><ins>+#if !RELEASE_LOG_DISABLED
+    void setLogger(const Logger&, const void*);
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     MediaStreamPrivate(const MediaStreamTrackPrivateVector&, String&&);
</span><span class="cx"> 
</span><span class="lines">@@ -119,6 +131,16 @@
</span><span class="cx">     void scheduleDeferredTask(Function<void ()>&&);
</span><span class="cx">     void forEachObserver(const WTF::Function<void(Observer&)>&) const;
</span><span class="cx"> 
</span><ins>+#if !RELEASE_LOG_DISABLED
+    const Logger& logger() const final { ASSERT(m_logger); return *m_logger.get(); }
+    const void* logIdentifier() const final { return m_logIdentifier; }
+    const char* logClassName() const final { return "MediaStreamPrivate"; }
+    WTFLogChannel& logChannel() const final;
+
+    RefPtr<const Logger> m_logger;
+    const void* m_logIdentifier;
+#endif
+
</ins><span class="cx">     HashSet<Observer*> m_observers;
</span><span class="cx">     String m_id;
</span><span class="cx">     MediaStreamTrackPrivate* m_activeVideoTrack { nullptr };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamMediaStreamTrackPrivatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp    2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp       2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,6 +1,7 @@
</span><span class="cx"> /*
</span><del>- *  Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
- *  Copyright (C) 2015 Ericsson AB. All rights reserved.
</del><ins>+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (C) 2015 Ericsson AB. All rights reserved.
+ * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -269,6 +270,8 @@
</span><span class="cx">     if (state == m_readyState)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG(LOGIDENTIFIER);
+
</ins><span class="cx">     m_readyState = state;
</span><span class="cx">     forEachObserver([this](auto& observer) {
</span><span class="cx">         observer.readyStateChanged(*this);
</span><span class="lines">@@ -275,6 +278,21 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if !RELEASE_LOG_DISABLED
+void MediaStreamTrackPrivate::setLogger(const Logger& newLogger, const void* newLogIdentifier)
+{
+    m_logger = &newLogger;
+    m_logIdentifier = newLogIdentifier;
+    ALWAYS_LOG(LOGIDENTIFIER);
+    m_source->setLogger(newLogger, newLogIdentifier);
+}
+
+WTFLogChannel& MediaStreamTrackPrivate::logChannel() const
+{
+    return LogWebRTC;
+}
+#endif
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(MEDIA_STREAM)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamMediaStreamTrackPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h      2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h 2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,6 +1,7 @@
</span><span class="cx"> /*
</span><del>- *  Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
- *  Copyright (C) 2015 Ericsson AB. All rights reserved.
</del><ins>+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (C) 2015 Ericsson AB. All rights reserved.
+ * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -29,6 +30,7 @@
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><span class="cx"> 
</span><span class="cx"> #include "RealtimeMediaSource.h"
</span><ins>+#include <wtf/LoggerHelper.h>
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -38,7 +40,13 @@
</span><span class="cx"> class RealtimeMediaSourceCapabilities;
</span><span class="cx"> class WebAudioSourceProvider;
</span><span class="cx"> 
</span><del>-class MediaStreamTrackPrivate : public RefCounted<MediaStreamTrackPrivate>, public RealtimeMediaSource::Observer {
</del><ins>+class MediaStreamTrackPrivate final
+    : public RefCounted<MediaStreamTrackPrivate>
+    , public RealtimeMediaSource::Observer
+#if !RELEASE_LOG_DISABLED
+    , private LoggerHelper
+#endif
+{
</ins><span class="cx"> public:
</span><span class="cx">     class Observer {
</span><span class="cx">     public:
</span><span class="lines">@@ -108,6 +116,12 @@
</span><span class="cx"> 
</span><span class="cx">     void setIdForTesting(String&& id) { m_id = WTFMove(id); }
</span><span class="cx"> 
</span><ins>+#if !RELEASE_LOG_DISABLED
+    void setLogger(const Logger&, const void*);
+    const Logger& logger() const final { ASSERT(m_logger); return *m_logger.get(); }
+    const void* logIdentifier() const final { return m_logIdentifier; }
+#endif
+    
</ins><span class="cx"> private:
</span><span class="cx">     MediaStreamTrackPrivate(Ref<RealtimeMediaSource>&&, String&& id);
</span><span class="cx"> 
</span><span class="lines">@@ -124,6 +138,14 @@
</span><span class="cx"> 
</span><span class="cx">     void forEachObserver(const WTF::Function<void(Observer&)>&) const;
</span><span class="cx"> 
</span><ins>+#if !RELEASE_LOG_DISABLED
+    const char* logClassName() const final { return "MediaStreamTrackPrivate"; }
+    WTFLogChannel& logChannel() const final;
+
+    RefPtr<const Logger> m_logger;
+    const void* m_logIdentifier;
+#endif
+
</ins><span class="cx">     mutable RecursiveLock m_observersLock;
</span><span class="cx">     HashSet<Observer*> m_observers;
</span><span class="cx">     Ref<RealtimeMediaSource> m_source;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamRealtimeIncomingAudioSourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.cpp (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.cpp        2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.cpp   2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2017 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2017-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -35,7 +35,6 @@
</span><span class="cx"> 
</span><span class="cx"> #include "LibWebRTCAudioFormat.h"
</span><span class="cx"> #include "Logging.h"
</span><del>-#include <wtf/CryptographicallyRandomNumber.h>
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -42,9 +41,6 @@
</span><span class="cx"> RealtimeIncomingAudioSource::RealtimeIncomingAudioSource(rtc::scoped_refptr<webrtc::AudioTrackInterface>&& audioTrack, String&& audioTrackId)
</span><span class="cx">     : RealtimeMediaSource(RealtimeMediaSource::Type::Audio, "remote audio"_s, WTFMove(audioTrackId))
</span><span class="cx">     , m_audioTrack(WTFMove(audioTrack))
</span><del>-#if !RELEASE_LOG_DISABLED
-    , m_logIdentifier(reinterpret_cast<const void*>(cryptographicallyRandomNumber()))
-#endif
</del><span class="cx"> {
</span><span class="cx">     notifyMutedChange(!m_audioTrack);
</span><span class="cx"> }
</span><span class="lines">@@ -89,20 +85,6 @@
</span><span class="cx">     return m_currentSettings;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if !RELEASE_LOG_DISABLED
-WTFLogChannel& RealtimeIncomingAudioSource::logChannel() const
-{
-    return LogWebRTC;
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-const Logger& RealtimeIncomingAudioSource::logger() const
-{
-    if (!m_logger)
-        m_logger = Logger::create(this);
-    return *m_logger;
-}
-#endif
-
-}
-
</del><span class="cx"> #endif // USE(LIBWEBRTC)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamRealtimeIncomingAudioSourceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.h (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.h  2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.h     2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2017 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2017-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -41,7 +41,6 @@
</span><span class="cx"> 
</span><span class="cx"> ALLOW_UNUSED_PARAMETERS_END
</span><span class="cx"> 
</span><del>-#include <wtf/LoggerHelper.h>
</del><span class="cx"> #include <wtf/RetainPtr.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -49,9 +48,6 @@
</span><span class="cx"> class RealtimeIncomingAudioSource
</span><span class="cx">     : public RealtimeMediaSource
</span><span class="cx">     , private webrtc::AudioTrackSinkInterface
</span><del>-#if !RELEASE_LOG_DISABLED
-    , private LoggerHelper
-#endif
</del><span class="cx"> {
</span><span class="cx"> public:
</span><span class="cx">     static Ref<RealtimeIncomingAudioSource> create(rtc::scoped_refptr<webrtc::AudioTrackInterface>&&, String&&);
</span><span class="lines">@@ -58,20 +54,12 @@
</span><span class="cx"> 
</span><span class="cx">     void setSourceTrack(rtc::scoped_refptr<webrtc::AudioTrackInterface>&&);
</span><span class="cx"> 
</span><del>-#if !RELEASE_LOG_DISABLED
-    void setLogger(Ref<const Logger>&& logger) { m_logger = WTFMove(logger); }
-#endif
-
</del><span class="cx"> protected:
</span><span class="cx">     RealtimeIncomingAudioSource(rtc::scoped_refptr<webrtc::AudioTrackInterface>&&, String&&);
</span><span class="cx">     ~RealtimeIncomingAudioSource();
</span><span class="cx"> 
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><del>-    // LoggerHelper API
-    const Logger& logger() const final;
-    const void* logIdentifier() const final { return m_logIdentifier; }
</del><span class="cx">     const char* logClassName() const final { return "RealtimeIncomingAudioSource"; }
</span><del>-    WTFLogChannel& logChannel() const final;
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamRealtimeIncomingVideoSourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp        2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp   2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2017 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2017-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -33,17 +33,11 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(LIBWEBRTC)
</span><span class="cx"> 
</span><del>-#include "Logging.h"
-#include <wtf/CryptographicallyRandomNumber.h>
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> RealtimeIncomingVideoSource::RealtimeIncomingVideoSource(rtc::scoped_refptr<webrtc::VideoTrackInterface>&& videoTrack, String&& videoTrackId)
</span><span class="cx">     : RealtimeMediaSource(Type::Video, "remote video"_s, WTFMove(videoTrackId))
</span><span class="cx">     , m_videoTrack(WTFMove(videoTrack))
</span><del>-#if !RELEASE_LOG_DISABLED
-    , m_logIdentifier(reinterpret_cast<const void*>(cryptographicallyRandomNumber()))
-#endif
</del><span class="cx"> {
</span><span class="cx">     notifyMutedChange(!m_videoTrack);
</span><span class="cx"> 
</span><span class="lines">@@ -108,20 +102,6 @@
</span><span class="cx">         m_currentSettings = WTF::nullopt;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if !RELEASE_LOG_DISABLED
-WTFLogChannel& RealtimeIncomingVideoSource::logChannel() const
-{
-    return LogWebRTC;
-}
-
-const Logger& RealtimeIncomingVideoSource::logger() const
-{
-    if (!m_logger)
-        m_logger = Logger::create(this);
-    return *m_logger;
-}
-#endif
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // USE(LIBWEBRTC)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamRealtimeIncomingVideoSourceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.h (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.h  2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.h     2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2017 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2017-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -41,7 +41,6 @@
</span><span class="cx"> 
</span><span class="cx"> ALLOW_UNUSED_PARAMETERS_END
</span><span class="cx"> 
</span><del>-#include <wtf/LoggerHelper.h>
</del><span class="cx"> #include <wtf/RetainPtr.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -51,9 +50,6 @@
</span><span class="cx"> class RealtimeIncomingVideoSource
</span><span class="cx">     : public RealtimeMediaSource
</span><span class="cx">     , private rtc::VideoSinkInterface<webrtc::VideoFrame>
</span><del>-#if !RELEASE_LOG_DISABLED
-    , private LoggerHelper
-#endif
</del><span class="cx"> {
</span><span class="cx"> public:
</span><span class="cx">     static Ref<RealtimeIncomingVideoSource> create(rtc::scoped_refptr<webrtc::VideoTrackInterface>&&, String&&);
</span><span class="lines">@@ -64,19 +60,11 @@
</span><span class="cx"> 
</span><span class="cx">     void setSourceTrack(rtc::scoped_refptr<webrtc::VideoTrackInterface>&&);
</span><span class="cx"> 
</span><del>-#if !RELEASE_LOG_DISABLED
-    void setLogger(Ref<const Logger>&& logger) { m_logger = WTFMove(logger); }
-#endif
-
</del><span class="cx"> protected:
</span><span class="cx">     RealtimeIncomingVideoSource(rtc::scoped_refptr<webrtc::VideoTrackInterface>&&, String&&);
</span><span class="cx"> 
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><del>-    // LoggerHelper API
-    const Logger& logger() const final;
-    const void* logIdentifier() const final { return m_logIdentifier; }
</del><span class="cx">     const char* logClassName() const final { return "RealtimeIncomingVideoSource"; }
</span><del>-    WTFLogChannel& logChannel() const final;
</del><span class="cx"> #endif
</span><span class="cx">     
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamRealtimeMediaSourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp        2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp   2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2012 Google Inc. All rights reserved.
</span><del>- * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
</span><span class="cx">  * Copyright (C) 2015 Ericsson AB. All rights reserved.
</span><span class="cx">  *
</span><span class="lines">@@ -56,8 +56,8 @@
</span><span class="cx"> {
</span><span class="cx">     if (m_persistentID.isEmpty())
</span><span class="cx">         m_persistentID = createCanonicalUUIDString();
</span><del>-    else
-        m_hashedID = RealtimeMediaSourceCenter::singleton().hashStringWithSalt(m_persistentID, m_idHashSalt);
</del><ins>+
+    m_hashedID = RealtimeMediaSourceCenter::singleton().hashStringWithSalt(m_persistentID, m_idHashSalt);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RealtimeMediaSource::addObserver(RealtimeMediaSource::Observer& observer)
</span><span class="lines">@@ -80,6 +80,8 @@
</span><span class="cx">     if (interrupted == m_interrupted)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER, interrupted, ", page muted : ", pageMuted);
+
</ins><span class="cx">     m_interrupted = interrupted;
</span><span class="cx">     if (!interrupted && pageMuted)
</span><span class="cx">         return;
</span><span class="lines">@@ -89,6 +91,8 @@
</span><span class="cx"> 
</span><span class="cx"> void RealtimeMediaSource::setMuted(bool muted)
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER);
+
</ins><span class="cx">     if (muted)
</span><span class="cx">         stop();
</span><span class="cx">     else {
</span><span class="lines">@@ -106,6 +110,7 @@
</span><span class="cx">     if (m_muted == muted)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER);
</ins><span class="cx">     m_muted = muted;
</span><span class="cx"> 
</span><span class="cx">     notifyMutedObservers();
</span><span class="lines">@@ -149,6 +154,8 @@
</span><span class="cx">         return;
</span><span class="cx">     m_pendingSettingsDidChangeNotification = true;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER, flags);
+
</ins><span class="cx">     scheduleDeferredTask([this] {
</span><span class="cx">         m_pendingSettingsDidChangeNotification = false;
</span><span class="cx">         forEachObserver([](auto& observer) {
</span><span class="lines">@@ -159,6 +166,20 @@
</span><span class="cx"> 
</span><span class="cx"> void RealtimeMediaSource::videoSampleAvailable(MediaSample& mediaSample)
</span><span class="cx"> {
</span><ins>+#if !RELEASE_LOG_DISABLED
+    ++m_frameCount;
+
+    auto timestamp = MonotonicTime::now();
+    auto delta = timestamp - m_lastFrameLogTime;
+    if (!m_lastFrameLogTime || delta >= 1_s) {
+        if (m_lastFrameLogTime) {
+            INFO_LOG_IF(loggerPtr(), LOGIDENTIFIER, m_frameCount, " frames sent in ", delta.value(), " seconds");
+            m_frameCount = 0;
+        }
+        m_lastFrameLogTime = timestamp;
+    }
+#endif
+
</ins><span class="cx">     forEachObserver([&](auto& observer) {
</span><span class="cx">         observer.videoSampleAvailable(mediaSample);
</span><span class="cx">     });
</span><span class="lines">@@ -176,6 +197,8 @@
</span><span class="cx">     if (m_isProducingData || m_isEnded)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER);
+
</ins><span class="cx">     m_isProducingData = true;
</span><span class="cx">     startProducingData();
</span><span class="cx"> 
</span><span class="lines">@@ -192,6 +215,8 @@
</span><span class="cx">     if (!m_isProducingData)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER);
+
</ins><span class="cx">     m_isProducingData = false;
</span><span class="cx">     stopProducingData();
</span><span class="cx"> }
</span><span class="lines">@@ -223,7 +248,7 @@
</span><span class="cx"> 
</span><span class="cx"> void RealtimeMediaSource::captureFailed()
</span><span class="cx"> {
</span><del>-    RELEASE_LOG_ERROR(MediaStream, "RealtimeMediaSource::captureFailed");
</del><ins>+    ERROR_LOG_IF(m_logger, LOGIDENTIFIER);
</ins><span class="cx"> 
</span><span class="cx">     m_isProducingData = false;
</span><span class="cx">     m_captureDidFailed = true;
</span><span class="lines">@@ -467,6 +492,8 @@
</span><span class="cx"> 
</span><span class="cx"> void RealtimeMediaSource::applyConstraint(const MediaConstraint& constraint)
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER, constraint.name());
+
</ins><span class="cx">     auto& capabilities = this->capabilities();
</span><span class="cx">     switch (constraint.constraintType()) {
</span><span class="cx">     case MediaConstraintType::Width:
</span><span class="lines">@@ -769,6 +796,8 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(constraints.isValid);
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER);
+
</ins><span class="cx">     FlattenedConstraint candidates;
</span><span class="cx">     if (!selectSettings(constraints, candidates, invalidConstraint))
</span><span class="cx">         return false;
</span><span class="lines">@@ -799,6 +828,8 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER, "fitness distance : ", m_fitnessScore);
+
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -855,6 +886,8 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(constraints.isValid);
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER);
+
</ins><span class="cx">     FlattenedConstraint candidates;
</span><span class="cx">     String failedConstraint;
</span><span class="cx">     if (!selectSettings(constraints, candidates, failedConstraint))
</span><span class="lines">@@ -874,6 +907,8 @@
</span><span class="cx">     if (size == m_size)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER, size);
+    
</ins><span class="cx">     m_size = size;
</span><span class="cx">     notifySettingsDidChangeObservers({ RealtimeMediaSourceSettings::Flag::Width, RealtimeMediaSourceSettings::Flag::Height });
</span><span class="cx"> }
</span><span class="lines">@@ -899,6 +934,8 @@
</span><span class="cx">     if (m_intrinsicSize == size)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER, size);
+    
</ins><span class="cx">     auto currentSize = this->size();
</span><span class="cx">     m_intrinsicSize = size;
</span><span class="cx"> 
</span><span class="lines">@@ -916,6 +953,8 @@
</span><span class="cx">     if (m_frameRate == rate)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER, rate);
+    
</ins><span class="cx">     m_frameRate = rate;
</span><span class="cx">     notifySettingsDidChangeObservers(RealtimeMediaSourceSettings::Flag::FrameRate);
</span><span class="cx"> }
</span><span class="lines">@@ -925,6 +964,8 @@
</span><span class="cx">     if (m_aspectRatio == ratio)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER, ratio);
+    
</ins><span class="cx">     m_aspectRatio = ratio;
</span><span class="cx">     m_size.setHeight(m_size.width() / ratio);
</span><span class="cx">     notifySettingsDidChangeObservers({ RealtimeMediaSourceSettings::Flag::AspectRatio, RealtimeMediaSourceSettings::Flag::Height });
</span><span class="lines">@@ -935,6 +976,8 @@
</span><span class="cx">     if (m_facingMode == mode)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER, mode);
+
</ins><span class="cx">     m_facingMode = mode;
</span><span class="cx">     notifySettingsDidChangeObservers(RealtimeMediaSourceSettings::Flag::FacingMode);
</span><span class="cx"> }
</span><span class="lines">@@ -944,6 +987,8 @@
</span><span class="cx">     if (m_volume == volume)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER, volume);
+
</ins><span class="cx">     m_volume = volume;
</span><span class="cx">     notifySettingsDidChangeObservers(RealtimeMediaSourceSettings::Flag::Volume);
</span><span class="cx"> }
</span><span class="lines">@@ -953,6 +998,8 @@
</span><span class="cx">     if (m_sampleRate == rate)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER, rate);
+
</ins><span class="cx">     m_sampleRate = rate;
</span><span class="cx">     notifySettingsDidChangeObservers(RealtimeMediaSourceSettings::Flag::SampleRate);
</span><span class="cx"> }
</span><span class="lines">@@ -967,6 +1014,8 @@
</span><span class="cx">     if (m_sampleSize == size)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER, size);
+
</ins><span class="cx">     m_sampleSize = size;
</span><span class="cx">     notifySettingsDidChangeObservers(RealtimeMediaSourceSettings::Flag::SampleSize);
</span><span class="cx"> }
</span><span class="lines">@@ -981,6 +1030,7 @@
</span><span class="cx">     if (m_echoCancellation == echoCancellation)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER, echoCancellation);
</ins><span class="cx">     m_echoCancellation = echoCancellation;
</span><span class="cx">     notifySettingsDidChangeObservers(RealtimeMediaSourceSettings::Flag::EchoCancellation);
</span><span class="cx"> }
</span><span class="lines">@@ -1011,6 +1061,34 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if !RELEASE_LOG_DISABLED
+void RealtimeMediaSource::setLogger(const Logger& newLogger, const void* newLogIdentifier)
+{
+    m_logger = &newLogger;
+    m_logIdentifier = newLogIdentifier;
+    ALWAYS_LOG(LOGIDENTIFIER, m_type, ", ", m_name, ", ", m_hashedID);
+}
+
+WTFLogChannel& RealtimeMediaSource::logChannel() const
+{
+    return LogWebRTC;
+}
+#endif
+
+String convertEnumerationToString(RealtimeMediaSource::Type enumerationValue)
+{
+    static const NeverDestroyed<String> values[] = {
+        MAKE_STATIC_STRING_IMPL("None"),
+        MAKE_STATIC_STRING_IMPL("Audio"),
+        MAKE_STATIC_STRING_IMPL("Video"),
+    };
+    static_assert(static_cast<size_t>(RealtimeMediaSource::Type::None) == 0, "RealtimeMediaSource::Type::None is not 0 as expected");
+    static_assert(static_cast<size_t>(RealtimeMediaSource::Type::Audio) == 1, "RealtimeMediaSource::Type::Audio is not 1 as expected");
+    static_assert(static_cast<size_t>(RealtimeMediaSource::Type::Video) == 2, "RealtimeMediaSource::Type::Video is not 2 as expected");
+    ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
+    return values[static_cast<size_t>(enumerationValue)];
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(MEDIA_STREAM)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamRealtimeMediaSourceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h  2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h     2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2011 Ericsson AB. All rights reserved.
</span><span class="cx">  * Copyright (C) 2012 Google Inc. All rights reserved.
</span><del>- * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
</span><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> #include "PlatformLayer.h"
</span><span class="cx"> #include "RealtimeMediaSourceCapabilities.h"
</span><span class="cx"> #include "RealtimeMediaSourceFactory.h"
</span><ins>+#include <wtf/LoggerHelper.h>
</ins><span class="cx"> #include <wtf/RecursiveLockAdapter.h>
</span><span class="cx"> #include <wtf/ThreadSafeRefCounted.h>
</span><span class="cx"> #include <wtf/Vector.h>
</span><span class="lines">@@ -65,7 +66,13 @@
</span><span class="cx"> 
</span><span class="cx"> struct CaptureSourceOrError;
</span><span class="cx"> 
</span><del>-class WEBCORE_EXPORT RealtimeMediaSource : public ThreadSafeRefCounted<RealtimeMediaSource>, public CanMakeWeakPtr<RealtimeMediaSource> {
</del><ins>+class WEBCORE_EXPORT RealtimeMediaSource
+    : public ThreadSafeRefCounted<RealtimeMediaSource>
+    , public CanMakeWeakPtr<RealtimeMediaSource>
+#if !RELEASE_LOG_DISABLED
+    , private LoggerHelper
+#endif
+{
</ins><span class="cx"> public:
</span><span class="cx">     class Observer {
</span><span class="cx">     public:
</span><span class="lines">@@ -176,6 +183,15 @@
</span><span class="cx">     void setIsRemote(bool isRemote) { m_isRemote = isRemote; }
</span><span class="cx">     bool isRemote() const { return m_isRemote; }
</span><span class="cx"> 
</span><ins>+#if !RELEASE_LOG_DISABLED
+    void setLogger(const Logger&, const void*);
+    const Logger* loggerPtr() const { return m_logger.get(); }
+    const Logger& logger() const final { ASSERT(m_logger); return *m_logger.get(); }
+    const void* logIdentifier() const final { return m_logIdentifier; }
+    const char* logClassName() const override { return "RealtimeMediaSource"; }
+    WTFLogChannel& logChannel() const final;
+#endif
+
</ins><span class="cx">     // Testing only
</span><span class="cx">     virtual void delaySamples(Seconds) { };
</span><span class="cx">     void setInterruptedForTesting(bool);
</span><span class="lines">@@ -217,7 +233,12 @@
</span><span class="cx"> 
</span><span class="cx">     void forEachObserver(const WTF::Function<void(Observer&)>&) const;
</span><span class="cx"> 
</span><del>-    bool m_muted { false };
</del><ins>+#if !RELEASE_LOG_DISABLED
+    RefPtr<const Logger> m_logger;
+    const void* m_logIdentifier;
+    MonotonicTime m_lastFrameLogTime;
+    unsigned m_frameCount { 0 };
+#endif
</ins><span class="cx"> 
</span><span class="cx">     String m_idHashSalt;
</span><span class="cx">     String m_hashedID;
</span><span class="lines">@@ -236,6 +257,7 @@
</span><span class="cx">     double m_fitnessScore { 0 };
</span><span class="cx">     RealtimeMediaSourceSettings::VideoFacingMode m_facingMode { RealtimeMediaSourceSettings::User};
</span><span class="cx"> 
</span><ins>+    bool m_muted { false };
</ins><span class="cx">     bool m_pendingSettingsDidChangeNotification { false };
</span><span class="cx">     bool m_echoCancellation { false };
</span><span class="cx">     bool m_isProducingData { false };
</span><span class="lines">@@ -257,6 +279,23 @@
</span><span class="cx">     String errorMessage;
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+String convertEnumerationToString(RealtimeMediaSource::Type);
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><ins>+namespace WTF {
+
+template<typename Type>
+struct LogArgument;
+
+template <>
+struct LogArgument<WebCore::RealtimeMediaSource::Type> {
+    static String toString(const WebCore::RealtimeMediaSource::Type type)
+    {
+        return convertEnumerationToString(type);
+    }
+};
+
+}; // namespace WTF
+
</ins><span class="cx"> #endif // ENABLE(MEDIA_STREAM)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamRealtimeMediaSourceSettingscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceSettings.cpp (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceSettings.cpp        2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceSettings.cpp   2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -69,6 +69,65 @@
</span><span class="cx">     return RealtimeMediaSourceSettings::Unknown;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+String RealtimeMediaSourceSettings::convertFlagsToString(const OptionSet<RealtimeMediaSourceSettings::Flag> flags)
+{
+    StringBuilder builder;
+
+    builder.append("[ ");
+    for (auto flag : flags) {
+        if (!builder.isEmpty())
+            builder.append(", ");
+
+        switch (flag) {
+        case RealtimeMediaSourceSettings::Width:
+            builder.append("Width");
+            break;
+        case RealtimeMediaSourceSettings::Height:
+            builder.append("Height");
+            break;
+        case RealtimeMediaSourceSettings::AspectRatio:
+            builder.append("AspectRatio");
+            break;
+        case RealtimeMediaSourceSettings::FrameRate:
+            builder.append("FrameRate");
+            break;
+        case RealtimeMediaSourceSettings::FacingMode:
+            builder.append("FacingMode");
+            break;
+        case RealtimeMediaSourceSettings::Volume:
+            builder.append("Volume");
+            break;
+        case RealtimeMediaSourceSettings::SampleRate:
+            builder.append("SampleRate");
+            break;
+        case RealtimeMediaSourceSettings::SampleSize:
+            builder.append("SampleSize");
+            break;
+        case RealtimeMediaSourceSettings::EchoCancellation:
+            builder.append("EchoCancellation");
+            break;
+        case RealtimeMediaSourceSettings::DeviceId:
+            builder.append("DeviceId");
+            break;
+        case RealtimeMediaSourceSettings::GroupId:
+            builder.append("GroupId");
+            break;
+        case RealtimeMediaSourceSettings::Label:
+            builder.append("Label");
+            break;
+        case RealtimeMediaSourceSettings::DisplaySurface:
+            builder.append("DisplaySurface");
+            break;
+        case RealtimeMediaSourceSettings::LogicalSurface:
+            builder.append("LogicalSurface");
+            break;
+        }
+    }
+    builder.append(" ]");
+
+    return builder.toString();
+}
+
</ins><span class="cx"> OptionSet<RealtimeMediaSourceSettings::Flag> RealtimeMediaSourceSettings::difference(const RealtimeMediaSourceSettings& that) const
</span><span class="cx"> {
</span><span class="cx">     OptionSet<RealtimeMediaSourceSettings::Flag> difference;
</span><span class="lines">@@ -105,6 +164,23 @@
</span><span class="cx">     return difference;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+String convertEnumerationToString(RealtimeMediaSourceSettings::VideoFacingMode enumerationValue)
+{
+    static const NeverDestroyed<String> values[] = {
+        MAKE_STATIC_STRING_IMPL("Unknown"),
+        MAKE_STATIC_STRING_IMPL("User"),
+        MAKE_STATIC_STRING_IMPL("Environment"),
+        MAKE_STATIC_STRING_IMPL("Left"),
+        MAKE_STATIC_STRING_IMPL("Right"),
+    };
+    static_assert(static_cast<size_t>(RealtimeMediaSourceSettings::VideoFacingMode::Unknown) == 0, "RealtimeMediaSourceSettings::VideoFacingMode::Unknown is not 0 as expected");
+    static_assert(static_cast<size_t>(RealtimeMediaSourceSettings::VideoFacingMode::User) == 1, "RealtimeMediaSourceSettings::VideoFacingMode::User is not 1 as expected");
+    static_assert(static_cast<size_t>(RealtimeMediaSourceSettings::VideoFacingMode::Environment) == 2, "RealtimeMediaSourceSettings::VideoFacingMode::Environment is not 2 as expected");
+    static_assert(static_cast<size_t>(RealtimeMediaSourceSettings::VideoFacingMode::Left) == 3, "RealtimeMediaSourceSettings::VideoFacingMode::Left is not 3 as expected");
+    static_assert(static_cast<size_t>(RealtimeMediaSourceSettings::VideoFacingMode::Right) == 4, "RealtimeMediaSourceSettings::VideoFacingMode::Right is not 4 as expected");
+    ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
+    return values[static_cast<size_t>(enumerationValue)];
+}
</ins><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamRealtimeMediaSourceSettingsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceSettings.h (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceSettings.h  2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceSettings.h     2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -134,6 +134,8 @@
</span><span class="cx">     template<class Encoder> void encode(Encoder&) const;
</span><span class="cx">     template<class Decoder> static bool decode(Decoder&, RealtimeMediaSourceSettings&);
</span><span class="cx"> 
</span><ins>+    static String convertFlagsToString(const OptionSet<RealtimeMediaSourceSettings::Flag>);
+
</ins><span class="cx"> private:
</span><span class="cx">     uint32_t m_width { 0 };
</span><span class="cx">     uint32_t m_height { 0 };
</span><span class="lines">@@ -191,6 +193,8 @@
</span><span class="cx">         && decoder.decodeEnum(settings.m_facingMode);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+String convertEnumerationToString(RealtimeMediaSourceSettings::VideoFacingMode);
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span><span class="lines">@@ -206,6 +210,25 @@
</span><span class="cx">     >;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-}
</del><ins>+template<typename Type>
+struct LogArgument;
</ins><span class="cx"> 
</span><ins>+template <>
+struct LogArgument<WebCore::RealtimeMediaSourceSettings::VideoFacingMode> {
+    static String toString(const WebCore::RealtimeMediaSourceSettings::VideoFacingMode mode)
+    {
+        return convertEnumerationToString(mode);
+    }
+};
+
+template <>
+struct LogArgument<OptionSet<WebCore::RealtimeMediaSourceSettings::Flag>> {
+    static String toString(const OptionSet<WebCore::RealtimeMediaSourceSettings::Flag> flags)
+    {
+        return WebCore::RealtimeMediaSourceSettings::convertFlagsToString(flags);
+    }
+};
+
+}; // namespace WTF
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamRealtimeOutgoingAudioSourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.cpp (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.cpp        2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.cpp   2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2017 Apple Inc.
</del><ins>+ * Copyright (C) 2017-2019 Apple Inc.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted, provided that the following conditions
</span><span class="lines">@@ -41,7 +41,8 @@
</span><span class="cx"> RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource(Ref<MediaStreamTrackPrivate>&& source)
</span><span class="cx">     : m_audioSource(WTFMove(source))
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><del>-    , m_logIdentifier(reinterpret_cast<const void*>(cryptographicallyRandomNumber()))
</del><ins>+    , m_logger(m_audioSource->logger())
+    , m_logIdentifier(m_audioSource->logIdentifier())
</ins><span class="cx"> #endif
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -134,14 +135,6 @@
</span><span class="cx"> {
</span><span class="cx">     return LogWebRTC;
</span><span class="cx"> }
</span><del>-
-const Logger& RealtimeOutgoingAudioSource::logger() const
-{
-    if (!m_logger)
-        m_logger = Logger::create(this);
-    return *m_logger;
-}
-
</del><span class="cx"> #endif
</span><span class="cx">     
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamRealtimeOutgoingAudioSourceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.h (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.h  2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.h     2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2017 Apple Inc.
</del><ins>+ * Copyright (C) 2017-2019 Apple Inc.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted, provided that the following conditions
</span><span class="lines">@@ -69,10 +69,6 @@
</span><span class="cx">     bool setSource(Ref<MediaStreamTrackPrivate>&&);
</span><span class="cx">     MediaStreamTrackPrivate& source() const { return m_audioSource.get(); }
</span><span class="cx"> 
</span><del>-#if !RELEASE_LOG_DISABLED
-    void setLogger(Ref<const Logger>&& logger) { m_logger = WTFMove(logger); }
-#endif
-
</del><span class="cx"> protected:
</span><span class="cx">     explicit RealtimeOutgoingAudioSource(Ref<MediaStreamTrackPrivate>&&);
</span><span class="cx"> 
</span><span class="lines">@@ -86,7 +82,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><span class="cx">     // LoggerHelper API
</span><del>-    const Logger& logger() const final;
</del><ins>+    const Logger& logger() const final { return m_logger.get(); }
</ins><span class="cx">     const void* logIdentifier() const final { return m_logIdentifier; }
</span><span class="cx">     const char* logClassName() const final { return "RealtimeOutgoingAudioSource"; }
</span><span class="cx">     WTFLogChannel& logChannel() const final;
</span><span class="lines">@@ -137,7 +133,7 @@
</span><span class="cx">     HashSet<webrtc::AudioTrackSinkInterface*> m_sinks;
</span><span class="cx"> 
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><del>-    mutable RefPtr<const Logger> m_logger;
</del><ins>+    mutable Ref<const Logger> m_logger;
</ins><span class="cx">     const void* m_logIdentifier;
</span><span class="cx">     size_t m_chunksSent { 0 };
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamRealtimeOutgoingVideoSourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.cpp (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.cpp        2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.cpp   2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2017 Apple Inc.
</del><ins>+ * Copyright (C) 2017-2019 Apple Inc.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted, provided that the following conditions
</span><span class="lines">@@ -40,7 +40,6 @@
</span><span class="cx"> 
</span><span class="cx"> ALLOW_UNUSED_PARAMETERS_END
</span><span class="cx"> 
</span><del>-#include <wtf/CryptographicallyRandomNumber.h>
</del><span class="cx"> #include <wtf/MainThread.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -49,7 +48,8 @@
</span><span class="cx">     : m_videoSource(WTFMove(videoSource))
</span><span class="cx">     , m_blackFrameTimer(*this, &RealtimeOutgoingVideoSource::sendOneBlackFrame)
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><del>-    , m_logIdentifier(reinterpret_cast<const void*>(cryptographicallyRandomNumber()))
</del><ins>+    , m_logger(m_videoSource->logger())
+    , m_logIdentifier(m_videoSource->logIdentifier())
</ins><span class="cx"> #endif
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -200,7 +200,7 @@
</span><span class="cx"> 
</span><span class="cx"> void RealtimeOutgoingVideoSource::sendOneBlackFrame()
</span><span class="cx"> {
</span><del>-    ALWAYS_LOG(LOGIDENTIFIER, "test");
</del><ins>+    ALWAYS_LOG(LOGIDENTIFIER);
</ins><span class="cx">     sendFrame(rtc::scoped_refptr<webrtc::VideoFrameBuffer>(m_blackFrame));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -209,6 +209,19 @@
</span><span class="cx">     MonotonicTime timestamp = MonotonicTime::now();
</span><span class="cx">     webrtc::VideoFrame frame(buffer, m_shouldApplyRotation ? webrtc::kVideoRotation_0 : m_currentRotation, static_cast<int64_t>(timestamp.secondsSinceEpoch().microseconds()));
</span><span class="cx"> 
</span><ins>+#if !RELEASE_LOG_DISABLED
+    ++m_frameCount;
+
+    auto delta = timestamp - m_lastFrameLogTime;
+    if (!m_lastFrameLogTime || delta >= 1_s) {
+        if (m_lastFrameLogTime) {
+            INFO_LOG(LOGIDENTIFIER, m_frameCount, " frames sent in ", delta.value(), " seconds");
+            m_frameCount = 0;
+        }
+        m_lastFrameLogTime = timestamp;
+    }
+#endif
+
</ins><span class="cx">     auto locker = holdLock(m_sinksLock);
</span><span class="cx">     for (auto* sink : m_sinks)
</span><span class="cx">         sink->OnFrame(frame);
</span><span class="lines">@@ -219,13 +232,6 @@
</span><span class="cx"> {
</span><span class="cx">     return LogWebRTC;
</span><span class="cx"> }
</span><del>-
-const Logger& RealtimeOutgoingVideoSource::logger() const
-{
-    if (!m_logger)
-        m_logger = Logger::create(this);
-    return *m_logger;
-}
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamRealtimeOutgoingVideoSourceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h  2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h     2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2017 Apple Inc.
</del><ins>+ * Copyright (C) 2017-2019 Apple Inc.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted, provided that the following conditions
</span><span class="lines">@@ -72,10 +72,6 @@
</span><span class="cx"> 
</span><span class="cx">     void setApplyRotation(bool shouldApplyRotation) { m_shouldApplyRotation = shouldApplyRotation; }
</span><span class="cx"> 
</span><del>-#if !RELEASE_LOG_DISABLED
-    void setLogger(Ref<const Logger>&& logger) { m_logger = WTFMove(logger); }
-#endif
-
</del><span class="cx"> protected:
</span><span class="cx">     explicit RealtimeOutgoingVideoSource(Ref<MediaStreamTrackPrivate>&&);
</span><span class="cx"> 
</span><span class="lines">@@ -89,7 +85,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><span class="cx">     // LoggerHelper API
</span><del>-    const Logger& logger() const final;
</del><ins>+    const Logger& logger() const final { return m_logger.get(); }
</ins><span class="cx">     const void* logIdentifier() const final { return m_logIdentifier; }
</span><span class="cx">     const char* logClassName() const final { return "RealtimeOutgoingVideoSource"; }
</span><span class="cx">     WTFLogChannel& logChannel() const final;
</span><span class="lines">@@ -145,8 +141,10 @@
</span><span class="cx">     uint32_t m_height { 0 };
</span><span class="cx"> 
</span><span class="cx"> #if !RELEASE_LOG_DISABLED
</span><del>-    mutable RefPtr<const Logger> m_logger;
</del><ins>+    Ref<const Logger> m_logger;
</ins><span class="cx">     const void* m_logIdentifier;
</span><ins>+    MonotonicTime m_lastFrameLogTime;
+    unsigned m_frameCount { 0 };
</ins><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamRealtimeVideoSourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp        2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp   2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2018 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include "RealtimeMediaSourceCenter.h"
</span><span class="cx"> #include "RealtimeMediaSourceSettings.h"
</span><span class="cx"> #include "RemoteVideoSample.h"
</span><ins>+#include <wtf/JSONValues.h>
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx"> #include "ImageTransferSessionVT.h"
</span><span class="lines">@@ -352,7 +353,7 @@
</span><span class="cx"> 
</span><span class="cx"> void RealtimeVideoSource::setSizeAndFrameRate(Optional<int> width, Optional<int> height, Optional<double> frameRate)
</span><span class="cx"> {
</span><del>-    Optional<RealtimeVideoSource::CaptureSizeAndFrameRate> match;
</del><ins>+    ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, SizeAndFrameRate { width, height, frameRate });
</ins><span class="cx"> 
</span><span class="cx">     auto size = this->size();
</span><span class="cx">     if (!width && !height && !size.isEmpty()) {
</span><span class="lines">@@ -360,7 +361,7 @@
</span><span class="cx">         height = size.height();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    match = bestSupportedSizeAndFrameRate(width, height, frameRate);
</del><ins>+    Optional<RealtimeVideoSource::CaptureSizeAndFrameRate> match = bestSupportedSizeAndFrameRate(width, height, frameRate);
</ins><span class="cx">     ASSERT(match);
</span><span class="cx">     if (!match)
</span><span class="cx">         return;
</span><span class="lines">@@ -411,6 +412,24 @@
</span><span class="cx">     videoSampleAvailable(mediaSample.releaseNonNull());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if !RELEASE_LOG_DISABLED
+Ref<JSON::Object> SizeAndFrameRate::toJSONObject() const
+{
+    auto object = JSON::Object::create();
+
+    object->setDouble("width"_s, width ? width.value() : 0);
+    object->setDouble("height"_s, height ? height.value() : 0);
+    object->setDouble("frameRate"_s, frameRate ? frameRate.value() : 0);
+
+    return object;
+}
+
+String SizeAndFrameRate::toJSONString() const
+{
+    return toJSONObject()->toJSONString();
+}
+#endif
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(MEDIA_STREAM)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamRealtimeVideoSourceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.h (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.h  2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.h     2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2018 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -81,6 +81,10 @@
</span><span class="cx">     Optional<CaptureSizeAndFrameRate> bestSupportedSizeAndFrameRate(Optional<int> width, Optional<int> height, Optional<double>);
</span><span class="cx">     bool presetSupportsFrameRate(RefPtr<VideoPreset>, double);
</span><span class="cx"> 
</span><ins>+#if !RELEASE_LOG_DISABLED
+    const char* logClassName() const override { return "RealtimeVideoSource"; }
+#endif
+
</ins><span class="cx">     Vector<Ref<VideoPreset>> m_presets;
</span><span class="cx">     Deque<double> m_observedFrameTimeStamps;
</span><span class="cx">     double m_observedFrameRate { 0 };
</span><span class="lines">@@ -90,7 +94,27 @@
</span><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+struct SizeAndFrameRate {
+    Optional<int> width;
+    Optional<int> height;
+    Optional<double> frameRate;
+
+    String toJSONString() const;
+    Ref<JSON::Object> toJSONObject() const;
+};
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><ins>+namespace WTF {
+template<typename Type> struct LogArgument;
+template <>
+struct LogArgument<WebCore::SizeAndFrameRate> {
+    static String toString(const WebCore::SizeAndFrameRate& size)
+    {
+        return size.toJSONString();
+    }
+};
+}; // namespace WTF
+
</ins><span class="cx"> #endif // ENABLE(MEDIA_STREAM)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamlibwebrtcLibWebRTCProvidercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp        2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp   2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -122,10 +122,15 @@
</span><span class="cx"> 
</span><span class="cx"> static void doReleaseLogging(rtc::LoggingSeverity severity, const char* message)
</span><span class="cx"> {
</span><ins>+#if RELEASE_LOG_DISABLED
+    UNUSED_PARAM(severity);
+    UNUSED_PARAM(message);
+#else
</ins><span class="cx">     if (severity == rtc::LS_ERROR)
</span><span class="cx">         RELEASE_LOG_ERROR(WebRTC, "LibWebRTC error: %{public}s", message);
</span><span class="cx">     else
</span><span class="cx">         RELEASE_LOG(WebRTC, "LibWebRTC message: %{public}s", message);
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void setLogging(rtc::LoggingSeverity level)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreammacAVVideoCaptureSourceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h     2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h        2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -73,7 +73,6 @@
</span><span class="cx">     AVVideoCaptureSource(AVCaptureDevice*, String&& id, String&& hashSalt);
</span><span class="cx">     virtual ~AVVideoCaptureSource();
</span><span class="cx"> 
</span><del>-    void initializeSession();
</del><span class="cx">     void clearSession();
</span><span class="cx"> 
</span><span class="cx">     bool setupSession();
</span><span class="lines">@@ -111,6 +110,10 @@
</span><span class="cx"> 
</span><span class="cx">     AVCaptureDevice* device() const { return m_device.get(); }
</span><span class="cx"> 
</span><ins>+#if !RELEASE_LOG_DISABLED
+    const char* logClassName() const override { return "AVVideoCaptureSource"; }
+#endif
+
</ins><span class="cx">     RefPtr<MediaSample> m_buffer;
</span><span class="cx">     RetainPtr<AVCaptureVideoDataOutput> m_videoOutput;
</span><span class="cx">     std::unique_ptr<ImageTransferSessionVT> m_imageTransferSession;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreammacAVVideoCaptureSourcemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm    2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm       2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -202,15 +202,9 @@
</span><span class="cx">     clearSession();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void AVVideoCaptureSource::initializeSession()
-{
-    ASSERT(!m_session);
-    m_session = adoptNS([allocAVCaptureSessionInstance() init]);
-    [m_session addObserver:m_objcObserver.get() forKeyPath:@"running" options:NSKeyValueObservingOptionNew context:(void *)nil];
-}
-
</del><span class="cx"> void AVVideoCaptureSource::clearSession()
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER);
</ins><span class="cx">     ASSERT(m_session);
</span><span class="cx">     [m_session removeObserver:m_objcObserver.get() forKeyPath:@"running"];
</span><span class="cx">     m_session = nullptr;
</span><span class="lines">@@ -226,6 +220,7 @@
</span><span class="cx">     if ([m_session isRunning])
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER);
</ins><span class="cx">     [m_objcObserver addNotificationObservers];
</span><span class="cx">     [m_session startRunning];
</span><span class="cx"> }
</span><span class="lines">@@ -235,6 +230,7 @@
</span><span class="cx">     if (!m_session)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER);
</ins><span class="cx">     [m_objcObserver removeNotificationObservers];
</span><span class="cx"> 
</span><span class="cx">     if ([m_session isRunning])
</span><span class="lines">@@ -335,6 +331,8 @@
</span><span class="cx"> 
</span><span class="cx"> void AVVideoCaptureSource::setSizeAndFrameRateWithPreset(IntSize requestedSize, double requestedFrameRate, RefPtr<VideoPreset> preset)
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, SizeAndFrameRate { requestedSize.width(), requestedSize.height(), requestedFrameRate });
+
</ins><span class="cx">     auto* avPreset = preset ? downcast<AVVideoPreset>(preset.get()) : nullptr;
</span><span class="cx"> 
</span><span class="cx">     if (!m_session) {
</span><span class="lines">@@ -363,6 +361,12 @@
</span><span class="cx">         if ([device() lockForConfiguration:&error]) {
</span><span class="cx">             if (!m_currentPreset || ![m_currentPreset->format.get() isEqual:avPreset->format.get()]) {
</span><span class="cx">                 [device() setActiveFormat:avPreset->format.get()];
</span><ins>+
+                frameRateRange = frameDurationForFrameRate(requestedFrameRate);
+                ASSERT(frameRateRange);
+                if (!frameRateRange)
+                    return;
+
</ins><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">                 auto settingsDictionary = @{
</span><span class="cx">                     (__bridge NSString *)kCVPixelBufferPixelFormatTypeKey: @(avVideoCapturePixelBufferFormat()),
</span><span class="lines">@@ -373,19 +377,21 @@
</span><span class="cx">                 [m_videoOutput setVideoSettings:settingsDictionary];
</span><span class="cx"> #endif
</span><span class="cx">             }
</span><ins>+
+            ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, "setting frame rate ", CMTimeGetSeconds([frameRateRange minFrameDuration]), " .. ", CMTimeGetSeconds([frameRateRange maxFrameDuration]));
</ins><span class="cx">             [device() setActiveVideoMinFrameDuration:[frameRateRange minFrameDuration]];
</span><span class="cx">             [device() setActiveVideoMaxFrameDuration:[frameRateRange maxFrameDuration]];
</span><span class="cx">             [device() unlockForConfiguration];
</span><span class="cx">         }
</span><span class="cx">     } @catch(NSException *exception) {
</span><del>-        RELEASE_LOG(Media, "AVVideoCaptureSource::setFrameRate - exception thrown configuring device: <%s> %s", [[exception name] UTF8String], [[exception reason] UTF8String]);
</del><ins>+        ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "error configuring device ", [[exception name] UTF8String], ", reason : ", [[exception reason] UTF8String]);
+        return;
</ins><span class="cx">     }
</span><span class="cx">     [m_session commitConfiguration];
</span><span class="cx"> 
</span><span class="cx">     m_currentPreset = avPreset;
</span><span class="cx"> 
</span><del>-    if (error)
-        RELEASE_LOG(Media, "AVVideoCaptureSource::setFrameRate - failed to lock video device for configuration: %s", [[error localizedDescription] UTF8String]);
</del><ins>+    ERROR_LOG_IF(error && loggerPtr(), LOGIDENTIFIER, [[error localizedDescription] UTF8String]);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static inline int sensorOrientation(AVCaptureVideoOrientation videoOrientation)
</span><span class="lines">@@ -426,8 +432,11 @@
</span><span class="cx">     if (m_session)
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    initializeSession();
</del><ins>+    ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER);
</ins><span class="cx"> 
</span><ins>+    m_session = adoptNS([allocAVCaptureSessionInstance() init]);
+    [m_session addObserver:m_objcObserver.get() forKeyPath:@"running" options:NSKeyValueObservingOptionNew context:(void *)nil];
+
</ins><span class="cx">     [m_session beginConfiguration];
</span><span class="cx">     bool success = setupCaptureSession();
</span><span class="cx">     [m_session commitConfiguration];
</span><span class="lines">@@ -449,7 +458,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!bestFrameRateRange)
</span><del>-        RELEASE_LOG(Media, "AVVideoCaptureSource::frameDurationForFrameRate, no frame rate range for rate %g", rate);
</del><ins>+        ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "no frame rate range for rate ", rate);
</ins><span class="cx"> 
</span><span class="cx">     return bestFrameRateRange;
</span><span class="cx"> }
</span><span class="lines">@@ -456,6 +465,8 @@
</span><span class="cx"> 
</span><span class="cx"> bool AVVideoCaptureSource::setupCaptureSession()
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER);
+
</ins><span class="cx"> #if PLATFORM(IOS_FAMILY)
</span><span class="cx">     RealtimeMediaSourceCenter::singleton().videoCaptureFactory().setActiveSource(*this);
</span><span class="cx"> #endif
</span><span class="lines">@@ -463,12 +474,12 @@
</span><span class="cx">     NSError *error = nil;
</span><span class="cx">     RetainPtr<AVCaptureDeviceInputType> videoIn = adoptNS([allocAVCaptureDeviceInputInstance() initWithDevice:device() error:&error]);
</span><span class="cx">     if (error) {
</span><del>-        RELEASE_LOG(Media, "AVVideoCaptureSource::setupCaptureSession(%p), failed to allocate AVCaptureDeviceInput: %s", this, [[error localizedDescription] UTF8String]);
</del><ins>+        ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "failed to allocate AVCaptureDeviceInput ", [[error localizedDescription] UTF8String]);
</ins><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (![session() canAddInput:videoIn.get()]) {
</span><del>-        RELEASE_LOG(Media, "AVVideoCaptureSource::setupCaptureSession(%p), unable to add video input device", this);
</del><ins>+        ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "unable to add video input device");
</ins><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx">     [session() addInput:videoIn.get()];
</span><span class="lines">@@ -481,7 +492,7 @@
</span><span class="cx">     [m_videoOutput setSampleBufferDelegate:m_objcObserver.get() queue:globaVideoCaptureSerialQueue()];
</span><span class="cx"> 
</span><span class="cx">     if (![session() canAddOutput:m_videoOutput.get()]) {
</span><del>-        RELEASE_LOG(Media, "AVVideoCaptureSource::setupCaptureSession(%p), unable to add video sample buffer output delegate", this);
</del><ins>+        ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "unable to add video output device");
</ins><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx">     [session() addOutput:m_videoOutput.get()];
</span><span class="lines">@@ -571,6 +582,7 @@
</span><span class="cx"> void AVVideoCaptureSource::captureSessionIsRunningDidChange(bool state)
</span><span class="cx"> {
</span><span class="cx">     scheduleDeferredTask([this, state] {
</span><ins>+        ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, state);
</ins><span class="cx">         if ((state == m_isRunning) && (state == !muted()))
</span><span class="cx">             return;
</span><span class="cx"> 
</span><span class="lines">@@ -587,6 +599,7 @@
</span><span class="cx"> #if !PLATFORM(IOS_FAMILY)
</span><span class="cx">     scheduleDeferredTask([this] {
</span><span class="cx">         auto isSuspended = [m_device isSuspended];
</span><ins>+        ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, !!isSuspended);
</ins><span class="cx">         if (isSuspended == muted())
</span><span class="cx">             return;
</span><span class="cx"> 
</span><span class="lines">@@ -629,6 +642,8 @@
</span><span class="cx"> #if PLATFORM(IOS_FAMILY)
</span><span class="cx"> void AVVideoCaptureSource::captureSessionRuntimeError(RetainPtr<NSError> error)
</span><span class="cx"> {
</span><ins>+    ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, [[error localizedDescription] UTF8String]);
+
</ins><span class="cx">     if (!m_isRunning || error.get().code != AVErrorMediaServicesWereReset)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -639,11 +654,14 @@
</span><span class="cx"> 
</span><span class="cx"> void AVVideoCaptureSource::captureSessionBeginInterruption(RetainPtr<NSNotification> notification)
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, [notification.get().userInfo[AVCaptureSessionInterruptionReasonKey] integerValue]);
</ins><span class="cx">     m_interruption = static_cast<AVVideoCaptureSource::InterruptionReason>([notification.get().userInfo[AVCaptureSessionInterruptionReasonKey] integerValue]);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AVVideoCaptureSource::captureSessionEndInterruption(RetainPtr<NSNotification>)
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER);
+
</ins><span class="cx">     InterruptionReason reason = m_interruption;
</span><span class="cx"> 
</span><span class="cx">     m_interruption = InterruptionReason::None;
</span><span class="lines">@@ -657,6 +675,7 @@
</span><span class="cx"> 
</span><span class="cx"> void AVVideoCaptureSource::deviceDisconnected(RetainPtr<NSNotification> notification)
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER);
</ins><span class="cx">     if (this->device() == [notification object])
</span><span class="cx">         captureFailed();
</span><span class="cx"> }
</span><span class="lines">@@ -724,13 +743,13 @@
</span><span class="cx">     id newValue = [change valueForKey:NSKeyValueChangeNewKey];
</span><span class="cx"> 
</span><span class="cx">     bool willChange = [[change valueForKey:NSKeyValueChangeNotificationIsPriorKey] boolValue];
</span><del>-#if !LOG_DISABLED
</del><span class="cx"> 
</span><del>-    if (willChange)
-        LOG(Media, "WebCoreAVVideoCaptureSourceObserver::observeValueForKeyPath(%p) - will change, keyPath = %s", self, [keyPath UTF8String]);
-    else {
</del><ins>+#if !RELEASE_LOG_DISABLED
+    if (m_callback->loggerPtr() && m_callback->logger().willLog(m_callback->logChannel(), WTFLogLevelDebug)) {
+        auto identifier = Logger::LogSiteIdentifier("AVVideoCaptureSource", "observeValueForKeyPath", m_callback->logIdentifier());
+
</ins><span class="cx">         RetainPtr<NSString> valueString = adoptNS([[NSString alloc] initWithFormat:@"%@", newValue]);
</span><del>-        LOG(Media, "WebCoreAVVideoCaptureSourceObserver::observeValueForKeyPath(%p) - did change, keyPath = %s, value = %s", self, [keyPath UTF8String], [valueString.get() UTF8String]);
</del><ins>+        m_callback->logger().debug(m_callback->logChannel(), identifier, "did change '", [keyPath UTF8String], "' to ", [valueString.get() UTF8String]);
</ins><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -742,8 +761,6 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)deviceConnectedDidChange:(NSNotification*)notification
</span><span class="cx"> {
</span><del>-    LOG(Media, "WebCoreAVVideoCaptureSourceObserver::deviceConnectedDidChange(%p)", self);
-
</del><span class="cx">     if (m_callback)
</span><span class="cx">         m_callback->deviceDisconnected(notification);
</span><span class="cx"> }
</span><span class="lines">@@ -752,8 +769,6 @@
</span><span class="cx"> - (void)sessionRuntimeError:(NSNotification*)notification
</span><span class="cx"> {
</span><span class="cx">     NSError *error = notification.userInfo[AVCaptureSessionErrorKey];
</span><del>-    LOG(Media, "WebCoreAVVideoCaptureSourceObserver::sessionRuntimeError(%p) - error = %s", self, [[error localizedDescription] UTF8String]);
-
</del><span class="cx">     if (m_callback)
</span><span class="cx">         m_callback->captureSessionRuntimeError(error);
</span><span class="cx"> }
</span><span class="lines">@@ -760,8 +775,6 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)beginSessionInterrupted:(NSNotification*)notification
</span><span class="cx"> {
</span><del>-    LOG(Media, "WebCoreAVVideoCaptureSourceObserver::beginSessionInterrupted(%p) - reason = %d", self, [notification.userInfo[AVCaptureSessionInterruptionReasonKey] integerValue]);
-
</del><span class="cx">     if (m_callback)
</span><span class="cx">         m_callback->captureSessionBeginInterruption(notification);
</span><span class="cx"> }
</span><span class="lines">@@ -768,8 +781,6 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)endSessionInterrupted:(NSNotification*)notification
</span><span class="cx"> {
</span><del>-    LOG(Media, "WebCoreAVVideoCaptureSourceObserver::endSessionInterrupted(%p)", self);
-
</del><span class="cx">     if (m_callback)
</span><span class="cx">         m_callback->captureSessionEndInterruption(notification);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreammacCoreAudioCaptureSourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp 2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp    2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2017-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -235,7 +235,7 @@
</span><span class="cx"> void CoreAudioSharedUnit::addEchoCancellationSource(AudioSampleDataSource& source)
</span><span class="cx"> {
</span><span class="cx">     if (!source.setOutputFormat(m_speakerProcFormat)) {
</span><del>-        RELEASE_LOG_ERROR(Media, "CoreAudioSharedUnit::addEchoCancellationSource: source %p configureOutput failed", &source);
</del><ins>+        RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::addEchoCancellationSource: source %p configureOutput failed", &source);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -269,7 +269,7 @@
</span><span class="cx">     AudioComponent ioComponent = AudioComponentFindNext(nullptr, &ioUnitDescription);
</span><span class="cx">     ASSERT(ioComponent);
</span><span class="cx">     if (!ioComponent) {
</span><del>-        RELEASE_LOG_ERROR(Media, "CoreAudioCaptureSource::setupAudioUnit(%p) unable to find vpio unit component", this);
</del><ins>+        RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::setupAudioUnit(%p) unable to find vpio unit component", this);
</ins><span class="cx">         return -1;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -279,13 +279,13 @@
</span><span class="cx">     if (name) {
</span><span class="cx">         m_ioUnitName = name;
</span><span class="cx">         CFRelease(name);
</span><del>-        RELEASE_LOG(Media, "CoreAudioCaptureSource::setupAudioUnit(%p) created \"%s\" component", this, m_ioUnitName.utf8().data());
</del><ins>+        RELEASE_LOG(WebRTC, "CoreAudioSharedUnit::setupAudioUnit(%p) created \"%s\" component", this, m_ioUnitName.utf8().data());
</ins><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     auto err = AudioComponentInstanceNew(ioComponent, &m_ioUnit);
</span><span class="cx">     if (err) {
</span><del>-        RELEASE_LOG_ERROR(Media, "CoreAudioCaptureSource::setupAudioUnit(%p) unable to open vpio unit, error %d (%.4s)", this, (int)err, (char*)&err);
</del><ins>+        RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::setupAudioUnit(%p) unable to open vpio unit, error %d (%.4s)", this, (int)err, (char*)&err);
</ins><span class="cx">         return err;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -293,13 +293,13 @@
</span><span class="cx">         uint32_t param = 0;
</span><span class="cx">         err = AudioUnitSetProperty(m_ioUnit, kAUVoiceIOProperty_VoiceProcessingEnableAGC, kAudioUnitScope_Global, inputBus, &param, sizeof(param));
</span><span class="cx">         if (err) {
</span><del>-            RELEASE_LOG_ERROR(Media, "CoreAudioCaptureSource::setupAudioUnit(%p) unable to set vpio automatic gain control, error %d (%.4s)", this, (int)err, (char*)&err);
</del><ins>+            RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::setupAudioUnit(%p) unable to set vpio automatic gain control, error %d (%.4s)", this, (int)err, (char*)&err);
</ins><span class="cx">             return err;
</span><span class="cx">         }
</span><span class="cx">         param = 1;
</span><span class="cx">         err = AudioUnitSetProperty(m_ioUnit, kAUVoiceIOProperty_BypassVoiceProcessing, kAudioUnitScope_Global, inputBus, &param, sizeof(param));
</span><span class="cx">         if (err) {
</span><del>-            RELEASE_LOG_ERROR(Media, "CoreAudioCaptureSource::setupAudioUnit(%p) unable to set vpio unit echo cancellation, error %d (%.4s)", this, (int)err, (char*)&err);
</del><ins>+            RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::setupAudioUnit(%p) unable to set vpio unit echo cancellation, error %d (%.4s)", this, (int)err, (char*)&err);
</ins><span class="cx">             return err;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -308,7 +308,7 @@
</span><span class="cx">     uint32_t param = 1;
</span><span class="cx">     err = AudioUnitSetProperty(m_ioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, inputBus, &param, sizeof(param));
</span><span class="cx">     if (err) {
</span><del>-        RELEASE_LOG_ERROR(Media, "CoreAudioCaptureSource::setupAudioUnit(%p) unable to enable vpio unit input, error %d (%.4s)", this, (int)err, (char*)&err);
</del><ins>+        RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::setupAudioUnit(%p) unable to enable vpio unit input, error %d (%.4s)", this, (int)err, (char*)&err);
</ins><span class="cx">         return err;
</span><span class="cx">     }
</span><span class="cx"> #else
</span><span class="lines">@@ -320,7 +320,7 @@
</span><span class="cx"> 
</span><span class="cx">     err = AudioUnitSetProperty(m_ioUnit, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, inputBus, &m_captureDeviceID, sizeof(m_captureDeviceID));
</span><span class="cx">     if (err) {
</span><del>-        RELEASE_LOG_ERROR(Media, "CoreAudioCaptureSource::setupAudioUnit(%p) unable to set vpio unit capture device ID, error %d (%.4s)", this, (int)err, (char*)&err);
</del><ins>+        RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::setupAudioUnit(%p) unable to set vpio unit capture device ID, error %d (%.4s)", this, (int)err, (char*)&err);
</ins><span class="cx">         return err;
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="lines">@@ -335,7 +335,7 @@
</span><span class="cx"> 
</span><span class="cx">     err = AudioUnitInitialize(m_ioUnit);
</span><span class="cx">     if (err) {
</span><del>-        RELEASE_LOG_ERROR(Media, "CoreAudioCaptureSource::setupAudioUnit(%p) AudioUnitInitialize() failed, error %d (%.4s)", this, (int)err, (char*)&err);
</del><ins>+        RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::setupAudioUnit(%p) AudioUnitInitialize() failed, error %d (%.4s)", this, (int)err, (char*)&err);
</ins><span class="cx">         return err;
</span><span class="cx">     }
</span><span class="cx">     m_ioUnitInitialized = true;
</span><span class="lines">@@ -358,7 +358,7 @@
</span><span class="cx">     AURenderCallbackStruct callback = { microphoneCallback, this };
</span><span class="cx">     auto err = AudioUnitSetProperty(m_ioUnit, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, inputBus, &callback, sizeof(callback));
</span><span class="cx">     if (err) {
</span><del>-        RELEASE_LOG_ERROR(Media, "CoreAudioSharedUnit::configureMicrophoneProc(%p) unable to set vpio unit mic proc, error %d (%.4s)", this, (int)err, (char*)&err);
</del><ins>+        RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::configureMicrophoneProc(%p) unable to set vpio unit mic proc, error %d (%.4s)", this, (int)err, (char*)&err);
</ins><span class="cx">         return err;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -367,7 +367,7 @@
</span><span class="cx">     UInt32 size = sizeof(microphoneProcFormat);
</span><span class="cx">     err = AudioUnitGetProperty(m_ioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, inputBus, &microphoneProcFormat, &size);
</span><span class="cx">     if (err) {
</span><del>-        RELEASE_LOG_ERROR(Media, "CoreAudioSharedUnit::configureMicrophoneProc(%p) unable to get output stream format, error %d (%.4s)", this, (int)err, (char*)&err);
</del><ins>+        RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::configureMicrophoneProc(%p) unable to get output stream format, error %d (%.4s)", this, (int)err, (char*)&err);
</ins><span class="cx">         return err;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -374,7 +374,7 @@
</span><span class="cx">     microphoneProcFormat.mSampleRate = m_sampleRate;
</span><span class="cx">     err = AudioUnitSetProperty(m_ioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, inputBus, &microphoneProcFormat, size);
</span><span class="cx">     if (err) {
</span><del>-        RELEASE_LOG_ERROR(Media, "CoreAudioSharedUnit::configureMicrophoneProc(%p) unable to set output stream format, error %d (%.4s)", this, (int)err, (char*)&err);
</del><ins>+        RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::configureMicrophoneProc(%p) unable to set output stream format, error %d (%.4s)", this, (int)err, (char*)&err);
</ins><span class="cx">         return err;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -389,7 +389,7 @@
</span><span class="cx">     AURenderCallbackStruct callback = { speakerCallback, this };
</span><span class="cx">     auto err = AudioUnitSetProperty(m_ioUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, outputBus, &callback, sizeof(callback));
</span><span class="cx">     if (err) {
</span><del>-        RELEASE_LOG_ERROR(Media, "CoreAudioSharedUnit::configureSpeakerProc(%p) unable to set vpio unit speaker proc, error %d (%.4s)", this, (int)err, (char*)&err);
</del><ins>+        RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::configureSpeakerProc(%p) unable to set vpio unit speaker proc, error %d (%.4s)", this, (int)err, (char*)&err);
</ins><span class="cx">         return err;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -398,7 +398,7 @@
</span><span class="cx">     UInt32 size = sizeof(speakerProcFormat);
</span><span class="cx">     err = AudioUnitGetProperty(m_ioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, outputBus, &speakerProcFormat, &size);
</span><span class="cx">     if (err) {
</span><del>-        RELEASE_LOG_ERROR(Media, "CoreAudioSharedUnit::configureSpeakerProc(%p) unable to get input stream format, error %d (%.4s)", this, (int)err, (char*)&err);
</del><ins>+        RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::configureSpeakerProc(%p) unable to get input stream format, error %d (%.4s)", this, (int)err, (char*)&err);
</ins><span class="cx">         return err;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -405,7 +405,7 @@
</span><span class="cx">     speakerProcFormat.mSampleRate = m_sampleRate;
</span><span class="cx">     err = AudioUnitSetProperty(m_ioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, outputBus, &speakerProcFormat, size);
</span><span class="cx">     if (err) {
</span><del>-        RELEASE_LOG_ERROR(Media, "CoreAudioSharedUnit::configureSpeakerProc(%p) unable to get input stream format, error %d (%.4s)", this, (int)err, (char*)&err);
</del><ins>+        RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::configureSpeakerProc(%p) unable to get input stream format, error %d (%.4s)", this, (int)err, (char*)&err);
</ins><span class="cx">         return err;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -419,7 +419,7 @@
</span><span class="cx"> void CoreAudioSharedUnit::checkTimestamps(const AudioTimeStamp& timeStamp, uint64_t sampleTime, double hostTime)
</span><span class="cx"> {
</span><span class="cx">     if (!timeStamp.mSampleTime || sampleTime == m_latestMicTimeStamp || !hostTime)
</span><del>-        RELEASE_LOG_ERROR(Media, "CoreAudioSharedUnit::checkTimestamps: unusual timestamps, sample time = %lld, previous sample time = %lld, hostTime %f", sampleTime, m_latestMicTimeStamp, hostTime);
</del><ins>+        RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::checkTimestamps: unusual timestamps, sample time = %lld, previous sample time = %lld, hostTime %f", sampleTime, m_latestMicTimeStamp, hostTime);
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -431,7 +431,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     if (m_speakerSampleBuffer->sampleCapacity() < inNumberFrames) {
</span><del>-        RELEASE_LOG_ERROR(Media, "CoreAudioSharedUnit::provideSpeakerData: speaker sample buffer size (%d) too small for amount of sample data requested (%d)!", m_speakerSampleBuffer->sampleCapacity(), (int)inNumberFrames);
</del><ins>+        RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::provideSpeakerData: speaker sample buffer size (%d) too small for amount of sample data requested (%d)!", m_speakerSampleBuffer->sampleCapacity(), (int)inNumberFrames);
</ins><span class="cx">         return kAudio_ParamError;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -494,7 +494,7 @@
</span><span class="cx">     AudioBufferList& bufferList = m_microphoneSampleBuffer->bufferList();
</span><span class="cx">     auto err = AudioUnitRender(m_ioUnit, &ioActionFlags, &timeStamp, inBusNumber, inNumberFrames, &bufferList);
</span><span class="cx">     if (err) {
</span><del>-        RELEASE_LOG_ERROR(Media, "CoreAudioSharedUnit::processMicrophoneSamples(%p) AudioUnitRender failed with error %d (%.4s)", this, (int)err, (char*)&err);
</del><ins>+        RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::processMicrophoneSamples(%p) AudioUnitRender failed with error %d (%.4s)", this, (int)err, (char*)&err);
</ins><span class="cx">         return err;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -530,7 +530,7 @@
</span><span class="cx">         ASSERT(m_ioUnit);
</span><span class="cx">         auto err = AudioUnitUninitialize(m_ioUnit);
</span><span class="cx">         if (err)
</span><del>-            RELEASE_LOG_ERROR(Media, "CoreAudioSharedUnit::cleanupAudioUnit(%p) AudioUnitUninitialize failed with error %d (%.4s)", this, (int)err, (char*)&err);
</del><ins>+            RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::cleanupAudioUnit(%p) AudioUnitUninitialize failed with error %d (%.4s)", this, (int)err, (char*)&err);
</ins><span class="cx">         m_ioUnitInitialized = false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -555,7 +555,7 @@
</span><span class="cx">     if (m_ioUnitStarted) {
</span><span class="cx">         err = AudioOutputUnitStop(m_ioUnit);
</span><span class="cx">         if (err) {
</span><del>-            RELEASE_LOG_ERROR(Media, "CoreAudioSharedUnit::reconfigureAudioUnit(%p) AudioOutputUnitStop failed with error %d (%.4s)", this, (int)err, (char*)&err);
</del><ins>+            RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::reconfigureAudioUnit(%p) AudioOutputUnitStop failed with error %d (%.4s)", this, (int)err, (char*)&err);
</ins><span class="cx">             return err;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -568,7 +568,7 @@
</span><span class="cx">     if (m_ioUnitStarted) {
</span><span class="cx">         err = AudioOutputUnitStart(m_ioUnit);
</span><span class="cx">         if (err) {
</span><del>-            RELEASE_LOG_ERROR(Media, "CoreAudioSharedUnit::reconfigureAudioUnit(%p) AudioOutputUnitStart failed with error %d (%.4s)", this, (int)err, (char*)&err);
</del><ins>+            RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::reconfigureAudioUnit(%p) AudioOutputUnitStart failed with error %d (%.4s)", this, (int)err, (char*)&err);
</ins><span class="cx">             return err;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -627,7 +627,7 @@
</span><span class="cx"> 
</span><span class="cx">     err = AudioOutputUnitStart(m_ioUnit);
</span><span class="cx">     if (err) {
</span><del>-        RELEASE_LOG_ERROR(Media, "CoreAudioSharedUnit::start(%p) AudioOutputUnitStart failed with error %d (%.4s)", this, (int)err, (char*)&err);
</del><ins>+        RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::start(%p) AudioOutputUnitStart failed with error %d (%.4s)", this, (int)err, (char*)&err);
</ins><span class="cx">         return err;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -649,14 +649,13 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::verifyIsCapturing - no audio received in %d seconds, failing", static_cast<int>(m_verifyCapturingTimer.repeatInterval().value()));
</ins><span class="cx">     captureFailed();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void CoreAudioSharedUnit::captureFailed()
</span><span class="cx"> {
</span><del>-#if !RELEASE_LOG_DISABLED
-    RELEASE_LOG_ERROR(Media, "CoreAudioSharedUnit::captureFailed - capture failed");
-#endif
</del><ins>+    RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::captureFailed - capture failed");
</ins><span class="cx">     for (CoreAudioCaptureSource& client : m_clients)
</span><span class="cx">         client.captureFailed();
</span><span class="cx"> 
</span><span class="lines">@@ -697,7 +696,7 @@
</span><span class="cx"> 
</span><span class="cx">     auto err = AudioOutputUnitStop(m_ioUnit);
</span><span class="cx">     if (err) {
</span><del>-        RELEASE_LOG_ERROR(Media, "CoreAudioSharedUnit::stop(%p) AudioOutputUnitStop failed with error %d (%.4s)", this, (int)err, (char*)&err);
</del><ins>+        RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::stop(%p) AudioOutputUnitStop failed with error %d (%.4s)", this, (int)err, (char*)&err);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -711,7 +710,7 @@
</span><span class="cx">     UInt32 propertySize = sizeof(*deviceID);
</span><span class="cx">     auto err = AudioUnitGetProperty(m_ioUnit, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, inputBus, deviceID, &propertySize);
</span><span class="cx">     if (err)
</span><del>-        RELEASE_LOG_ERROR(Media, "CoreAudioSharedUnit::defaultInputDevice(%p) unable to get default input device ID, error %d (%.4s)", this, (int)err, (char*)&err);
</del><ins>+        RELEASE_LOG_ERROR(WebRTC, "CoreAudioSharedUnit::defaultInputDevice(%p) unable to get default input device ID, error %d (%.4s)", this, (int)err, (char*)&err);
</ins><span class="cx"> 
</span><span class="cx">     return err;
</span><span class="cx"> }
</span><span class="lines">@@ -836,6 +835,7 @@
</span><span class="cx">     if (m_isReadyToStart)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER);
</ins><span class="cx">     m_isReadyToStart = true;
</span><span class="cx"> 
</span><span class="cx">     auto& unit = CoreAudioSharedUnit::singleton();
</span><span class="lines">@@ -866,11 +866,13 @@
</span><span class="cx"> 
</span><span class="cx"> void CoreAudioCaptureSource::addEchoCancellationSource(AudioSampleDataSource& source)
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER);
</ins><span class="cx">     CoreAudioSharedUnit::singleton().addEchoCancellationSource(source);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void CoreAudioCaptureSource::removeEchoCancellationSource(AudioSampleDataSource& source)
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER);
</ins><span class="cx">     CoreAudioSharedUnit::singleton().removeEchoCancellationSource(source);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -881,7 +883,11 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     auto& unit = CoreAudioSharedUnit::singleton();
</span><del>-    if (unit.isSuspended()) {
</del><ins>+
+    auto isSuspended = unit.isSuspended();
+    ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, isSuspended);
+
+    if (isSuspended) {
</ins><span class="cx">         m_suspendType = SuspensionType::WhilePlaying;
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -894,7 +900,10 @@
</span><span class="cx"> {
</span><span class="cx">     auto& unit = CoreAudioSharedUnit::singleton();
</span><span class="cx"> 
</span><del>-    if (unit.isSuspended()) {
</del><ins>+    auto isSuspended = unit.isSuspended();
+    ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, isSuspended);
+
+    if (isSuspended) {
</ins><span class="cx">         m_suspendType = SuspensionType::WhilePaused;
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -953,6 +962,8 @@
</span><span class="cx"> 
</span><span class="cx"> void CoreAudioCaptureSource::scheduleReconfiguration()
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER);
+
</ins><span class="cx">     ASSERT(isMainThread());
</span><span class="cx">     auto& unit = CoreAudioSharedUnit::singleton();
</span><span class="cx">     if (!unit.hasAudioUnit() || m_reconfigurationState != ReconfigurationState::None)
</span><span class="lines">@@ -972,6 +983,8 @@
</span><span class="cx"> 
</span><span class="cx"> void CoreAudioCaptureSource::beginInterruption()
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER);
+
</ins><span class="cx">     ASSERT(isMainThread());
</span><span class="cx">     auto& unit = CoreAudioSharedUnit::singleton();
</span><span class="cx">     if (!unit.hasAudioUnit() || unit.isSuspended() || m_suspendPending)
</span><span class="lines">@@ -988,6 +1001,8 @@
</span><span class="cx"> 
</span><span class="cx"> void CoreAudioCaptureSource::endInterruption()
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER);
+
</ins><span class="cx">     ASSERT(isMainThread());
</span><span class="cx">     auto& unit = CoreAudioSharedUnit::singleton();
</span><span class="cx">     if (!unit.hasAudioUnit() || !unit.isSuspended() || m_resumePending)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreammacCoreAudioCaptureSourceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h   2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h      2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2017-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -95,6 +95,10 @@
</span><span class="cx"> 
</span><span class="cx">     void initializeToStartProducingData();
</span><span class="cx"> 
</span><ins>+#if !RELEASE_LOG_DISABLED
+    const char* logClassName() const override { return "CoreAudioCaptureSource"; }
+#endif
+
</ins><span class="cx">     uint32_t m_captureDeviceID { 0 };
</span><span class="cx"> 
</span><span class="cx">     Optional<RealtimeMediaSourceCapabilities> m_capabilities;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreammacScreenDisplayCaptureSourceMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h    2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h       2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2017-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -66,7 +66,11 @@
</span><span class="cx"> 
</span><span class="cx">     bool createDisplayStream();
</span><span class="cx">     void startDisplayStream();
</span><del>-    
</del><ins>+
+#if !RELEASE_LOG_DISABLED
+    const char* logClassName() const override { return "ScreenDisplayCaptureSourceMac"; }
+#endif
+
</ins><span class="cx">     class DisplaySurface {
</span><span class="cx">     public:
</span><span class="cx">         DisplaySurface() = default;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreammacScreenDisplayCaptureSourceMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm (243032 => 243033)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm   2019-03-16 04:44:57 UTC (rev 243032)
+++ trunk/Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm      2019-03-16 05:21:43 UTC (rev 243033)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2017-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -115,8 +115,11 @@
</span><span class="cx"> {
</span><span class="cx">     static const int screenQueueMaximumLength = 6;
</span><span class="cx"> 
</span><ins>+    ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER);
+
</ins><span class="cx">     auto actualDisplayID = updateDisplayID(m_displayID);
</span><span class="cx">     if (!actualDisplayID) {
</span><ins>+        ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "invalid display ID: ", m_displayID);
</ins><span class="cx">         captureFailed();
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="lines">@@ -123,7 +126,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (m_displayID != actualDisplayID.value()) {
</span><span class="cx">         m_displayID = actualDisplayID.value();
</span><del>-        RELEASE_LOG(Media, "ScreenDisplayCaptureSourceMac::createDisplayStream: display ID changed to %d", static_cast<int>(m_displayID));
</del><ins>+        ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, "display ID changed to ", static_cast<int>(m_displayID));
</ins><span class="cx">         m_displayStream = nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -132,7 +135,7 @@
</span><span class="cx">         auto screenWidth = CGDisplayModeGetPixelsWide(displayMode.get());
</span><span class="cx">         auto screenHeight = CGDisplayModeGetPixelsHigh(displayMode.get());
</span><span class="cx">         if (!screenWidth || !screenHeight) {
</span><del>-            RELEASE_LOG(Media, "ScreenDisplayCaptureSourceMac::createDisplayStream: unable to get screen width/height");
</del><ins>+            ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "unable to get screen width/height");
</ins><span class="cx">             captureFailed();
</span><span class="cx">             return false;
</span><span class="cx">         }
</span><span class="lines">@@ -158,7 +161,7 @@
</span><span class="cx"> 
</span><span class="cx">         m_displayStream = adoptCF(CGDisplayStreamCreateWithDispatchQueue(m_displayID, screenWidth, screenHeight, preferedPixelBufferFormat(), (__bridge CFDictionaryRef)streamOptions, m_captureQueue.get(), frameAvailableBlock));
</span><span class="cx">         if (!m_displayStream) {
</span><del>-            RELEASE_LOG(Media, "ScreenDisplayCaptureSourceMac::createDisplayStream: CGDisplayStreamCreate failed");
</del><ins>+            ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "CGDisplayStreamCreate failed");
</ins><span class="cx">             captureFailed();
</span><span class="cx">             return false;
</span><span class="cx">         }
</span><span class="lines">@@ -174,6 +177,7 @@
</span><span class="cx"> 
</span><span class="cx"> void ScreenDisplayCaptureSourceMac::startProducingData()
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER);
</ins><span class="cx">     DisplayCaptureSourceCocoa::startProducingData();
</span><span class="cx"> 
</span><span class="cx">     if (m_isRunning)
</span><span class="lines">@@ -184,6 +188,7 @@
</span><span class="cx"> 
</span><span class="cx"> void ScreenDisplayCaptureSourceMac::stopProducingData()
</span><span class="cx"> {
</span><ins>+    ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER);
</ins><span class="cx">     DisplayCaptureSourceCocoa::stopProducingData();
</span><span class="cx"> 
</span><span class="cx">     if (!m_isRunning)
</span><span class="lines">@@ -214,7 +219,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (m_displayID != actualDisplayID.value()) {
</span><span class="cx">         m_displayID = actualDisplayID.value();
</span><del>-        RELEASE_LOG(Media, "ScreenDisplayCaptureSourceMac::startDisplayStream: display ID changed to %d", static_cast<int>(m_displayID));
</del><ins>+        ALWAYS_LOG_IF(loggerPtr(), LOGIDENTIFIER, "display ID changed to ", static_cast<int>(m_displayID));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!m_displayStream && !createDisplayStream())
</span><span class="lines">@@ -222,7 +227,7 @@
</span><span class="cx"> 
</span><span class="cx">     auto err = CGDisplayStreamStart(m_displayStream.get());
</span><span class="cx">     if (err) {
</span><del>-        RELEASE_LOG(Media, "ScreenDisplayCaptureSourceMac::startDisplayStream: CGDisplayStreamStart failed with error %d", static_cast<int>(err));
</del><ins>+        ERROR_LOG_IF(loggerPtr(), LOGIDENTIFIER, "CGDisplayStreamStart failed with error ", static_cast<int>(err));
</ins><span class="cx">         captureFailed();
</span><span class="cx">         return;
</span><span class="cx">     }
</span></span></pre>
</div>
</div>

</body>
</html>