WebKit Bugzilla
Attachment 359312 Details for
Bug 185545
: Add release logging for incoming and outgoing webrtc audio tracks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-185545-20190116144651.patch (text/plain), 32.11 KB, created by
youenn fablet
on 2019-01-16 14:46:52 PST
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2019-01-16 14:46:52 PST
Size:
32.11 KB
patch
obsolete
>Subversion Revision: 240051 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 8b3cef233bd6b951eccb0e2ca85b4a10071b436b..ec975905020493be7015204f0d2722b4c356d606 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,61 @@ >+2019-01-15 Youenn Fablet <youenn@apple.com> >+ >+ 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-16 Youenn Fablet <youenn@apple.com> > > ServiceWorkerContainer is leaking due to a ref cycle >diff --git a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp >index ad820957c1a6a356e543d7f76b4c3ac52772dd2d..3db42ae15e7ec8e09a7b6290034f8f2fb50a8239 100644 >--- a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp >+++ b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp >@@ -219,12 +219,18 @@ bool LibWebRTCMediaEndpoint::addTrack(LibWebRTCRtpSenderBackend& sender, MediaSt > 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; > } > 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 void setExistingReceiverSourceTrack(RealtimeMediaSource& existingS > } > } > >-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 @@ static inline RefPtr<RealtimeMediaSource> sourceFromNewReceiver(webrtc::RtpRecei > 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; > } > } > >diff --git a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h >index 19e856c0887725f7a2fc0dc8f0318b8814eeca13..f8cb8b921d4ce892c2823c327dce650405ce4dd1 100644 >--- a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h >+++ b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h >@@ -167,6 +167,7 @@ private: > } > > 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(); } >diff --git a/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.cpp b/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.cpp >index 74ad296e17c6b26cc30dfa5462d6defba644b905..fe0ddd7972032ab63791dcd7cf5d33b84f170d20 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.cpp >+++ b/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.cpp >@@ -34,12 +34,17 @@ > #if USE(LIBWEBRTC) > > #include "LibWebRTCAudioFormat.h" >+#include "Logging.h" >+#include <wtf/CryptographicallyRandomNumber.h> > > namespace WebCore { > > 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 @@ const RealtimeMediaSourceSettings& RealtimeIncomingAudioSource::settings() > 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) >diff --git a/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.h b/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.h >index 27549f1cf2086735491b7e678ab790c1db50d3aa..bd354592e5fad6445ea4a09e0a0d984b9c7ab644 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.h >+++ b/Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.h >@@ -41,20 +41,37 @@ ALLOW_UNUSED_PARAMETERS_BEGIN > > 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>&&); > >+ void setLogger(Ref<const Logger>&& logger) { m_logger = WTFMove(logger); } >+ > 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 +87,11 @@ private: > > 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 >diff --git a/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp b/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp >index 9c75281c0e164642ddb81de20f94f0e5de627479..1446b3fc1749b0668af3b1300c87dd6a9b6c7acd 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp >+++ b/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp >@@ -34,12 +34,16 @@ > #if USE(LIBWEBRTC) > > #include "Logging.h" >+#include <wtf/CryptographicallyRandomNumber.h> > > namespace WebCore { > > 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 @@ void RealtimeIncomingVideoSource::settingsDidChange(OptionSet<RealtimeMediaSourc > 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) >diff --git a/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.h b/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.h >index 4ac4d85645f1ab8a2ff8cbef52aca905aa6599b9..6f990060dcf5616cd8343d5938ec2d888826c63f 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.h >+++ b/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.h >@@ -41,13 +41,20 @@ ALLOW_UNUSED_PARAMETERS_BEGIN > > ALLOW_UNUSED_PARAMETERS_END > >+#include <wtf/LoggerHelper.h> > #include <wtf/RetainPtr.h> > > namespace WebCore { > > 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,19 @@ public: > > void setSourceTrack(rtc::scoped_refptr<webrtc::VideoTrackInterface>&&); > >+ void setLogger(Ref<const Logger>&& logger) { m_logger = WTFMove(logger); } >+ > 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 +90,11 @@ private: > > 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 >diff --git a/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.cpp b/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.cpp >index 0d07428af689a26c1834df1eef3e4c1a1d4cfcd1..03b9496efcc64f503867f0abecdf9a898dd797d1 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.cpp >+++ b/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.cpp >@@ -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::RemoveSink(webrtc::AudioTrackSinkInterface* si > > 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) >diff --git a/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.h b/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.h >index b03bf21b276eaed7ef9a452c1f192ff313151152..8c0a8242d25a5ceae28a4ef3aa94fddc4f851566 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.h >+++ b/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.h >@@ -41,6 +41,7 @@ ALLOW_UNUSED_PARAMETERS_BEGIN > > ALLOW_UNUSED_PARAMETERS_END > >+#include <wtf/LoggerHelper.h> > #include <wtf/ThreadSafeRefCounted.h> > > namespace webrtc { >@@ -50,7 +51,14 @@ class AudioTrackSinkInterface; > > 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,8 @@ public: > bool setSource(Ref<MediaStreamTrackPrivate>&&); > MediaStreamTrackPrivate& source() const { return m_audioSource.get(); } > >+ void setLogger(Ref<const Logger>&& logger) { m_logger = WTFMove(logger); } >+ > protected: > explicit RealtimeOutgoingAudioSource(Ref<MediaStreamTrackPrivate>&&); > >@@ -72,6 +82,14 @@ protected: > > 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 +133,12 @@ private: > > 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 >diff --git a/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.cpp b/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.cpp >index e8d321663f4a92a3204836feb4767027f898127a..64b4e9e2e4b1742df22285c572f748992ed1f331 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.cpp >+++ b/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.cpp >@@ -40,6 +40,7 @@ ALLOW_UNUSED_PARAMETERS_BEGIN > > ALLOW_UNUSED_PARAMETERS_END > >+#include <wtf/CryptographicallyRandomNumber.h> > #include <wtf/MainThread.h> > > namespace WebCore { >@@ -47,6 +48,9 @@ namespace WebCore { > 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 @@ void RealtimeOutgoingVideoSource::sendBlackFramesIfNeeded() > 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::sendBlackFramesIfNeeded() > > void RealtimeOutgoingVideoSource::sendOneBlackFrame() > { >- RELEASE_LOG(MediaStream, "RealtimeOutgoingVideoSource::sendOneBlackFrame"); >+ ALWAYS_LOG(LOGIDENTIFIER, "test"); > sendFrame(rtc::scoped_refptr<webrtc::VideoFrameBuffer>(m_blackFrame)); > } > >@@ -210,6 +214,20 @@ void RealtimeOutgoingVideoSource::sendFrame(rtc::scoped_refptr<webrtc::VideoFram > 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) >diff --git a/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h b/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h >index f37e417a0535a513a7245b3bc99855d62269d6bb..d5fa14334404d0a7a4f869cc3c7ddc0d523b3b18 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h >+++ b/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h >@@ -41,12 +41,20 @@ ALLOW_UNUSED_PARAMETERS_BEGIN > > 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,8 @@ public: > > void setApplyRotation(bool shouldApplyRotation) { m_shouldApplyRotation = shouldApplyRotation; } > >+ void setLogger(Ref<const Logger>&& logger) { m_logger = WTFMove(logger); } >+ > protected: > explicit RealtimeOutgoingVideoSource(Ref<MediaStreamTrackPrivate>&&); > >@@ -75,6 +85,14 @@ protected: > 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 +141,11 @@ private: > 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 >diff --git a/Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp b/Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp >index 22fb12561e8b9170f2f0ac9c47dfedcaaae5cb87..632ef0bc114a216680a55ffc18cdedd4a3963a89 100644 >--- a/Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp >+++ b/Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp >@@ -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 @@ void RealtimeIncomingAudioSourceCocoa::OnData(const void* audioData, int bitsPer > 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); > } > >diff --git a/Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.h b/Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.h >index d010475e5eca2ffc914303471b65fb1a897daba7..3725688a1a8aeec4dd03d8adc2d112c748630996 100644 >--- a/Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.h >+++ b/Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.h >@@ -50,6 +50,10 @@ private: > 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 >diff --git a/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm b/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm >index b09ac04f22c7bb8baed6b4a3e763cf70e6c7e054..fe5ebd6cb115ba2784f35f48883b60a5fb49ffa4 100644 >--- a/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm >+++ b/Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm >@@ -113,7 +113,7 @@ CVPixelBufferPoolRef RealtimeIncomingVideoSourceCocoa::pixelBufferPool(size_t wi > 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 @@ RetainPtr<CVPixelBufferRef> RealtimeIncomingVideoSourceCocoa::pixelBufferFromVid > 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 @@ void RealtimeIncomingVideoSourceCocoa::OnFrame(const webrtc::VideoFrame& frame) > 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 @@ void RealtimeIncomingVideoSourceCocoa::OnFrame(const webrtc::VideoFrame& frame) > 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 @@ void RealtimeIncomingVideoSourceCocoa::OnFrame(const webrtc::VideoFrame& frame) > 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; > } > >diff --git a/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp b/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp >index 22e49e909895a903d7232e052fc51e880fd82f06..ed570aa478b454f2bf812a2f6a5fe38b31bd503a 100644 >--- a/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp >+++ b/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp >@@ -31,6 +31,7 @@ > #include "CAAudioStreamDescription.h" > #include "LibWebRTCAudioFormat.h" > #include "LibWebRTCProvider.h" >+#include "Logging.h" > > namespace WebCore { > >diff --git a/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp b/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp >index 7981e71be95f155d71da2140c4f993a873f9803a..7c2c8f310ed5845b5ebaf90074b8f4cda37fa9cd 100644 >--- a/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp >+++ b/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp >@@ -67,8 +67,8 @@ void RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated(MediaStreamTrackPriva > 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()) { >diff --git a/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm b/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm >index d550864aeb136eec14e681718e417f2634abb0a7..5e7e12492b4657c83f9e45d36eddb017ce5241bf 100644 >--- a/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm >+++ b/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm >@@ -75,7 +75,7 @@ RetainPtr<CVPixelBufferRef> RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer( > 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 @@ RetainPtr<CVPixelBufferRef> RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer( > 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 @@ RetainPtr<CVPixelBufferRef> RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer( > 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 @@ RetainPtr<CVPixelBufferRef> RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer( > 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;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185545
:
340185
|
340186
|
359311
|
359312
|
359374