Diff
Modified: trunk/Source/WebCore/ChangeLog (240119 => 240120)
--- trunk/Source/WebCore/ChangeLog 2019-01-17 19:15:57 UTC (rev 240119)
+++ trunk/Source/WebCore/ChangeLog 2019-01-17 19:23:45 UTC (rev 240120)
@@ -1,3 +1,61 @@
+2019-01-17 Youenn Fablet <[email protected]>
+
+ Add release logging for incoming and outgoing webrtc audio tracks
+ https://bugs.webkit.org/show_bug.cgi?id=185545
+
+ Reviewed by Eric Carlson.
+
+ Add logging of audio tracks. When doing a WebRTC call,
+ one log line is added each second for each audio track.
+ Validated that logging is done through manual testing.
+
+ Refactored code to use LogHelper and apply it to video sources as well.
+
+ * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
+ (WebCore::LibWebRTCMediaEndpoint::addTrack):
+ (WebCore::LibWebRTCMediaEndpoint::sourceFromNewReceiver):
+ (WebCore::sourceFromNewReceiver): Deleted.
+ * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
+ * platform/mediastream/RealtimeIncomingAudioSource.cpp:
+ (WebCore::RealtimeIncomingAudioSource::RealtimeIncomingAudioSource):
+ (WebCore::RealtimeIncomingAudioSource::logChannel const):
+ (WebCore::RealtimeIncomingAudioSource::logger const):
+ * platform/mediastream/RealtimeIncomingAudioSource.h:
+ (WebCore::RealtimeIncomingAudioSource::setLogger):
+ * platform/mediastream/RealtimeIncomingVideoSource.cpp:
+ (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
+ (WebCore::RealtimeIncomingVideoSource::logChannel const):
+ (WebCore::RealtimeIncomingVideoSource::logger const):
+ * platform/mediastream/RealtimeIncomingVideoSource.h:
+ (WebCore::RealtimeIncomingVideoSource::setLogger):
+ * platform/mediastream/RealtimeOutgoingAudioSource.cpp:
+ (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
+ (WebCore::RealtimeOutgoingAudioSource::sendAudioFrames):
+ (WebCore::RealtimeOutgoingAudioSource::logChannel const):
+ (WebCore::RealtimeOutgoingAudioSource::logger const):
+ * platform/mediastream/RealtimeOutgoingAudioSource.h:
+ (WebCore::RealtimeOutgoingAudioSource::setLogger):
+ * platform/mediastream/RealtimeOutgoingVideoSource.cpp:
+ (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource):
+ (WebCore::RealtimeOutgoingVideoSource::sendBlackFramesIfNeeded):
+ (WebCore::RealtimeOutgoingVideoSource::sendOneBlackFrame):
+ (WebCore::RealtimeOutgoingVideoSource::logChannel const):
+ (WebCore::RealtimeOutgoingVideoSource::logger const):
+ * platform/mediastream/RealtimeOutgoingVideoSource.h:
+ (WebCore::RealtimeOutgoingVideoSource::setLogger):
+ * platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp:
+ (WebCore::RealtimeIncomingAudioSourceCocoa::OnData):
+ * platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.h:
+ * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
+ (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferPool):
+ (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
+ (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
+ * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp:
+ * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
+ (WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated):
+ * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm:
+ (WebCore::RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer):
+
2019-01-17 Alex Christensen <[email protected]>
Stop using NetworkStorageSession::storageSession in WebCore
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp (240119 => 240120)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp 2019-01-17 19:15:57 UTC (rev 240119)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp 2019-01-17 19:23:45 UTC (rev 240120)
@@ -219,6 +219,9 @@
switch (track.privateTrack().type()) {
case RealtimeMediaSource::Type::Audio: {
auto audioSource = RealtimeOutgoingAudioSource::create(track.privateTrack());
+#if !RELEASE_LOG_DISABLED
+ audioSource->setLogger(m_logger.copyRef());
+#endif
rtcTrack = m_peerConnectionFactory.CreateAudioTrack(track.id().utf8().data(), audioSource.ptr());
source = WTFMove(audioSource);
break;
@@ -225,6 +228,9 @@
}
case RealtimeMediaSource::Type::Video: {
auto videoSource = RealtimeOutgoingVideoSource::create(track.privateTrack());
+#if !RELEASE_LOG_DISABLED
+ videoSource->setLogger(m_logger.copyRef());
+#endif
rtcTrack = m_peerConnectionFactory.CreateVideoTrack(track.id().utf8().data(), videoSource.ptr());
source = WTFMove(videoSource);
break;
@@ -445,7 +451,7 @@
}
}
-static inline RefPtr<RealtimeMediaSource> sourceFromNewReceiver(webrtc::RtpReceiverInterface& rtcReceiver)
+RefPtr<RealtimeMediaSource> LibWebRTCMediaEndpoint::sourceFromNewReceiver(webrtc::RtpReceiverInterface& rtcReceiver)
{
auto rtcTrack = rtcReceiver.track();
switch (rtcReceiver.media_type()) {
@@ -453,11 +459,19 @@
return nullptr;
case cricket::MEDIA_TYPE_AUDIO: {
rtc::scoped_refptr<webrtc::AudioTrackInterface> audioTrack = static_cast<webrtc::AudioTrackInterface*>(rtcTrack.get());
- return RealtimeIncomingAudioSource::create(WTFMove(audioTrack), fromStdString(rtcTrack->id()));
+ auto audioSource = RealtimeIncomingAudioSource::create(WTFMove(audioTrack), fromStdString(rtcTrack->id()));
+#if !RELEASE_LOG_DISABLED
+ audioSource->setLogger(m_logger.copyRef());
+#endif
+ return audioSource;
}
case cricket::MEDIA_TYPE_VIDEO: {
rtc::scoped_refptr<webrtc::VideoTrackInterface> videoTrack = static_cast<webrtc::VideoTrackInterface*>(rtcTrack.get());
- return RealtimeIncomingVideoSource::create(WTFMove(videoTrack), fromStdString(rtcTrack->id()));
+ auto videoSource = RealtimeIncomingVideoSource::create(WTFMove(videoTrack), fromStdString(rtcTrack->id()));
+#if !RELEASE_LOG_DISABLED
+ videoSource->setLogger(m_logger.copyRef());
+#endif
+ return videoSource;
}
}
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h (240119 => 240120)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h 2019-01-17 19:15:57 UTC (rev 240119)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h 2019-01-17 19:23:45 UTC (rev 240120)
@@ -167,6 +167,7 @@
}
std::pair<LibWebRTCRtpSenderBackend::Source, rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>> createSourceAndRTCTrack(MediaStreamTrack&);
+ RefPtr<RealtimeMediaSource> sourceFromNewReceiver(webrtc::RtpReceiverInterface&);
#if !RELEASE_LOG_DISABLED
const Logger& logger() const final { return m_logger.get(); }
Modified: trunk/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.cpp (240119 => 240120)
--- trunk/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.cpp 2019-01-17 19:15:57 UTC (rev 240119)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.cpp 2019-01-17 19:23:45 UTC (rev 240120)
@@ -34,6 +34,8 @@
#if USE(LIBWEBRTC)
#include "LibWebRTCAudioFormat.h"
+#include "Logging.h"
+#include <wtf/CryptographicallyRandomNumber.h>
namespace WebCore {
@@ -40,6 +42,9 @@
RealtimeIncomingAudioSource::RealtimeIncomingAudioSource(rtc::scoped_refptr<webrtc::AudioTrackInterface>&& audioTrack, String&& audioTrackId)
: RealtimeMediaSource(RealtimeMediaSource::Type::Audio, "remote audio"_s, WTFMove(audioTrackId))
, m_audioTrack(WTFMove(audioTrack))
+#if !RELEASE_LOG_DISABLED
+ , m_logIdentifier(reinterpret_cast<const void*>(cryptographicallyRandomNumber()))
+#endif
{
notifyMutedChange(!m_audioTrack);
}
@@ -84,6 +89,20 @@
return m_currentSettings;
}
+#if !RELEASE_LOG_DISABLED
+WTFLogChannel& RealtimeIncomingAudioSource::logChannel() const
+{
+ return LogWebRTC;
}
+const Logger& RealtimeIncomingAudioSource::logger() const
+{
+ if (!m_logger)
+ m_logger = Logger::create(this);
+ return *m_logger;
+}
+#endif
+
+}
+
#endif // USE(LIBWEBRTC)
Modified: trunk/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.h (240119 => 240120)
--- trunk/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.h 2019-01-17 19:15:57 UTC (rev 240119)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.h 2019-01-17 19:23:45 UTC (rev 240120)
@@ -41,20 +41,39 @@
ALLOW_UNUSED_PARAMETERS_END
+#include <wtf/LoggerHelper.h>
#include <wtf/RetainPtr.h>
namespace WebCore {
-class RealtimeIncomingAudioSource : public RealtimeMediaSource, private webrtc::AudioTrackSinkInterface {
+class RealtimeIncomingAudioSource
+ : public RealtimeMediaSource
+ , private webrtc::AudioTrackSinkInterface
+#if !RELEASE_LOG_DISABLED
+ , private LoggerHelper
+#endif
+{
public:
static Ref<RealtimeIncomingAudioSource> create(rtc::scoped_refptr<webrtc::AudioTrackInterface>&&, String&&);
void setSourceTrack(rtc::scoped_refptr<webrtc::AudioTrackInterface>&&);
+#if !RELEASE_LOG_DISABLED
+ void setLogger(Ref<const Logger>&& logger) { m_logger = WTFMove(logger); }
+#endif
+
protected:
RealtimeIncomingAudioSource(rtc::scoped_refptr<webrtc::AudioTrackInterface>&&, String&&);
~RealtimeIncomingAudioSource();
+#if !RELEASE_LOG_DISABLED
+ // LoggerHelper API
+ const Logger& logger() const final;
+ const void* logIdentifier() const final { return m_logIdentifier; }
+ const char* logClassName() const final { return "RealtimeIncomingAudioSource"; }
+ WTFLogChannel& logChannel() const final;
+#endif
+
private:
// webrtc::AudioTrackSinkInterface API
virtual void OnData(const void* /* audioData */, int /* bitsPerSample */, int /* sampleRate */, size_t /* numberOfChannels */, size_t /* numberOfFrames */) { };
@@ -70,6 +89,11 @@
RealtimeMediaSourceSettings m_currentSettings;
rtc::scoped_refptr<webrtc::AudioTrackInterface> m_audioTrack;
+
+#if !RELEASE_LOG_DISABLED
+ mutable RefPtr<const Logger> m_logger;
+ const void* m_logIdentifier;
+#endif
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp (240119 => 240120)
--- trunk/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp 2019-01-17 19:15:57 UTC (rev 240119)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp 2019-01-17 19:23:45 UTC (rev 240120)
@@ -34,6 +34,7 @@
#if USE(LIBWEBRTC)
#include "Logging.h"
+#include <wtf/CryptographicallyRandomNumber.h>
namespace WebCore {
@@ -40,6 +41,9 @@
RealtimeIncomingVideoSource::RealtimeIncomingVideoSource(rtc::scoped_refptr<webrtc::VideoTrackInterface>&& videoTrack, String&& videoTrackId)
: RealtimeMediaSource(Type::Video, "remote video"_s, WTFMove(videoTrackId))
, m_videoTrack(WTFMove(videoTrack))
+#if !RELEASE_LOG_DISABLED
+ , m_logIdentifier(reinterpret_cast<const void*>(cryptographicallyRandomNumber()))
+#endif
{
notifyMutedChange(!m_videoTrack);
@@ -104,6 +108,20 @@
m_currentSettings = WTF::nullopt;
}
+#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
+
} // namespace WebCore
#endif // USE(LIBWEBRTC)
Modified: trunk/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.h (240119 => 240120)
--- trunk/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.h 2019-01-17 19:15:57 UTC (rev 240119)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.h 2019-01-17 19:23:45 UTC (rev 240120)
@@ -41,6 +41,7 @@
ALLOW_UNUSED_PARAMETERS_END
+#include <wtf/LoggerHelper.h>
#include <wtf/RetainPtr.h>
namespace WebCore {
@@ -47,7 +48,13 @@
class CaptureDevice;
-class RealtimeIncomingVideoSource : public RealtimeMediaSource, private rtc::VideoSinkInterface<webrtc::VideoFrame> {
+class RealtimeIncomingVideoSource
+ : public RealtimeMediaSource
+ , private rtc::VideoSinkInterface<webrtc::VideoFrame>
+#if !RELEASE_LOG_DISABLED
+ , private LoggerHelper
+#endif
+{
public:
static Ref<RealtimeIncomingVideoSource> create(rtc::scoped_refptr<webrtc::VideoTrackInterface>&&, String&&);
~RealtimeIncomingVideoSource()
@@ -57,9 +64,21 @@
void setSourceTrack(rtc::scoped_refptr<webrtc::VideoTrackInterface>&&);
+#if !RELEASE_LOG_DISABLED
+ void setLogger(Ref<const Logger>&& logger) { m_logger = WTFMove(logger); }
+#endif
+
protected:
RealtimeIncomingVideoSource(rtc::scoped_refptr<webrtc::VideoTrackInterface>&&, String&&);
+#if !RELEASE_LOG_DISABLED
+ // LoggerHelper API
+ const Logger& logger() const final;
+ const void* logIdentifier() const final { return m_logIdentifier; }
+ const char* logClassName() const final { return "RealtimeIncomingVideoSource"; }
+ WTFLogChannel& logChannel() const final;
+#endif
+
private:
// RealtimeMediaSource API
void startProducingData() final;
@@ -73,6 +92,11 @@
Optional<RealtimeMediaSourceSettings> m_currentSettings;
rtc::scoped_refptr<webrtc::VideoTrackInterface> m_videoTrack;
+
+#if !RELEASE_LOG_DISABLED
+ mutable RefPtr<const Logger> m_logger;
+ const void* m_logIdentifier;
+#endif
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.cpp (240119 => 240120)
--- trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.cpp 2019-01-17 19:15:57 UTC (rev 240119)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.cpp 2019-01-17 19:23:45 UTC (rev 240120)
@@ -33,11 +33,16 @@
#include "LibWebRTCAudioFormat.h"
#include "LibWebRTCProvider.h"
+#include "Logging.h"
+#include <wtf/CryptographicallyRandomNumber.h>
namespace WebCore {
RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource(Ref<MediaStreamTrackPrivate>&& source)
: m_audioSource(WTFMove(source))
+#if !RELEASE_LOG_DISABLED
+ , m_logIdentifier(reinterpret_cast<const void*>(cryptographicallyRandomNumber()))
+#endif
{
}
@@ -114,12 +119,31 @@
void RealtimeOutgoingAudioSource::sendAudioFrames(const void* audioData, int bitsPerSample, int sampleRate, size_t numberOfChannels, size_t numberOfFrames)
{
+#if !RELEASE_LOG_DISABLED
+ if (!(++m_chunksSent % 200))
+ ALWAYS_LOG(LOGIDENTIFIER, "chunk ", m_chunksSent);
+#endif
+
auto locker = holdLock(m_sinksLock);
for (auto sink : m_sinks)
sink->OnData(audioData, bitsPerSample, sampleRate, numberOfChannels, numberOfFrames);
}
+#if !RELEASE_LOG_DISABLED
+WTFLogChannel& RealtimeOutgoingAudioSource::logChannel() const
+{
+ return LogWebRTC;
+}
+const Logger& RealtimeOutgoingAudioSource::logger() const
+{
+ if (!m_logger)
+ m_logger = Logger::create(this);
+ return *m_logger;
+}
+
+#endif
+
} // namespace WebCore
#endif // USE(LIBWEBRTC)
Modified: trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.h (240119 => 240120)
--- trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.h 2019-01-17 19:15:57 UTC (rev 240119)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.h 2019-01-17 19:23:45 UTC (rev 240120)
@@ -41,6 +41,7 @@
ALLOW_UNUSED_PARAMETERS_END
+#include <wtf/LoggerHelper.h>
#include <wtf/ThreadSafeRefCounted.h>
namespace webrtc {
@@ -50,7 +51,14 @@
namespace WebCore {
-class RealtimeOutgoingAudioSource : public ThreadSafeRefCounted<RealtimeOutgoingAudioSource, WTF::DestructionThread::Main>, public webrtc::AudioSourceInterface, private MediaStreamTrackPrivate::Observer {
+class RealtimeOutgoingAudioSource
+ : public ThreadSafeRefCounted<RealtimeOutgoingAudioSource, WTF::DestructionThread::Main>
+ , public webrtc::AudioSourceInterface
+ , private MediaStreamTrackPrivate::Observer
+#if !RELEASE_LOG_DISABLED
+ , private LoggerHelper
+#endif
+{
public:
static Ref<RealtimeOutgoingAudioSource> create(Ref<MediaStreamTrackPrivate>&& audioSource);
@@ -61,6 +69,10 @@
bool setSource(Ref<MediaStreamTrackPrivate>&&);
MediaStreamTrackPrivate& source() const { return m_audioSource.get(); }
+#if !RELEASE_LOG_DISABLED
+ void setLogger(Ref<const Logger>&& logger) { m_logger = WTFMove(logger); }
+#endif
+
protected:
explicit RealtimeOutgoingAudioSource(Ref<MediaStreamTrackPrivate>&&);
@@ -72,6 +84,14 @@
void sendAudioFrames(const void* audioData, int bitsPerSample, int sampleRate, size_t numberOfChannels, size_t numberOfFrames);
+#if !RELEASE_LOG_DISABLED
+ // LoggerHelper API
+ const Logger& logger() const final;
+ const void* logIdentifier() const final { return m_logIdentifier; }
+ const char* logClassName() const final { return "RealtimeOutgoingAudioSource"; }
+ WTFLogChannel& logChannel() const final;
+#endif
+
private:
// webrtc::AudioSourceInterface API
void AddSink(webrtc::AudioTrackSinkInterface*) final;
@@ -115,6 +135,12 @@
mutable RecursiveLock m_sinksLock;
HashSet<webrtc::AudioTrackSinkInterface*> m_sinks;
+
+#if !RELEASE_LOG_DISABLED
+ mutable RefPtr<const Logger> m_logger;
+ const void* m_logIdentifier;
+ size_t m_chunksSent { 0 };
+#endif
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.cpp (240119 => 240120)
--- trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.cpp 2019-01-17 19:15:57 UTC (rev 240119)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.cpp 2019-01-17 19:23:45 UTC (rev 240120)
@@ -40,6 +40,7 @@
ALLOW_UNUSED_PARAMETERS_END
+#include <wtf/CryptographicallyRandomNumber.h>
#include <wtf/MainThread.h>
namespace WebCore {
@@ -47,6 +48,9 @@
RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource(Ref<MediaStreamTrackPrivate>&& videoSource)
: m_videoSource(WTFMove(videoSource))
, m_blackFrameTimer(*this, &RealtimeOutgoingVideoSource::sendOneBlackFrame)
+#if !RELEASE_LOG_DISABLED
+ , m_logIdentifier(reinterpret_cast<const void*>(cryptographicallyRandomNumber()))
+#endif
{
}
@@ -186,7 +190,7 @@
m_blackFrame = createBlackFrame(width, height);
ASSERT(m_blackFrame);
if (!m_blackFrame) {
- RELEASE_LOG(WebRTC, "RealtimeOutgoingVideoSource::sendBlackFramesIfNeeded unable to send black frames");
+ ALWAYS_LOG(LOGIDENTIFIER, "Unable to send black frames");
return;
}
}
@@ -196,7 +200,7 @@
void RealtimeOutgoingVideoSource::sendOneBlackFrame()
{
- RELEASE_LOG(MediaStream, "RealtimeOutgoingVideoSource::sendOneBlackFrame");
+ ALWAYS_LOG(LOGIDENTIFIER, "test");
sendFrame(rtc::scoped_refptr<webrtc::VideoFrameBuffer>(m_blackFrame));
}
@@ -210,6 +214,20 @@
sink->OnFrame(frame);
}
+#if !RELEASE_LOG_DISABLED
+WTFLogChannel& RealtimeOutgoingVideoSource::logChannel() const
+{
+ return LogWebRTC;
+}
+
+const Logger& RealtimeOutgoingVideoSource::logger() const
+{
+ if (!m_logger)
+ m_logger = Logger::create(this);
+ return *m_logger;
+}
+#endif
+
} // namespace WebCore
#endif // USE(LIBWEBRTC)
Modified: trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h (240119 => 240120)
--- trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h 2019-01-17 19:15:57 UTC (rev 240119)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h 2019-01-17 19:23:45 UTC (rev 240120)
@@ -41,12 +41,20 @@
ALLOW_UNUSED_PARAMETERS_END
+#include <wtf/LoggerHelper.h>
#include <wtf/Optional.h>
#include <wtf/ThreadSafeRefCounted.h>
namespace WebCore {
-class RealtimeOutgoingVideoSource : public ThreadSafeRefCounted<RealtimeOutgoingVideoSource, WTF::DestructionThread::Main>, public webrtc::VideoTrackSourceInterface, private MediaStreamTrackPrivate::Observer {
+class RealtimeOutgoingVideoSource
+ : public ThreadSafeRefCounted<RealtimeOutgoingVideoSource, WTF::DestructionThread::Main>
+ , public webrtc::VideoTrackSourceInterface
+ , private MediaStreamTrackPrivate::Observer
+#if !RELEASE_LOG_DISABLED
+ , private LoggerHelper
+#endif
+{
public:
static Ref<RealtimeOutgoingVideoSource> create(Ref<MediaStreamTrackPrivate>&& videoSource);
~RealtimeOutgoingVideoSource();
@@ -64,6 +72,10 @@
void setApplyRotation(bool shouldApplyRotation) { m_shouldApplyRotation = shouldApplyRotation; }
+#if !RELEASE_LOG_DISABLED
+ void setLogger(Ref<const Logger>&& logger) { m_logger = WTFMove(logger); }
+#endif
+
protected:
explicit RealtimeOutgoingVideoSource(Ref<MediaStreamTrackPrivate>&&);
@@ -75,6 +87,14 @@
bool m_shouldApplyRotation { false };
webrtc::VideoRotation m_currentRotation { webrtc::kVideoRotation_0 };
+#if !RELEASE_LOG_DISABLED
+ // LoggerHelper API
+ const Logger& logger() const final;
+ const void* logIdentifier() const final { return m_logIdentifier; }
+ const char* logClassName() const final { return "RealtimeOutgoingVideoSource"; }
+ WTFLogChannel& logChannel() const final;
+#endif
+
private:
void sendBlackFramesIfNeeded();
void sendOneBlackFrame();
@@ -123,6 +143,11 @@
bool m_muted { false };
uint32_t m_width { 0 };
uint32_t m_height { 0 };
+
+#if !RELEASE_LOG_DISABLED
+ mutable RefPtr<const Logger> m_logger;
+ const void* m_logIdentifier;
+#endif
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp (240119 => 240120)
--- trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp 2019-01-17 19:15:57 UTC (rev 240119)
+++ trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp 2019-01-17 19:23:45 UTC (rev 240120)
@@ -33,6 +33,7 @@
#include "AudioStreamDescription.h"
#include "CAAudioStreamDescription.h"
#include "LibWebRTCAudioFormat.h"
+#include "Logging.h"
#include "WebAudioBufferList.h"
#include "WebAudioSourceProviderAVFObjC.h"
#include <pal/avfoundation/MediaTimeAVFoundation.h>
@@ -85,6 +86,11 @@
else
memcpy(audioBufferList.buffer(0)->mData, audioData, audioBufferList.buffer(0)->mDataByteSize);
+#if !RELEASE_LOG_DISABLED
+ if (!(++m_chunksReceived % 200))
+ ALWAYS_LOG(LOGIDENTIFIER, "chunk ", m_chunksReceived);
+#endif
+
audioSamplesAvailable(mediaTime, audioBufferList, CAAudioStreamDescription(newDescription), numberOfFrames);
}
Modified: trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.h (240119 => 240120)
--- trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.h 2019-01-17 19:15:57 UTC (rev 240119)
+++ trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.h 2019-01-17 19:23:45 UTC (rev 240120)
@@ -50,6 +50,10 @@
void OnData(const void* audioData, int bitsPerSample, int sampleRate, size_t numberOfChannels, size_t numberOfFrames) final;
uint64_t m_numberOfFrames { 0 };
+
+#if !RELEASE_LOG_DISABLED
+ size_t m_chunksReceived { 0 };
+#endif
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm (240119 => 240120)
--- trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm 2019-01-17 19:15:57 UTC (rev 240119)
+++ trunk/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm 2019-01-17 19:23:45 UTC (rev 240120)
@@ -113,7 +113,7 @@
auto status = CVPixelBufferPoolCreate(kCFAllocatorDefault, nullptr, (__bridge CFDictionaryRef)pixelAttributes, &pool);
if (status != kCVReturnSuccess) {
- RELEASE_LOG(MediaStream, "RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame failed creating a pixel buffer pool with error %d", status);
+ ERROR_LOG(LOGIDENTIFIER, "Failed creating a pixel buffer pool with error ", status);
return nullptr;
}
m_pixelBufferPool = adoptCF(pool);
@@ -144,7 +144,7 @@
auto status = CVPixelBufferPoolCreatePixelBuffer(kCFAllocatorDefault, m_pixelBufferPool.get(), &pixelBuffer);
if (status != kCVReturnSuccess) {
- RELEASE_LOG(MediaStream, "RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame failed creating a pixel buffer with error %d", status);
+ ERROR_LOG(LOGIDENTIFIER, "Failed creating a pixel buffer with error ", status);
return nullptr;
}
newPixelBuffer = adoptCF(pixelBuffer);
@@ -158,13 +158,13 @@
return;
#if !RELEASE_LOG_DISABLED
- if (!(++m_numberOfFrames % 30))
- RELEASE_LOG(MediaStream, "RealtimeIncomingVideoSourceCocoa::OnFrame %zu frame", m_numberOfFrames);
+ if (!(++m_numberOfFrames % 60))
+ ALWAYS_LOG(LOGIDENTIFIER, "frame ", m_numberOfFrames);
#endif
auto pixelBuffer = pixelBufferFromVideoFrame(frame);
if (!pixelBuffer) {
- LOG_ERROR("Failed to get a pixel buffer from a frame");
+ ERROR_LOG(LOGIDENTIFIER, "Failed to get a pixel buffer from a frame");
return;
}
@@ -178,7 +178,7 @@
CMVideoFormatDescriptionRef formatDescription;
OSStatus ostatus = CMVideoFormatDescriptionCreateForImageBuffer(kCFAllocatorDefault, (CVImageBufferRef)pixelBuffer, &formatDescription);
if (ostatus != noErr) {
- LOG_ERROR("Failed to initialize CMVideoFormatDescription: %d", static_cast<int>(ostatus));
+ ERROR_LOG(LOGIDENTIFIER, "Failed to initialize CMVideoFormatDescription with error ", static_cast<int>(ostatus));
return;
}
@@ -186,7 +186,7 @@
ostatus = CMSampleBufferCreateReadyWithImageBuffer(kCFAllocatorDefault, (CVImageBufferRef)pixelBuffer, formatDescription, &timingInfo, &sampleBuffer);
CFRelease(formatDescription);
if (ostatus != noErr) {
- LOG_ERROR("Failed to create the sample buffer: %d", static_cast<int>(ostatus));
+ ERROR_LOG(LOGIDENTIFIER, "Failed to create the sample buffer with error ", static_cast<int>(ostatus));
return;
}
Modified: trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp (240119 => 240120)
--- trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp 2019-01-17 19:15:57 UTC (rev 240119)
+++ trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp 2019-01-17 19:23:45 UTC (rev 240120)
@@ -31,6 +31,7 @@
#include "CAAudioStreamDescription.h"
#include "LibWebRTCAudioFormat.h"
#include "LibWebRTCProvider.h"
+#include "Logging.h"
namespace WebCore {
Modified: trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp (240119 => 240120)
--- trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp 2019-01-17 19:15:57 UTC (rev 240119)
+++ trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp 2019-01-17 19:23:45 UTC (rev 240120)
@@ -67,8 +67,8 @@
return;
#if !RELEASE_LOG_DISABLED
- if (!(++m_numberOfFrames % 30))
- RELEASE_LOG(MediaStream, "RealtimeOutgoingVideoSourceCocoa::sendFrame %zu frame", m_numberOfFrames);
+ if (!(++m_numberOfFrames % 60))
+ ALWAYS_LOG(LOGIDENTIFIER, "frame ", m_numberOfFrames);
#endif
switch (sample.videoRotation()) {
Modified: trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm (240119 => 240120)
--- trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm 2019-01-17 19:15:57 UTC (rev 240119)
+++ trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm 2019-01-17 19:23:45 UTC (rev 240120)
@@ -75,7 +75,7 @@
VTImageRotationSessionRef rawRotationSession = nullptr;
auto status = VTImageRotationSessionCreate(kCFAllocatorDefault, rotation, &rawRotationSession);
if (status != noErr) {
- RELEASE_LOG(MediaStream, "RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer failed creating a rotation session with error %d", status);
+ ALWAYS_LOG(LOGIDENTIFIER, "Failed creating a rotation session with error ", status);
return nullptr;
}
@@ -100,7 +100,7 @@
auto status = CVPixelBufferPoolCreate(kCFAllocatorDefault, nullptr, (__bridge CFDictionaryRef)pixelAttributes, &pool);
if (status != kCVReturnSuccess) {
- RELEASE_LOG(MediaStream, "RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer failed creating a pixel buffer pool with error %d", status);
+ ALWAYS_LOG(LOGIDENTIFIER, "Failed creating a pixel buffer pool with error ", status);
return nullptr;
}
m_rotationPool = adoptCF(pool);
@@ -114,7 +114,7 @@
auto status = CVPixelBufferPoolCreatePixelBuffer(kCFAllocatorDefault, m_rotationPool.get(), &rawRotatedBuffer);
if (status != kCVReturnSuccess) {
- RELEASE_LOG(MediaStream, "RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer failed creating a pixel buffer with error %d", status);
+ ALWAYS_LOG(LOGIDENTIFIER, "Failed creating a pixel buffer with error ", status);
return nullptr;
}
RetainPtr<CVPixelBufferRef> rotatedBuffer = adoptCF(rawRotatedBuffer);
@@ -122,7 +122,7 @@
status = VTImageRotationSessionTransferImage(m_rotationSession.get(), pixelBuffer, rotatedBuffer.get());
if (status != noErr) {
- RELEASE_LOG(MediaStream, "RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer failed rotating with error %d", status);
+ ALWAYS_LOG(LOGIDENTIFIER, "Failed rotating with error ", status);
return nullptr;
}
return rotatedBuffer;