diff --git a/dom/media/AudioStream.cpp b/dom/media/AudioStream.cpp index 93cf584d1be2..2277b37b5cd5 100644 --- a/dom/media/AudioStream.cpp +++ b/dom/media/AudioStream.cpp @@ -25,7 +25,7 @@ namespace mozilla { #undef LOG #endif -LazyLogModule gAudioStreamLog("AudioStream"); +PRLogModuleInfo* gAudioStreamLog = nullptr; // For simple logs #define LOG(x) MOZ_LOG(gAudioStreamLog, mozilla::LogLevel::Debug, x) diff --git a/dom/media/CubebUtils.cpp b/dom/media/CubebUtils.cpp index d9cfcc19dcf5..59e03ac10223 100644 --- a/dom/media/CubebUtils.cpp +++ b/dom/media/CubebUtils.cpp @@ -40,7 +40,7 @@ uint32_t sPreferredSampleRate; } // namespace -extern LazyLogModule gAudioStreamLog; +extern PRLogModuleInfo* gAudioStreamLog; static const uint32_t CUBEB_NORMAL_LATENCY_MS = 100; @@ -126,6 +126,7 @@ bool CubebLatencyPrefSet() void InitLibrary() { + gAudioStreamLog = PR_NewLogModule("AudioStream"); PrefChanged(PREF_VOLUME_SCALE, nullptr); Preferences::RegisterCallback(PrefChanged, PREF_VOLUME_SCALE); PrefChanged(PREF_CUBEB_LATENCY, nullptr); diff --git a/dom/media/DOMMediaStream.cpp b/dom/media/DOMMediaStream.cpp index ca4e9ea53872..08a700927cd2 100644 --- a/dom/media/DOMMediaStream.cpp +++ b/dom/media/DOMMediaStream.cpp @@ -27,13 +27,13 @@ #undef LOG #endif +static PRLogModuleInfo* gMediaStreamLog; +#define LOG(type, msg) MOZ_LOG(gMediaStreamLog, type, msg) + using namespace mozilla; using namespace mozilla::dom; using namespace mozilla::layers; -static LazyLogModule gMediaStreamLog("MediaStream"); -#define LOG(type, msg) MOZ_LOG(gMediaStreamLog, type, msg) - const TrackID TRACK_VIDEO_PRIMARY = 1; @@ -318,6 +318,10 @@ DOMMediaStream::DOMMediaStream() nsCOMPtr uuidgen = do_GetService("@mozilla.org/uuid-generator;1", &rv); + if (!gMediaStreamLog) { + gMediaStreamLog = PR_NewLogModule("MediaStream"); + } + if (NS_SUCCEEDED(rv) && uuidgen) { nsID uuid; memset(&uuid, 0, sizeof(uuid)); diff --git a/dom/media/GraphDriver.cpp b/dom/media/GraphDriver.cpp index e3cdacad5bb0..4479ca5129a6 100644 --- a/dom/media/GraphDriver.cpp +++ b/dom/media/GraphDriver.cpp @@ -10,7 +10,7 @@ #include #endif -extern mozilla::LazyLogModule gMediaStreamGraphLog; +extern PRLogModuleInfo* gMediaStreamGraphLog; #define STREAM_LOG(type, msg) MOZ_LOG(gMediaStreamGraphLog, type, msg) // We don't use NSPR log here because we want this interleaved with adb logcat diff --git a/dom/media/Latency.cpp b/dom/media/Latency.cpp index d3400777ad0f..870bc99c98a5 100644 --- a/dom/media/Latency.cpp +++ b/dom/media/Latency.cpp @@ -37,13 +37,17 @@ const char* LatencyLogIndex2Strings[] = { static StaticRefPtr gAsyncLogger; -LogModule* +PRLogModuleInfo* GetLatencyLog() { - static LazyLogModule sLog("MediaLatency"); + static PRLogModuleInfo* sLog; + if (!sLog) { + sLog = PR_NewLogModule("MediaLatency"); + } return sLog; } + class LogEvent : public nsRunnable { public: @@ -107,8 +111,6 @@ void LogLatency(uint32_t aIndex, uint64_t aID, int64_t aValue) void AsyncLatencyLogger::InitializeStatics() { NS_ASSERTION(NS_IsMainThread(), "Main thread only"); - - //Make sure that the underlying logger is allocated. GetLatencyLog(); gAsyncLogger = new AsyncLatencyLogger(); } diff --git a/dom/media/Latency.h b/dom/media/Latency.h index b86ee7b54b21..e7a83d78b8cf 100644 --- a/dom/media/Latency.h +++ b/dom/media/Latency.h @@ -17,7 +17,7 @@ class AsyncLatencyLogger; -mozilla::LogModule* GetLatencyLog(); +PRLogModuleInfo* GetLatencyLog(); // This class is a singleton. It is refcounted. class AsyncLatencyLogger : public nsIObserver diff --git a/dom/media/MP3Demuxer.cpp b/dom/media/MP3Demuxer.cpp index f7ce9ae7011c..d3a9c4dcfd78 100644 --- a/dom/media/MP3Demuxer.cpp +++ b/dom/media/MP3Demuxer.cpp @@ -16,7 +16,7 @@ #include "prenv.h" #ifdef PR_LOGGING -mozilla::LazyLogModule gMP3DemuxerLog("MP3Demuxer"); +PRLogModuleInfo* gMP3DemuxerLog; #define MP3LOG(msg, ...) \ MOZ_LOG(gMP3DemuxerLog, LogLevel::Debug, ("MP3Demuxer " msg, ##__VA_ARGS__)) #define MP3LOGV(msg, ...) \ @@ -112,6 +112,12 @@ MP3TrackDemuxer::MP3TrackDemuxer(MediaResource* aSource) , mChannels(0) { Reset(); + +#ifdef PR_LOGGING + if (!gMP3DemuxerLog) { + gMP3DemuxerLog = PR_NewLogModule("MP3Demuxer"); + } +#endif } bool diff --git a/dom/media/MediaCache.cpp b/dom/media/MediaCache.cpp index ce39cce3d91c..da69a7e00f66 100644 --- a/dom/media/MediaCache.cpp +++ b/dom/media/MediaCache.cpp @@ -24,7 +24,7 @@ namespace mozilla { -LazyLogModule gMediaCacheLog("MediaCache"); +PRLogModuleInfo* gMediaCacheLog; #define CACHE_LOG(type, msg) MOZ_LOG(gMediaCacheLog, type, msg) // Readahead blocks for non-seekable streams will be limited to this @@ -580,6 +580,10 @@ MediaCache::Init() rv = mFileCache->Open(fileDesc); NS_ENSURE_SUCCESS(rv,rv); + if (!gMediaCacheLog) { + gMediaCacheLog = PR_NewLogModule("MediaCache"); + } + MediaCacheFlusher::Init(); return NS_OK; diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index 1b6aef466127..c9b676dae689 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -46,7 +46,7 @@ static const uint64_t ESTIMATED_DURATION_FUZZ_FACTOR_USECS = USECS_PER_S / 2; // avoid redefined macro in unified build #undef DECODER_LOG -LazyLogModule gMediaDecoderLog("MediaDecoder"); +PRLogModuleInfo* gMediaDecoderLog; #define DECODER_LOG(x, ...) \ MOZ_LOG(gMediaDecoderLog, LogLevel::Debug, ("Decoder=%p " x, this, ##__VA_ARGS__)) @@ -113,14 +113,21 @@ public: StaticRefPtr MediaMemoryTracker::sUniqueInstance; #if defined(PR_LOGGING) -LazyLogModule gMediaTimerLog("MediaTimer"); -LazyLogModule gMediaSampleLog("MediaSample"); +PRLogModuleInfo* gMediaTimerLog; +PRLogModuleInfo* gMediaSampleLog; #endif void MediaDecoder::InitStatics() { MOZ_ASSERT(NS_IsMainThread()); + +#if defined(PR_LOGGING) + // Log modules. + gMediaDecoderLog = PR_NewLogModule("MediaDecoder"); + gMediaTimerLog = PR_NewLogModule("MediaTimer"); + gMediaSampleLog = PR_NewLogModule("MediaSample"); +#endif } NS_IMPL_ISUPPORTS(MediaMemoryTracker, nsIMemoryReporter) diff --git a/dom/media/MediaDecoderReader.cpp b/dom/media/MediaDecoderReader.cpp index 7b958e31bdd2..402c72f0fab7 100644 --- a/dom/media/MediaDecoderReader.cpp +++ b/dom/media/MediaDecoderReader.cpp @@ -22,7 +22,7 @@ namespace mozilla { // Un-comment to enable logging of seek bisections. //#define SEEK_LOGGING -extern LazyLogModule gMediaDecoderLog; +extern PRLogModuleInfo* gMediaDecoderLog; #define DECODER_LOG(x, ...) \ MOZ_LOG(gMediaDecoderLog, LogLevel::Debug, ("Decoder=%p " x, mDecoder, ##__VA_ARGS__)) diff --git a/dom/media/MediaDecoderStateMachine.h b/dom/media/MediaDecoderStateMachine.h index f8977bc3016f..fa994d26410d 100644 --- a/dom/media/MediaDecoderStateMachine.h +++ b/dom/media/MediaDecoderStateMachine.h @@ -107,8 +107,8 @@ class AudioSegment; class DecodedStream; class TaskQueue; -extern LazyLogModule gMediaDecoderLog; -extern LazyLogModule gMediaSampleLog; +extern PRLogModuleInfo* gMediaDecoderLog; +extern PRLogModuleInfo* gMediaSampleLog; /* The state machine class. This manages the decoding and seeking in the diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index 2ac3e151f40e..29c9fcf4be2d 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -28,10 +28,15 @@ using mozilla::layers::Image; using mozilla::layers::LayerManager; using mozilla::layers::LayersBackend; -static mozilla::LazyLogModule sFormatDecoderLog("MediaFormatReader"); - -#define LOG(arg, ...) MOZ_LOG(sFormatDecoderLog, mozilla::LogLevel::Debug, ("MediaFormatReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) -#define LOGV(arg, ...) MOZ_LOG(sFormatDecoderLog, mozilla::LogLevel::Verbose, ("MediaFormatReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) +PRLogModuleInfo* GetFormatDecoderLog() { + static PRLogModuleInfo* log = nullptr; + if (!log) { + log = PR_NewLogModule("MediaFormatReader"); + } + return log; +} +#define LOG(arg, ...) MOZ_LOG(GetFormatDecoderLog(), mozilla::LogLevel::Debug, ("MediaFormatReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) +#define LOGV(arg, ...) MOZ_LOG(GetFormatDecoderLog(), mozilla::LogLevel::Verbose, ("MediaFormatReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index 15f639838c57..00a88dae1971 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -104,10 +104,12 @@ namespace mozilla { #undef LOG #endif -LogModule* +PRLogModuleInfo* GetMediaManagerLog() { - static LazyLogModule sLog("MediaManager"); + static PRLogModuleInfo *sLog; + if (!sLog) + sLog = PR_NewLogModule("MediaManager"); return sLog; } #define LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg) diff --git a/dom/media/MediaManager.h b/dom/media/MediaManager.h index 45223fe779b9..0454f7a769af 100644 --- a/dom/media/MediaManager.h +++ b/dom/media/MediaManager.h @@ -51,7 +51,7 @@ struct MediaTrackConstraints; struct MediaTrackConstraintSet; } // namespace dom -extern LogModule* GetMediaManagerLog(); +extern PRLogModuleInfo* GetMediaManagerLog(); #define MM_LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg) class MediaDevice : public nsIMediaDevice diff --git a/dom/media/MediaRecorder.cpp b/dom/media/MediaRecorder.cpp index 9bfbf0d3fee2..68d03d8aebb1 100644 --- a/dom/media/MediaRecorder.cpp +++ b/dom/media/MediaRecorder.cpp @@ -31,7 +31,7 @@ #undef LOG #endif -mozilla::LazyLogModule gMediaRecorderLog("MediaRecorder"); +PRLogModuleInfo* gMediaRecorderLog; #define LOG(type, msg) MOZ_LOG(gMediaRecorderLog, type, msg) namespace mozilla { @@ -776,7 +776,9 @@ MediaRecorder::MediaRecorder(DOMMediaStream& aSourceMediaStream, MOZ_ASSERT(aOwnerWindow); MOZ_ASSERT(aOwnerWindow->IsInnerWindow()); mDOMStream = &aSourceMediaStream; - + if (!gMediaRecorderLog) { + gMediaRecorderLog = PR_NewLogModule("MediaRecorder"); + } RegisterActivityObserver(); } @@ -807,7 +809,9 @@ MediaRecorder::MediaRecorder(AudioNode& aSrcAudioNode, } } mAudioNode = &aSrcAudioNode; - + if (!gMediaRecorderLog) { + gMediaRecorderLog = PR_NewLogModule("MediaRecorder"); + } RegisterActivityObserver(); } diff --git a/dom/media/MediaResource.cpp b/dom/media/MediaResource.cpp index f0dfb9563fc7..22f83f02273a 100644 --- a/dom/media/MediaResource.cpp +++ b/dom/media/MediaResource.cpp @@ -36,7 +36,7 @@ using mozilla::media::TimeUnit; -mozilla::LazyLogModule gMediaResourceLog("MediaResource"); +PRLogModuleInfo* gMediaResourceLog; #define RESOURCE_LOG(msg, ...) MOZ_LOG(gMediaResourceLog, mozilla::LogLevel::Debug, \ (msg, ##__VA_ARGS__)) // Debug logging macro with object pointer and class name. @@ -79,6 +79,9 @@ ChannelMediaResource::ChannelMediaResource(MediaResourceCallback* aCallback, mIsTransportSeekable(true), mSuspendAgent(mChannel) { + if (!gMediaResourceLog) { + gMediaResourceLog = PR_NewLogModule("MediaResource"); + } } ChannelMediaResource::~ChannelMediaResource() diff --git a/dom/media/MediaShutdownManager.cpp b/dom/media/MediaShutdownManager.cpp index b55954b66440..46952f2227ee 100644 --- a/dom/media/MediaShutdownManager.cpp +++ b/dom/media/MediaShutdownManager.cpp @@ -12,7 +12,7 @@ namespace mozilla { -extern LazyLogModule gMediaDecoderLog; +extern PRLogModuleInfo* gMediaDecoderLog; #define DECODER_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) NS_IMPL_ISUPPORTS(MediaShutdownManager, nsIObserver) diff --git a/dom/media/MediaStreamGraph.cpp b/dom/media/MediaStreamGraph.cpp index 6c5f8992f624..626a6d915e76 100644 --- a/dom/media/MediaStreamGraph.cpp +++ b/dom/media/MediaStreamGraph.cpp @@ -39,7 +39,7 @@ using namespace mozilla::gfx; namespace mozilla { -LazyLogModule gMediaStreamGraphLog("MediaStreamGraph"); +PRLogModuleInfo* gMediaStreamGraphLog; #define STREAM_LOG(type, msg) MOZ_LOG(gMediaStreamGraphLog, type, msg) // #define ENABLE_LIFECYCLE_LOG @@ -2639,6 +2639,10 @@ MediaStreamGraphImpl::MediaStreamGraphImpl(GraphDriverType aDriverRequested, #endif , mAudioChannel(aChannel) { + if (!gMediaStreamGraphLog) { + gMediaStreamGraphLog = PR_NewLogModule("MediaStreamGraph"); + } + if (mRealtime) { if (aDriverRequested == AUDIO_THREAD_DRIVER) { AudioCallbackDriver* driver = new AudioCallbackDriver(this); diff --git a/dom/media/MediaStreamGraph.h b/dom/media/MediaStreamGraph.h index 724ff0c24ba3..05eb8b46c666 100644 --- a/dom/media/MediaStreamGraph.h +++ b/dom/media/MediaStreamGraph.h @@ -35,7 +35,7 @@ class nsAutoRefTraits : public nsPointerRefTraitsAsyncOpen(mListener); + if (!gRtspMediaResourceLog) { + gRtspMediaResourceLog = PR_NewLogModule("RtspMediaResource"); + } #endif } diff --git a/dom/media/StreamBuffer.cpp b/dom/media/StreamBuffer.cpp index 516982ca701b..5af63e5b01c3 100644 --- a/dom/media/StreamBuffer.cpp +++ b/dom/media/StreamBuffer.cpp @@ -9,7 +9,7 @@ namespace mozilla { -extern LazyLogModule gMediaStreamGraphLog; +extern PRLogModuleInfo* gMediaStreamGraphLog; #define STREAM_LOG(type, msg) MOZ_LOG(gMediaStreamGraphLog, type, msg) #ifdef DEBUG diff --git a/dom/media/TrackUnionStream.cpp b/dom/media/TrackUnionStream.cpp index 9325641970a3..e4e844a4380c 100644 --- a/dom/media/TrackUnionStream.cpp +++ b/dom/media/TrackUnionStream.cpp @@ -42,12 +42,15 @@ namespace mozilla { #undef STREAM_LOG #endif -LazyLogModule gTrackUnionStreamLog("TrackUnionStream"); +PRLogModuleInfo* gTrackUnionStreamLog; #define STREAM_LOG(type, msg) MOZ_LOG(gTrackUnionStreamLog, type, msg) TrackUnionStream::TrackUnionStream(DOMMediaStream* aWrapper) : ProcessedMediaStream(aWrapper), mNextAvailableTrackID(1) { + if (!gTrackUnionStreamLog) { + gTrackUnionStreamLog = PR_NewLogModule("TrackUnionStream"); + } } void TrackUnionStream::RemoveInput(MediaInputPort* aPort) diff --git a/dom/media/WebVTTListener.cpp b/dom/media/WebVTTListener.cpp index a93217ad5ed3..5727e8c71879 100644 --- a/dom/media/WebVTTListener.cpp +++ b/dom/media/WebVTTListener.cpp @@ -28,13 +28,16 @@ NS_INTERFACE_MAP_END NS_IMPL_CYCLE_COLLECTING_ADDREF(WebVTTListener) NS_IMPL_CYCLE_COLLECTING_RELEASE(WebVTTListener) -LazyLogModule gTextTrackLog("TextTrack"); +PRLogModuleInfo* gTextTrackLog; # define VTT_LOG(...) MOZ_LOG(gTextTrackLog, LogLevel::Debug, (__VA_ARGS__)) WebVTTListener::WebVTTListener(HTMLTrackElement* aElement) : mElement(aElement) { MOZ_ASSERT(mElement, "Must pass an element to the callback"); + if (!gTextTrackLog) { + gTextTrackLog = PR_NewLogModule("TextTrack"); + } VTT_LOG("WebVTTListener created."); } diff --git a/dom/media/apple/AppleMP3Reader.cpp b/dom/media/apple/AppleMP3Reader.cpp index 18bfe15a0fe5..68a6318c2802 100644 --- a/dom/media/apple/AppleMP3Reader.cpp +++ b/dom/media/apple/AppleMP3Reader.cpp @@ -23,7 +23,7 @@ using namespace mozilla::media; namespace mozilla { -extern LazyLogModule gMediaDecoderLog; +extern PRLogModuleInfo* gMediaDecoderLog; #define LOGE(...) MOZ_LOG(gMediaDecoderLog, mozilla::LogLevel::Error, (__VA_ARGS__)) #define LOGW(...) MOZ_LOG(gMediaDecoderLog, mozilla::LogLevel::Warning, (__VA_ARGS__)) #define LOGD(...) MOZ_LOG(gMediaDecoderLog, mozilla::LogLevel::Debug, (__VA_ARGS__)) diff --git a/dom/media/directshow/AudioSinkFilter.cpp b/dom/media/directshow/AudioSinkFilter.cpp index 5682af1a5876..3d2b93b46bc8 100644 --- a/dom/media/directshow/AudioSinkFilter.cpp +++ b/dom/media/directshow/AudioSinkFilter.cpp @@ -23,7 +23,7 @@ using namespace mozilla::media; namespace mozilla { -extern LogModule* GetDirectShowLog(); +PRLogModuleInfo* GetDirectShowLog(); #define LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) AudioSinkFilter::AudioSinkFilter(const wchar_t* aObjectName, HRESULT* aOutResult) diff --git a/dom/media/directshow/AudioSinkInputPin.cpp b/dom/media/directshow/AudioSinkInputPin.cpp index 285dc3ca8736..d3187c58f2a9 100644 --- a/dom/media/directshow/AudioSinkInputPin.cpp +++ b/dom/media/directshow/AudioSinkInputPin.cpp @@ -15,7 +15,7 @@ using namespace mozilla::media; namespace mozilla { -extern LogModule* GetDirectShowLog(); +PRLogModuleInfo* GetDirectShowLog(); #define LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) AudioSinkInputPin::AudioSinkInputPin(wchar_t* aObjectName, diff --git a/dom/media/directshow/DirectShowReader.cpp b/dom/media/directshow/DirectShowReader.cpp index ed6390a79e5c..b2a52850bdf5 100644 --- a/dom/media/directshow/DirectShowReader.cpp +++ b/dom/media/directshow/DirectShowReader.cpp @@ -18,9 +18,13 @@ using namespace mozilla::media; namespace mozilla { -LogModule* + +PRLogModuleInfo* GetDirectShowLog() { - static LazyLogModule log("DirectShowDecoder"); + static PRLogModuleInfo* log = nullptr; + if (!log) { + log = PR_NewLogModule("DirectShowDecoder"); + } return log; } diff --git a/dom/media/directshow/SampleSink.cpp b/dom/media/directshow/SampleSink.cpp index 1102d32f5a38..54b62508d265 100644 --- a/dom/media/directshow/SampleSink.cpp +++ b/dom/media/directshow/SampleSink.cpp @@ -14,7 +14,7 @@ using namespace mozilla::media; namespace mozilla { -extern LogModule* GetDirectShowLog(); +PRLogModuleInfo* GetDirectShowLog(); #define LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) SampleSink::SampleSink() diff --git a/dom/media/directshow/SourceFilter.cpp b/dom/media/directshow/SourceFilter.cpp index e563b49cf608..3eb11ea4b8b5 100644 --- a/dom/media/directshow/SourceFilter.cpp +++ b/dom/media/directshow/SourceFilter.cpp @@ -20,7 +20,7 @@ namespace mozilla { //#define DEBUG_SOURCE_TRACE 1 #if defined (DEBUG_SOURCE_TRACE) -extern LogModule* GetDirectShowLog(); +PRLogModuleInfo* GetDirectShowLog(); #define DIRECTSHOW_LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) #else #define DIRECTSHOW_LOG(...) diff --git a/dom/media/eme/EMEUtils.cpp b/dom/media/eme/EMEUtils.cpp index b89879a6f8ec..5d0af6f71791 100644 --- a/dom/media/eme/EMEUtils.cpp +++ b/dom/media/eme/EMEUtils.cpp @@ -8,13 +8,19 @@ namespace mozilla { -LogModule* GetEMELog() { - static LazyLogModule log("EME"); +PRLogModuleInfo* GetEMELog() { + static PRLogModuleInfo* log = nullptr; + if (!log) { + log = PR_NewLogModule("EME"); + } return log; } -LogModule* GetEMEVerboseLog() { - static LazyLogModule log("EMEV"); +PRLogModuleInfo* GetEMEVerboseLog() { + static PRLogModuleInfo* log = nullptr; + if (!log) { + log = PR_NewLogModule("EMEV"); + } return log; } diff --git a/dom/media/eme/EMEUtils.h b/dom/media/eme/EMEUtils.h index 6768213b5d90..a8fde65f8532 100644 --- a/dom/media/eme/EMEUtils.h +++ b/dom/media/eme/EMEUtils.h @@ -13,13 +13,13 @@ namespace mozilla { #ifndef EME_LOG - LogModule* GetEMELog(); + PRLogModuleInfo* GetEMELog(); #define EME_LOG(...) MOZ_LOG(GetEMELog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) #define EME_LOG_ENABLED() MOZ_LOG_TEST(GetEMELog(), mozilla::LogLevel::Debug) #endif #ifndef EME_VERBOSE_LOG - LogModule* GetEMEVerboseLog(); + PRLogModuleInfo* GetEMEVerboseLog(); #define EME_VERBOSE_LOG(...) MOZ_LOG(GetEMEVerboseLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) #else #ifndef EME_LOG diff --git a/dom/media/encoder/MediaEncoder.cpp b/dom/media/encoder/MediaEncoder.cpp index 2d37598c40f8..4a7b26ba7df5 100644 --- a/dom/media/encoder/MediaEncoder.cpp +++ b/dom/media/encoder/MediaEncoder.cpp @@ -31,7 +31,7 @@ #undef LOG #endif -mozilla::LazyLogModule gMediaEncoderLog("MediaEncoder"); +PRLogModuleInfo* gMediaEncoderLog; #define LOG(type, msg) MOZ_LOG(gMediaEncoderLog, type, msg) namespace mozilla { @@ -79,6 +79,9 @@ MediaEncoder::CreateEncoder(const nsAString& aMIMEType, uint32_t aAudioBitrate, uint32_t aVideoBitrate, uint32_t aBitrate, uint8_t aTrackTypes) { + if (!gMediaEncoderLog) { + gMediaEncoderLog = PR_NewLogModule("MediaEncoder"); + } PROFILER_LABEL("MediaEncoder", "CreateEncoder", js::ProfileEntry::Category::OTHER); diff --git a/dom/media/encoder/TrackEncoder.cpp b/dom/media/encoder/TrackEncoder.cpp index 7e2161a0c590..c617980a1401 100644 --- a/dom/media/encoder/TrackEncoder.cpp +++ b/dom/media/encoder/TrackEncoder.cpp @@ -18,7 +18,7 @@ namespace mozilla { -LazyLogModule gTrackEncoderLog("TrackEncoder"); +PRLogModuleInfo* gTrackEncoderLog; #define TRACK_LOG(type, msg) MOZ_LOG(gTrackEncoderLog, type, msg) static const int DEFAULT_CHANNELS = 1; @@ -37,6 +37,9 @@ TrackEncoder::TrackEncoder() , mAudioInitCounter(0) , mVideoInitCounter(0) { + if (!gTrackEncoderLog) { + gTrackEncoderLog = PR_NewLogModule("TrackEncoder"); + } } void diff --git a/dom/media/encoder/VP8TrackEncoder.cpp b/dom/media/encoder/VP8TrackEncoder.cpp index 48a33a4d19a4..f318cc9ca475 100644 --- a/dom/media/encoder/VP8TrackEncoder.cpp +++ b/dom/media/encoder/VP8TrackEncoder.cpp @@ -17,7 +17,7 @@ namespace mozilla { -LazyLogModule gVP8TrackEncoderLog("VP8TrackEncoder"); +PRLogModuleInfo* gVP8TrackEncoderLog; #define VP8LOG(msg, ...) MOZ_LOG(gVP8TrackEncoderLog, mozilla::LogLevel::Debug, \ (msg, ##__VA_ARGS__)) // Debug logging macro with object pointer and class name. @@ -37,6 +37,9 @@ VP8TrackEncoder::VP8TrackEncoder() , mVPXImageWrapper(new vpx_image_t()) { MOZ_COUNT_CTOR(VP8TrackEncoder); + if (!gVP8TrackEncoderLog) { + gVP8TrackEncoderLog = PR_NewLogModule("VP8TrackEncoder"); + } } VP8TrackEncoder::~VP8TrackEncoder() diff --git a/dom/media/encoder/VorbisTrackEncoder.cpp b/dom/media/encoder/VorbisTrackEncoder.cpp index 3a1c153bd513..c22b3e05600d 100644 --- a/dom/media/encoder/VorbisTrackEncoder.cpp +++ b/dom/media/encoder/VorbisTrackEncoder.cpp @@ -17,7 +17,7 @@ static const float BASE_QUALITY = 0.4f; namespace mozilla { #undef LOG -LazyLogModule gVorbisTrackEncoderLog("VorbisTrackEncoder"); +PRLogModuleInfo* gVorbisTrackEncoderLog; #define VORBISLOG(msg, ...) MOZ_LOG(gVorbisTrackEncoderLog, mozilla::LogLevel::Debug, \ (msg, ##__VA_ARGS__)) @@ -25,6 +25,9 @@ VorbisTrackEncoder::VorbisTrackEncoder() : AudioTrackEncoder() { MOZ_COUNT_CTOR(VorbisTrackEncoder); + if (!gVorbisTrackEncoderLog) { + gVorbisTrackEncoderLog = PR_NewLogModule("VorbisTrackEncoder"); + } } VorbisTrackEncoder::~VorbisTrackEncoder() diff --git a/dom/media/fmp4/MP4Demuxer.cpp b/dom/media/fmp4/MP4Demuxer.cpp index 6c11eca7bbb1..d281594181af 100644 --- a/dom/media/fmp4/MP4Demuxer.cpp +++ b/dom/media/fmp4/MP4Demuxer.cpp @@ -20,8 +20,11 @@ #include "mp4_demuxer/AnnexB.h" #include "mp4_demuxer/H264.h" -mozilla::LogModule* GetDemuxerLog() { - static mozilla::LazyLogModule log("MP4Demuxer"); +PRLogModuleInfo* GetDemuxerLog() { + static PRLogModuleInfo* log = nullptr; + if (!log) { + log = PR_NewLogModule("MP4Demuxer"); + } return log; } diff --git a/dom/media/gmp/GMPAudioDecoderParent.cpp b/dom/media/gmp/GMPAudioDecoderParent.cpp index b73c0d973f14..b9a8cba8d5df 100644 --- a/dom/media/gmp/GMPAudioDecoderParent.cpp +++ b/dom/media/gmp/GMPAudioDecoderParent.cpp @@ -17,7 +17,7 @@ namespace mozilla { #undef LOG #endif -extern LogModule* GetGMPLog(); +extern PRLogModuleInfo* GetGMPLog(); #define LOGV(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Verbose, msg) #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) diff --git a/dom/media/gmp/GMPChild.cpp b/dom/media/gmp/GMPChild.cpp index 95ee0eb74763..8d0279ecea53 100644 --- a/dom/media/gmp/GMPChild.cpp +++ b/dom/media/gmp/GMPChild.cpp @@ -43,7 +43,7 @@ namespace mozilla { #undef LOG #undef LOGD -extern LogModule* GetGMPLog(); +extern PRLogModuleInfo* GetGMPLog(); #define LOG(level, x, ...) MOZ_LOG(GetGMPLog(), (level), (x, ##__VA_ARGS__)) #define LOGD(x, ...) LOG(mozilla::LogLevel::Debug, "GMPChild[pid=%d] " x, (int)base::GetCurrentProcId(), ##__VA_ARGS__) diff --git a/dom/media/gmp/GMPContentParent.cpp b/dom/media/gmp/GMPContentParent.cpp index 4b89dc7c532d..b238445f8965 100644 --- a/dom/media/gmp/GMPContentParent.cpp +++ b/dom/media/gmp/GMPContentParent.cpp @@ -20,7 +20,7 @@ namespace mozilla { #undef LOG #endif -extern LogModule* GetGMPLog(); +extern PRLogModuleInfo* GetGMPLog(); #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) #define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg) diff --git a/dom/media/gmp/GMPDecryptorParent.cpp b/dom/media/gmp/GMPDecryptorParent.cpp index 60d206ee678e..375b46aad003 100644 --- a/dom/media/gmp/GMPDecryptorParent.cpp +++ b/dom/media/gmp/GMPDecryptorParent.cpp @@ -14,7 +14,7 @@ namespace mozilla { #undef LOG #endif -extern LogModule* GetGMPLog(); +extern PRLogModuleInfo* GetGMPLog(); #define LOGV(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Verbose, msg) #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) diff --git a/dom/media/gmp/GMPParent.cpp b/dom/media/gmp/GMPParent.cpp index 28e9671fd9f2..1593f0e28545 100644 --- a/dom/media/gmp/GMPParent.cpp +++ b/dom/media/gmp/GMPParent.cpp @@ -43,7 +43,7 @@ namespace mozilla { #undef LOG #undef LOGD -extern LogModule* GetGMPLog(); +extern PRLogModuleInfo* GetGMPLog(); #define LOG(level, x, ...) MOZ_LOG(GetGMPLog(), (level), (x, ##__VA_ARGS__)) #define LOGD(x, ...) LOG(mozilla::LogLevel::Debug, "GMPParent[%p|childPid=%d] " x, this, mChildPid, ##__VA_ARGS__) diff --git a/dom/media/gmp/GMPService.cpp b/dom/media/gmp/GMPService.cpp index 03dac0fdb813..8c5b151eb165 100644 --- a/dom/media/gmp/GMPService.cpp +++ b/dom/media/gmp/GMPService.cpp @@ -46,10 +46,12 @@ namespace mozilla { #undef LOG #endif -LogModule* +PRLogModuleInfo* GetGMPLog() { - static LazyLogModule sLog("GMP"); + static PRLogModuleInfo *sLog; + if (!sLog) + sLog = PR_NewLogModule("GMP"); return sLog; } diff --git a/dom/media/gmp/GMPService.h b/dom/media/gmp/GMPService.h index 0dac2d8a75e1..313fd1daf998 100644 --- a/dom/media/gmp/GMPService.h +++ b/dom/media/gmp/GMPService.h @@ -24,7 +24,7 @@ template struct already_AddRefed; namespace mozilla { -extern LogModule* GetGMPLog(); +extern PRLogModuleInfo* GetGMPLog(); namespace gmp { diff --git a/dom/media/gmp/GMPStorageParent.cpp b/dom/media/gmp/GMPStorageParent.cpp index c048f876950b..2ec2210772d9 100644 --- a/dom/media/gmp/GMPStorageParent.cpp +++ b/dom/media/gmp/GMPStorageParent.cpp @@ -25,7 +25,7 @@ namespace mozilla { #undef LOG #endif -extern LogModule* GetGMPLog(); +extern PRLogModuleInfo* GetGMPLog(); #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) #define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg) diff --git a/dom/media/gmp/GMPTimerParent.cpp b/dom/media/gmp/GMPTimerParent.cpp index 260433d01583..8e584904810c 100644 --- a/dom/media/gmp/GMPTimerParent.cpp +++ b/dom/media/gmp/GMPTimerParent.cpp @@ -13,7 +13,7 @@ namespace mozilla { #undef LOG #endif -extern LogModule* GetGMPLog(); +extern PRLogModuleInfo* GetGMPLog(); #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) #define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg) diff --git a/dom/media/gmp/GMPVideoDecoderParent.cpp b/dom/media/gmp/GMPVideoDecoderParent.cpp index d983df4d9b0a..6535b0d47977 100644 --- a/dom/media/gmp/GMPVideoDecoderParent.cpp +++ b/dom/media/gmp/GMPVideoDecoderParent.cpp @@ -21,7 +21,7 @@ namespace mozilla { #undef LOG #endif -extern LogModule* GetGMPLog(); +extern PRLogModuleInfo* GetGMPLog(); #define LOGV(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Verbose, msg) #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) diff --git a/dom/media/gmp/GMPVideoEncoderParent.cpp b/dom/media/gmp/GMPVideoEncoderParent.cpp index b142e7fabfee..311ecef99ca3 100644 --- a/dom/media/gmp/GMPVideoEncoderParent.cpp +++ b/dom/media/gmp/GMPVideoEncoderParent.cpp @@ -23,7 +23,7 @@ namespace mozilla { #undef LOG #endif -extern LogModule* GetGMPLog(); +extern PRLogModuleInfo* GetGMPLog(); #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) #define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg) diff --git a/dom/media/gstreamer/GStreamerFormatHelper.cpp b/dom/media/gstreamer/GStreamerFormatHelper.cpp index fd545ac7ea96..d7649b806a1c 100644 --- a/dom/media/gstreamer/GStreamerFormatHelper.cpp +++ b/dom/media/gstreamer/GStreamerFormatHelper.cpp @@ -16,7 +16,7 @@ namespace mozilla { -extern LazyLogModule gMediaDecoderLog; +extern PRLogModuleInfo* gMediaDecoderLog; #define LOG(msg, ...) \ MOZ_LOG(gMediaDecoderLog, LogLevel::Debug, ("GStreamerFormatHelper " msg, ##__VA_ARGS__)) diff --git a/dom/media/gstreamer/GStreamerReader.cpp b/dom/media/gstreamer/GStreamerReader.cpp index aff07e085819..58bd4dcaa3d6 100644 --- a/dom/media/gstreamer/GStreamerReader.cpp +++ b/dom/media/gstreamer/GStreamerReader.cpp @@ -29,7 +29,7 @@ using namespace media; // Un-comment to enable logging of seek bisections. //#define SEEK_LOGGING -extern LazyLogModule gMediaDecoderLog; +extern PRLogModuleInfo* gMediaDecoderLog; #define LOG(type, msg, ...) \ MOZ_LOG(gMediaDecoderLog, type, ("GStreamerReader(%p) " msg, this, ##__VA_ARGS__)) diff --git a/dom/media/imagecapture/ImageCapture.cpp b/dom/media/imagecapture/ImageCapture.cpp index a169d9c3807e..f01664721177 100644 --- a/dom/media/imagecapture/ImageCapture.cpp +++ b/dom/media/imagecapture/ImageCapture.cpp @@ -18,9 +18,12 @@ namespace mozilla { -LogModule* GetICLog() +PRLogModuleInfo* GetICLog() { - static LazyLogModule log("ImageCapture"); + static PRLogModuleInfo* log = nullptr; + if (!log) { + log = PR_NewLogModule("ImageCapture"); + } return log; } diff --git a/dom/media/imagecapture/ImageCapture.h b/dom/media/imagecapture/ImageCapture.h index fc8f5385acb6..7a47af45e721 100644 --- a/dom/media/imagecapture/ImageCapture.h +++ b/dom/media/imagecapture/ImageCapture.h @@ -14,7 +14,7 @@ namespace mozilla { #ifndef IC_LOG -LogModule* GetICLog(); +PRLogModuleInfo* GetICLog(); #define IC_LOG(...) MOZ_LOG(GetICLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) #endif diff --git a/dom/media/mediasink/DecodedAudioDataSink.cpp b/dom/media/mediasink/DecodedAudioDataSink.cpp index 8a8eaaf6221d..5d0c89e2381b 100644 --- a/dom/media/mediasink/DecodedAudioDataSink.cpp +++ b/dom/media/mediasink/DecodedAudioDataSink.cpp @@ -14,7 +14,7 @@ namespace mozilla { -extern LazyLogModule gMediaDecoderLog; +extern PRLogModuleInfo* gMediaDecoderLog; #define SINK_LOG(msg, ...) \ MOZ_LOG(gMediaDecoderLog, LogLevel::Debug, \ ("DecodedAudioDataSink=%p " msg, this, ##__VA_ARGS__)) diff --git a/dom/media/mediasink/VideoSink.cpp b/dom/media/mediasink/VideoSink.cpp index df675de0caf4..c5275a042699 100644 --- a/dom/media/mediasink/VideoSink.cpp +++ b/dom/media/mediasink/VideoSink.cpp @@ -8,7 +8,7 @@ namespace mozilla { -extern LazyLogModule gMediaDecoderLog; +extern PRLogModuleInfo* gMediaDecoderLog; #define VSINK_LOG(msg, ...) \ MOZ_LOG(gMediaDecoderLog, LogLevel::Debug, \ ("VideoSink=%p " msg, this, ##__VA_ARGS__)) diff --git a/dom/media/mediasource/ContainerParser.cpp b/dom/media/mediasource/ContainerParser.cpp index 349723ef0457..f2be166346c9 100644 --- a/dom/media/mediasource/ContainerParser.cpp +++ b/dom/media/mediasource/ContainerParser.cpp @@ -20,7 +20,7 @@ #endif #include "SourceBufferResource.h" -extern mozilla::LogModule* GetMediaSourceSamplesLog(); +extern PRLogModuleInfo* GetMediaSourceSamplesLog(); #define STRINGIFY(x) #x #define TOSTRING(x) STRINGIFY(x) diff --git a/dom/media/mediasource/MediaSource.cpp b/dom/media/mediasource/MediaSource.cpp index b0de675f68e4..ac3ebe99d19e 100644 --- a/dom/media/mediasource/MediaSource.cpp +++ b/dom/media/mediasource/MediaSource.cpp @@ -36,15 +36,21 @@ struct JSContext; class JSObject; -mozilla::LogModule* GetMediaSourceLog() +PRLogModuleInfo* GetMediaSourceLog() { - static mozilla::LazyLogModule sLogModule("MediaSource"); + static PRLogModuleInfo* sLogModule = nullptr; + if (!sLogModule) { + sLogModule = PR_NewLogModule("MediaSource"); + } return sLogModule; } -mozilla::LogModule* GetMediaSourceAPILog() +PRLogModuleInfo* GetMediaSourceAPILog() { - static mozilla::LazyLogModule sLogModule("MediaSource"); + static PRLogModuleInfo* sLogModule = nullptr; + if (!sLogModule) { + sLogModule = PR_NewLogModule("MediaSource"); + } return sLogModule; } diff --git a/dom/media/mediasource/MediaSourceDecoder.cpp b/dom/media/mediasource/MediaSourceDecoder.cpp index 395b82739bd5..1859f330cdce 100644 --- a/dom/media/mediasource/MediaSourceDecoder.cpp +++ b/dom/media/mediasource/MediaSourceDecoder.cpp @@ -17,7 +17,7 @@ #include "MediaSourceDemuxer.h" #include "SourceBufferList.h" -extern mozilla::LogModule* GetMediaSourceLog(); +extern PRLogModuleInfo* GetMediaSourceLog(); #define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("MediaSourceDecoder(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) #define MSE_DEBUGV(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Verbose, ("MediaSourceDecoder(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) diff --git a/dom/media/mediasource/MediaSourceResource.h b/dom/media/mediasource/MediaSourceResource.h index 467232117d08..38b2c347fb20 100644 --- a/dom/media/mediasource/MediaSourceResource.h +++ b/dom/media/mediasource/MediaSourceResource.h @@ -11,7 +11,7 @@ #include "mozilla/Monitor.h" #include "mozilla/Logging.h" -extern mozilla::LogModule* GetMediaSourceLog(); +extern PRLogModuleInfo* GetMediaSourceLog(); #define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("MediaSourceResource(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) diff --git a/dom/media/mediasource/ResourceQueue.cpp b/dom/media/mediasource/ResourceQueue.cpp index 58cc0a2fb582..019764062908 100644 --- a/dom/media/mediasource/ResourceQueue.cpp +++ b/dom/media/mediasource/ResourceQueue.cpp @@ -10,7 +10,7 @@ #include "mozilla/ErrorResult.h" #include "mozilla/Logging.h" -extern mozilla::LogModule* GetSourceBufferResourceLog(); +extern PRLogModuleInfo* GetSourceBufferResourceLog(); #define SBR_DEBUG(arg, ...) MOZ_LOG(GetSourceBufferResourceLog(), mozilla::LogLevel::Debug, ("ResourceQueue(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) #define SBR_DEBUGV(arg, ...) MOZ_LOG(GetSourceBufferResourceLog(), mozilla::LogLevel::Verbose, ("ResourceQueue(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) diff --git a/dom/media/mediasource/SourceBuffer.cpp b/dom/media/mediasource/SourceBuffer.cpp index a4e8fc2fa509..b76d0b29c67f 100644 --- a/dom/media/mediasource/SourceBuffer.cpp +++ b/dom/media/mediasource/SourceBuffer.cpp @@ -26,8 +26,8 @@ struct JSContext; class JSObject; -extern mozilla::LogModule* GetMediaSourceLog(); -extern mozilla::LogModule* GetMediaSourceAPILog(); +extern PRLogModuleInfo* GetMediaSourceLog(); +extern PRLogModuleInfo* GetMediaSourceAPILog(); #define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("SourceBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) #define MSE_DEBUGV(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Verbose, ("SourceBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) diff --git a/dom/media/mediasource/SourceBufferList.cpp b/dom/media/mediasource/SourceBufferList.cpp index bea935f3d1e6..5984bc534874 100644 --- a/dom/media/mediasource/SourceBufferList.cpp +++ b/dom/media/mediasource/SourceBufferList.cpp @@ -16,8 +16,8 @@ #include "nsThreadUtils.h" #include "mozilla/Logging.h" -extern mozilla::LogModule* GetMediaSourceLog(); -extern mozilla::LogModule* GetMediaSourceAPILog(); +extern PRLogModuleInfo* GetMediaSourceLog(); +extern PRLogModuleInfo* GetMediaSourceAPILog(); #define MSE_API(arg, ...) MOZ_LOG(GetMediaSourceAPILog(), mozilla::LogLevel::Debug, ("SourceBufferList(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) #define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("SourceBufferList(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) diff --git a/dom/media/mediasource/SourceBufferResource.cpp b/dom/media/mediasource/SourceBufferResource.cpp index 32c4230e66b0..9611a60f272b 100644 --- a/dom/media/mediasource/SourceBufferResource.cpp +++ b/dom/media/mediasource/SourceBufferResource.cpp @@ -13,9 +13,12 @@ #include "mozilla/Logging.h" #include "MediaData.h" -mozilla::LogModule* GetSourceBufferResourceLog() +PRLogModuleInfo* GetSourceBufferResourceLog() { - static mozilla::LazyLogModule sLogModule("SourceBufferResource"); + static PRLogModuleInfo* sLogModule = nullptr; + if (!sLogModule) { + sLogModule = PR_NewLogModule("SourceBufferResource"); + } return sLogModule; } diff --git a/dom/media/mediasource/TrackBuffersManager.cpp b/dom/media/mediasource/TrackBuffersManager.cpp index 21a3f078dad5..c2b97634b5eb 100644 --- a/dom/media/mediasource/TrackBuffersManager.cpp +++ b/dom/media/mediasource/TrackBuffersManager.cpp @@ -23,14 +23,17 @@ #include -extern mozilla::LogModule* GetMediaSourceLog(); +extern PRLogModuleInfo* GetMediaSourceLog(); #define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("TrackBuffersManager(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) #define MSE_DEBUGV(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Verbose, ("TrackBuffersManager(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) -mozilla::LogModule* GetMediaSourceSamplesLog() +PRLogModuleInfo* GetMediaSourceSamplesLog() { - static mozilla::LazyLogModule sLogModule("MediaSourceSamples"); + static PRLogModuleInfo* sLogModule = nullptr; + if (!sLogModule) { + sLogModule = PR_NewLogModule("MediaSourceSamples"); + } return sLogModule; } #define SAMPLE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceSamplesLog(), mozilla::LogLevel::Debug, ("TrackBuffersManager(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) diff --git a/dom/media/ogg/OggCodecState.cpp b/dom/media/ogg/OggCodecState.cpp index 8184053ec710..e0761d0fb774 100644 --- a/dom/media/ogg/OggCodecState.cpp +++ b/dom/media/ogg/OggCodecState.cpp @@ -32,7 +32,7 @@ namespace mozilla { -extern LazyLogModule gMediaDecoderLog; +extern PRLogModuleInfo* gMediaDecoderLog; #define LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) /** Decoder base class for Ogg-encapsulated streams. */ diff --git a/dom/media/ogg/OggReader.cpp b/dom/media/ogg/OggReader.cpp index c97d1928e1f0..91d4a2789831 100644 --- a/dom/media/ogg/OggReader.cpp +++ b/dom/media/ogg/OggReader.cpp @@ -37,7 +37,7 @@ namespace mozilla { // Un-comment to enable logging of seek bisections. //#define SEEK_LOGGING -extern LazyLogModule gMediaDecoderLog; +extern PRLogModuleInfo* gMediaDecoderLog; #define LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) #ifdef SEEK_LOGGING #define SEEK_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) diff --git a/dom/media/ogg/OpusParser.cpp b/dom/media/ogg/OpusParser.cpp index c450df9a22a6..8bdaf7f55017 100644 --- a/dom/media/ogg/OpusParser.cpp +++ b/dom/media/ogg/OpusParser.cpp @@ -24,7 +24,7 @@ extern "C" { namespace mozilla { -extern LazyLogModule gMediaDecoderLog; +extern PRLogModuleInfo* gMediaDecoderLog; #define OPUS_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) OpusParser::OpusParser(): diff --git a/dom/media/omx/AudioOffloadPlayer.cpp b/dom/media/omx/AudioOffloadPlayer.cpp index cb8a7df9c040..61dd15d003be 100644 --- a/dom/media/omx/AudioOffloadPlayer.cpp +++ b/dom/media/omx/AudioOffloadPlayer.cpp @@ -42,7 +42,7 @@ using namespace android; namespace mozilla { -LazyLogModule gAudioOffloadPlayerLog("AudioOffloadPlayer"); +PRLogModuleInfo* gAudioOffloadPlayerLog; #define AUDIO_OFFLOAD_LOG(type, msg) \ MOZ_LOG(gAudioOffloadPlayerLog, type, msg) @@ -63,6 +63,10 @@ AudioOffloadPlayer::AudioOffloadPlayer(MediaOmxCommonDecoder* aObserver) : { MOZ_ASSERT(NS_IsMainThread()); + if (!gAudioOffloadPlayerLog) { + gAudioOffloadPlayerLog = PR_NewLogModule("AudioOffloadPlayer"); + } + CHECK(aObserver); #if ANDROID_VERSION >= 21 mSessionId = AudioSystem::newAudioUniqueId(); diff --git a/dom/media/omx/AudioOutput.cpp b/dom/media/omx/AudioOutput.cpp index 132d09d77c2d..9754da32b3d0 100644 --- a/dom/media/omx/AudioOutput.cpp +++ b/dom/media/omx/AudioOutput.cpp @@ -24,7 +24,7 @@ namespace mozilla { -extern LazyLogModule gAudioOffloadPlayerLog; +extern PRLogModuleInfo* gAudioOffloadPlayerLog; #define AUDIO_OFFLOAD_LOG(type, msg) \ MOZ_LOG(gAudioOffloadPlayerLog, type, msg) @@ -37,6 +37,9 @@ AudioOutput::AudioOutput(int aSessionId, int aUid) : mUid(aUid), mSessionId(aSessionId) { + if (!gAudioOffloadPlayerLog) { + gAudioOffloadPlayerLog = PR_NewLogModule("AudioOffloadPlayer"); + } } AudioOutput::~AudioOutput() diff --git a/dom/media/omx/I420ColorConverterHelper.cpp b/dom/media/omx/I420ColorConverterHelper.cpp index f1e248499d2a..8afcbc4cb073 100644 --- a/dom/media/omx/I420ColorConverterHelper.cpp +++ b/dom/media/omx/I420ColorConverterHelper.cpp @@ -10,7 +10,7 @@ #include "mozilla/Logging.h" -mozilla::LazyLogModule gI420ColorConverterHelperLog("I420ColorConverterHelper"); +PRLogModuleInfo *gI420ColorConverterHelperLog; #define LOG(msg...) MOZ_LOG(gI420ColorConverterHelperLog, mozilla::LogLevel::Warning, (msg)) namespace android { @@ -19,6 +19,9 @@ I420ColorConverterHelper::I420ColorConverterHelper() : mHandle(nullptr) , mConverter({nullptr, nullptr, nullptr, nullptr, nullptr}) { + if (!gI420ColorConverterHelperLog) { + gI420ColorConverterHelperLog = PR_NewLogModule("I420ColorConverterHelper"); + } } I420ColorConverterHelper::~I420ColorConverterHelper() diff --git a/dom/media/omx/MediaOmxCommonDecoder.cpp b/dom/media/omx/MediaOmxCommonDecoder.cpp index 73ab320d3835..638e9e69d4fd 100644 --- a/dom/media/omx/MediaOmxCommonDecoder.cpp +++ b/dom/media/omx/MediaOmxCommonDecoder.cpp @@ -20,7 +20,7 @@ using namespace android; namespace mozilla { -extern LazyLogModule gMediaDecoderLog; +extern PRLogModuleInfo* gMediaDecoderLog; #define DECODER_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) MediaOmxCommonDecoder::MediaOmxCommonDecoder(MediaDecoderOwner* aOwner) diff --git a/dom/media/omx/MediaOmxCommonReader.cpp b/dom/media/omx/MediaOmxCommonReader.cpp index 2926ea940c10..280bc26f35b2 100644 --- a/dom/media/omx/MediaOmxCommonReader.cpp +++ b/dom/media/omx/MediaOmxCommonReader.cpp @@ -23,7 +23,7 @@ using namespace android; namespace mozilla { -extern LazyLogModule gMediaDecoderLog; +extern PRLogModuleInfo* gMediaDecoderLog; #define DECODER_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) MediaOmxCommonReader::MediaOmxCommonReader(AbstractMediaDecoder *aDecoder) diff --git a/dom/media/omx/MediaOmxReader.cpp b/dom/media/omx/MediaOmxReader.cpp index 65a370b260b1..e67277cb37a4 100644 --- a/dom/media/omx/MediaOmxReader.cpp +++ b/dom/media/omx/MediaOmxReader.cpp @@ -28,7 +28,7 @@ using namespace android; namespace mozilla { -extern LazyLogModule gMediaDecoderLog; +extern PRLogModuleInfo* gMediaDecoderLog; #define DECODER_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) class MediaOmxReader::ProcessCachedDataTask : public Task diff --git a/dom/media/omx/OmxDecoder.cpp b/dom/media/omx/OmxDecoder.cpp index 531256ecad97..6427a313d151 100644 --- a/dom/media/omx/OmxDecoder.cpp +++ b/dom/media/omx/OmxDecoder.cpp @@ -37,7 +37,7 @@ #define OD_LOG(...) __android_log_print(ANDROID_LOG_DEBUG, "OmxDecoder", __VA_ARGS__) #undef LOG -mozilla::LazyLogModule gOmxDecoderLog("OmxDecoder"); +PRLogModuleInfo *gOmxDecoderLog; #define LOG(type, msg...) MOZ_LOG(gOmxDecoderLog, type, (msg)) using namespace MPAPI; @@ -102,6 +102,10 @@ static sp GetOMX() bool OmxDecoder::Init(sp& extractor) { + if (!gOmxDecoderLog) { + gOmxDecoderLog = PR_NewLogModule("OmxDecoder"); + } + sp meta = extractor->getMetaData(); ssize_t audioTrackIndex = -1; diff --git a/dom/media/platforms/PlatformDecoderModule.cpp b/dom/media/platforms/PlatformDecoderModule.cpp index a2b979c374b0..bb02119700bc 100644 --- a/dom/media/platforms/PlatformDecoderModule.cpp +++ b/dom/media/platforms/PlatformDecoderModule.cpp @@ -6,7 +6,10 @@ #include "PlatformDecoderModule.h" -mozilla::LogModule* GetPDMLog() { - static mozilla::LazyLogModule log("PlatformDecoderModule"); +PRLogModuleInfo* GetPDMLog() { + static PRLogModuleInfo* log = nullptr; + if (!log) { + log = PR_NewLogModule("PlatformDecoderModule"); + } return log; } diff --git a/dom/media/platforms/agnostic/OpusDecoder.cpp b/dom/media/platforms/agnostic/OpusDecoder.cpp index 252238548685..89e02079797b 100644 --- a/dom/media/platforms/agnostic/OpusDecoder.cpp +++ b/dom/media/platforms/agnostic/OpusDecoder.cpp @@ -12,7 +12,7 @@ #include #include // For PRId64 -extern mozilla::LogModule* GetPDMLog(); +extern PRLogModuleInfo* GetPDMLog(); #define OPUS_DEBUG(arg, ...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, \ ("OpusDataDecoder(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) diff --git a/dom/media/platforms/agnostic/VPXDecoder.cpp b/dom/media/platforms/agnostic/VPXDecoder.cpp index 2fb87f65080f..9a31ab653a96 100644 --- a/dom/media/platforms/agnostic/VPXDecoder.cpp +++ b/dom/media/platforms/agnostic/VPXDecoder.cpp @@ -14,7 +14,7 @@ #include #undef LOG -extern mozilla::LogModule* GetPDMLog(); +extern PRLogModuleInfo* GetPDMLog(); #define LOG(arg, ...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, ("VPXDecoder(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/platforms/agnostic/VorbisDecoder.cpp b/dom/media/platforms/agnostic/VorbisDecoder.cpp index 8f37a8fbc3ae..dce4c8a97e44 100644 --- a/dom/media/platforms/agnostic/VorbisDecoder.cpp +++ b/dom/media/platforms/agnostic/VorbisDecoder.cpp @@ -12,7 +12,7 @@ #include "nsAutoPtr.h" #undef LOG -extern mozilla::LogModule* GetPDMLog(); +extern PRLogModuleInfo* GetPDMLog(); #define LOG(type, msg) MOZ_LOG(GetPDMLog(), type, msg) namespace mozilla { diff --git a/dom/media/platforms/apple/AppleATDecoder.cpp b/dom/media/platforms/apple/AppleATDecoder.cpp index fd8078208d67..578266e28f3a 100644 --- a/dom/media/platforms/apple/AppleATDecoder.cpp +++ b/dom/media/platforms/apple/AppleATDecoder.cpp @@ -11,7 +11,7 @@ #include "AppleATDecoder.h" #include "mozilla/Logging.h" -extern mozilla::LogModule* GetPDMLog(); +extern PRLogModuleInfo* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) #define FourCC2Str(n) ((char[5]){(char)(n >> 24), (char)(n >> 16), (char)(n >> 8), (char)(n), 0}) diff --git a/dom/media/platforms/apple/AppleCMLinker.cpp b/dom/media/platforms/apple/AppleCMLinker.cpp index a61cb0e9f2fe..d32119ba9068 100644 --- a/dom/media/platforms/apple/AppleCMLinker.cpp +++ b/dom/media/platforms/apple/AppleCMLinker.cpp @@ -15,7 +15,7 @@ #include "nsCocoaFeatures.h" #endif -extern mozilla::LogModule* GetPDMLog(); +extern PRLogModuleInfo* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/platforms/apple/AppleVDADecoder.cpp b/dom/media/platforms/apple/AppleVDADecoder.cpp index 8d1aebcade4c..1851852ec1a2 100644 --- a/dom/media/platforms/apple/AppleVDADecoder.cpp +++ b/dom/media/platforms/apple/AppleVDADecoder.cpp @@ -27,7 +27,7 @@ #include "MacIOSurfaceImage.h" #endif -extern mozilla::LogModule* GetPDMLog(); +extern PRLogModuleInfo* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) //#define LOG_MEDIA_SHA1 diff --git a/dom/media/platforms/apple/AppleVDALinker.cpp b/dom/media/platforms/apple/AppleVDALinker.cpp index 045b1e24d311..79f5c96d7422 100644 --- a/dom/media/platforms/apple/AppleVDALinker.cpp +++ b/dom/media/platforms/apple/AppleVDALinker.cpp @@ -10,7 +10,7 @@ #include "MainThreadUtils.h" #include "nsDebug.h" -extern mozilla::LogModule* GetPDMLog(); +extern PRLogModuleInfo* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/platforms/apple/AppleVTDecoder.cpp b/dom/media/platforms/apple/AppleVTDecoder.cpp index 000f95c6389d..5432b41b110f 100644 --- a/dom/media/platforms/apple/AppleVTDecoder.cpp +++ b/dom/media/platforms/apple/AppleVTDecoder.cpp @@ -20,7 +20,7 @@ #include "VideoUtils.h" #include "gfxPlatform.h" -extern mozilla::LogModule* GetPDMLog(); +extern PRLogModuleInfo* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) //#define LOG_MEDIA_SHA1 diff --git a/dom/media/platforms/apple/AppleVTLinker.cpp b/dom/media/platforms/apple/AppleVTLinker.cpp index 8adda2722548..a4f7e266045d 100644 --- a/dom/media/platforms/apple/AppleVTLinker.cpp +++ b/dom/media/platforms/apple/AppleVTLinker.cpp @@ -11,7 +11,7 @@ #include "mozilla/ArrayUtils.h" #include "nsDebug.h" -extern mozilla::LogModule* GetPDMLog(); +extern PRLogModuleInfo* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/platforms/ffmpeg/FFmpegLog.h b/dom/media/platforms/ffmpeg/FFmpegLog.h index eb1d22d99cab..19b950bf46d8 100644 --- a/dom/media/platforms/ffmpeg/FFmpegLog.h +++ b/dom/media/platforms/ffmpeg/FFmpegLog.h @@ -7,7 +7,7 @@ #ifndef __FFmpegLog_h__ #define __FFmpegLog_h__ -extern mozilla::LogModule* GetPDMLog(); +extern PRLogModuleInfo* GetPDMLog(); #define FFMPEG_LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) #endif // __FFmpegLog_h__ diff --git a/dom/media/platforms/gonk/GonkAudioDecoderManager.cpp b/dom/media/platforms/gonk/GonkAudioDecoderManager.cpp index e55feb14119b..7dfa4b267c5b 100644 --- a/dom/media/platforms/gonk/GonkAudioDecoderManager.cpp +++ b/dom/media/platforms/gonk/GonkAudioDecoderManager.cpp @@ -27,7 +27,7 @@ #include #define GADM_LOG(...) __android_log_print(ANDROID_LOG_DEBUG, "GonkAudioDecoderManager", __VA_ARGS__) -extern mozilla::LogModule* GetPDMLog(); +extern PRLogModuleInfo* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) using namespace android; diff --git a/dom/media/platforms/gonk/GonkMediaDataDecoder.cpp b/dom/media/platforms/gonk/GonkMediaDataDecoder.cpp index 4bbf8acb6d12..0ff303817b39 100644 --- a/dom/media/platforms/gonk/GonkMediaDataDecoder.cpp +++ b/dom/media/platforms/gonk/GonkMediaDataDecoder.cpp @@ -20,7 +20,7 @@ #include #endif -extern mozilla::LogModule* GetPDMLog(); +extern PRLogModuleInfo* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) using namespace android; diff --git a/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp b/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp index 6a70a11be541..4cd3ecb0955f 100644 --- a/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp +++ b/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp @@ -32,7 +32,7 @@ #include #define GVDM_LOG(...) __android_log_print(ANDROID_LOG_DEBUG, "GonkVideoDecoderManager", __VA_ARGS__) -extern mozilla::LogModule* GetPDMLog(); +extern PRLogModuleInfo* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) using namespace mozilla::layers; using namespace android; diff --git a/dom/media/platforms/wmf/MFTDecoder.cpp b/dom/media/platforms/wmf/MFTDecoder.cpp index 5558d6d7b2bf..83ff91ba00e5 100644 --- a/dom/media/platforms/wmf/MFTDecoder.cpp +++ b/dom/media/platforms/wmf/MFTDecoder.cpp @@ -9,7 +9,7 @@ #include "WMFUtils.h" #include "mozilla/Logging.h" -extern mozilla::LogModule* GetPDMLog(); +extern PRLogModuleInfo* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/platforms/wmf/WMFAudioMFTManager.cpp b/dom/media/platforms/wmf/WMFAudioMFTManager.cpp index a2b5b518ed2b..1b8d361f1fa4 100644 --- a/dom/media/platforms/wmf/WMFAudioMFTManager.cpp +++ b/dom/media/platforms/wmf/WMFAudioMFTManager.cpp @@ -13,7 +13,7 @@ #include "mozilla/Logging.h" -extern mozilla::LogModule* GetPDMLog(); +extern PRLogModuleInfo* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp b/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp index 48cc4f6e535b..5efca43a1a61 100644 --- a/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp +++ b/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp @@ -12,7 +12,7 @@ #include "mozilla/Logging.h" -extern mozilla::LogModule* GetPDMLog(); +extern PRLogModuleInfo* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp index 528155ad6810..b82f0486a629 100644 --- a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp +++ b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp @@ -23,7 +23,7 @@ #include "mozilla/Preferences.h" #include "nsPrintfCString.h" -extern mozilla::LogModule* GetPDMLog(); +extern PRLogModuleInfo* GetPDMLog(); #define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) using mozilla::layers::Image; diff --git a/dom/media/platforms/wrappers/FuzzingWrapper.cpp b/dom/media/platforms/wrappers/FuzzingWrapper.cpp index 6b87a8fb5adb..2e58facf3eed 100644 --- a/dom/media/platforms/wrappers/FuzzingWrapper.cpp +++ b/dom/media/platforms/wrappers/FuzzingWrapper.cpp @@ -6,8 +6,11 @@ #include "FuzzingWrapper.h" -mozilla::LogModule* GetFuzzingWrapperLog() { - static mozilla::LazyLogModule log("MediaFuzzingWrapper"); +PRLogModuleInfo* GetFuzzingWrapperLog() { + static PRLogModuleInfo* log = nullptr; + if (!log) { + log = PR_NewLogModule("MediaFuzzingWrapper"); + } return log; } #define DFW_LOGD(arg, ...) MOZ_LOG(GetFuzzingWrapperLog(), mozilla::LogLevel::Debug, ("DecoderFuzzingWrapper(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) diff --git a/dom/media/systemservices/CamerasChild.cpp b/dom/media/systemservices/CamerasChild.cpp index d4adf6f024a8..44ad63cdad6a 100644 --- a/dom/media/systemservices/CamerasChild.cpp +++ b/dom/media/systemservices/CamerasChild.cpp @@ -22,7 +22,7 @@ #undef LOG #undef LOG_ENABLED -mozilla::LazyLogModule gCamerasChildLog("CamerasChild"); +PRLogModuleInfo *gCamerasChildLog; #define LOG(args) MOZ_LOG(gCamerasChildLog, mozilla::LogLevel::Debug, args) #define LOG_ENABLED() MOZ_LOG_TEST(gCamerasChildLog, mozilla::LogLevel::Debug) @@ -56,6 +56,9 @@ public: : mCamerasMutex("CamerasSingleton::mCamerasMutex"), mCameras(nullptr), mCamerasChildThread(nullptr) { + if (!gCamerasChildLog) { + gCamerasChildLog = PR_NewLogModule("CamerasChild"); + } LOG(("CamerasSingleton: %p", this)); } @@ -141,6 +144,10 @@ Cameras() { OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex()); if (!CamerasSingleton::Child()) { MOZ_ASSERT(!NS_IsMainThread(), "Should not be on the main Thread"); + if (!gCamerasChildLog) { + gCamerasChildLog = PR_NewLogModule("CamerasChild"); + } + MOZ_ASSERT(!CamerasSingleton::Thread()); LOG(("No sCameras, setting up IPC Thread")); nsresult rv = NS_NewNamedThread("Cameras IPC", @@ -699,6 +706,10 @@ CamerasChild::CamerasChild() mRequestMutex("mozilla::cameras::CamerasChild::mRequestMutex"), mReplyMonitor("mozilla::cameras::CamerasChild::mReplyMonitor") { + if (!gCamerasChildLog) { + gCamerasChildLog = PR_NewLogModule("CamerasChild"); + } + LOG(("CamerasChild: %p", this)); MOZ_COUNT_CTOR(CamerasChild); diff --git a/dom/media/systemservices/CamerasParent.cpp b/dom/media/systemservices/CamerasParent.cpp index e0e4ca1aa9ae..df1c1ea56b67 100644 --- a/dom/media/systemservices/CamerasParent.cpp +++ b/dom/media/systemservices/CamerasParent.cpp @@ -18,7 +18,7 @@ #undef LOG #undef LOG_ENABLED -mozilla::LazyLogModule gCamerasParentLog("CamerasParent"); +PRLogModuleInfo *gCamerasParentLog; #define LOG(args) MOZ_LOG(gCamerasParentLog, mozilla::LogLevel::Debug, args) #define LOG_ENABLED() MOZ_LOG_TEST(gCamerasParentLog, mozilla::LogLevel::Debug) @@ -852,6 +852,9 @@ CamerasParent::CamerasParent() mDestroyed(false), mWebRTCAlive(true) { + if (!gCamerasParentLog) { + gCamerasParentLog = PR_NewLogModule("CamerasParent"); + } LOG(("CamerasParent: %p", this)); mPBackgroundThread = NS_GetCurrentThread(); diff --git a/dom/media/systemservices/LoadManager.cpp b/dom/media/systemservices/LoadManager.cpp index 55506bab8d45..044af1f45f52 100644 --- a/dom/media/systemservices/LoadManager.cpp +++ b/dom/media/systemservices/LoadManager.cpp @@ -19,7 +19,7 @@ #include "mozilla/ArrayUtils.h" // NSPR_LOG_MODULES=LoadManager:5 -mozilla::LazyLogModule gLoadManagerLog("LoadManager"); +PRLogModuleInfo *gLoadManagerLog = nullptr; #undef LOG #undef LOG_ENABLED #define LOG(args) MOZ_LOG(gLoadManagerLog, mozilla::LogLevel::Debug, args) @@ -46,6 +46,8 @@ LoadManagerSingleton::LoadManagerSingleton(int aLoadMeasurementInterval, mHighLoadThreshold(aHighLoadThreshold), mLowLoadThreshold(aLowLoadThreshold) { + if (!gLoadManagerLog) + gLoadManagerLog = PR_NewLogModule("LoadManager"); LOG(("LoadManager - Initializing (%dms x %d, %f, %f)", mLoadMeasurementInterval, mAveragingMeasurements, mHighLoadThreshold, mLowLoadThreshold)); diff --git a/dom/media/systemservices/LoadManager.h b/dom/media/systemservices/LoadManager.h index 2ede35dbb2de..6088c73dce64 100644 --- a/dom/media/systemservices/LoadManager.h +++ b/dom/media/systemservices/LoadManager.h @@ -16,7 +16,7 @@ #include "webrtc/common_types.h" #include "webrtc/video_engine/include/vie_base.h" -extern mozilla::LazyLogModule gLoadManagerLog; +extern PRLogModuleInfo *gLoadManagerLog; namespace mozilla { diff --git a/dom/media/systemservices/MediaChild.cpp b/dom/media/systemservices/MediaChild.cpp index 0ff3ac081762..eb2d8a76e786 100644 --- a/dom/media/systemservices/MediaChild.cpp +++ b/dom/media/systemservices/MediaChild.cpp @@ -13,7 +13,7 @@ #include "nsQueryObject.h" #undef LOG -mozilla::LazyLogModule gMediaChildLog("MediaChild"); +PRLogModuleInfo *gMediaChildLog; #define LOG(args) MOZ_LOG(gMediaChildLog, mozilla::LogLevel::Debug, args) namespace mozilla { @@ -68,6 +68,9 @@ Child* Child::Get() Child::Child() : mActorDestroyed(false) { + if (!gMediaChildLog) { + gMediaChildLog = PR_NewLogModule("MediaChild"); + } LOG(("media::Child: %p", this)); MOZ_COUNT_CTOR(Child); } diff --git a/dom/media/systemservices/MediaParent.cpp b/dom/media/systemservices/MediaParent.cpp index 4704c0ef5c7c..84a32d41d501 100644 --- a/dom/media/systemservices/MediaParent.cpp +++ b/dom/media/systemservices/MediaParent.cpp @@ -24,7 +24,7 @@ #include "mozilla/Logging.h" #undef LOG -mozilla::LazyLogModule gMediaParentLog("MediaParent"); +PRLogModuleInfo *gMediaParentLog; #define LOG(args) MOZ_LOG(gMediaParentLog, mozilla::LogLevel::Debug, args) // A file in the profile dir is used to persist mOriginKeys used to anonymize @@ -511,6 +511,8 @@ Parent::Parent(bool aSameProcess) , mDestroyed(false) , mSameProcess(aSameProcess) { + if (!gMediaParentLog) + gMediaParentLog = PR_NewLogModule("MediaParent"); LOG(("media::Parent: %p", this)); } diff --git a/dom/media/systemservices/OpenSLESProvider.cpp b/dom/media/systemservices/OpenSLESProvider.cpp index 8b417884e8f2..c15d71a22f78 100644 --- a/dom/media/systemservices/OpenSLESProvider.cpp +++ b/dom/media/systemservices/OpenSLESProvider.cpp @@ -14,7 +14,7 @@ // NSPR_LOG_MODULES=OpenSLESProvider:5 #undef LOG #undef LOG_ENABLED -mozilla::LazyLogModule gOpenSLESProviderLog("OpenSLESProvider"); +PRLogModuleInfo *gOpenSLESProviderLog; #define LOG(args) MOZ_LOG(gOpenSLESProviderLog, mozilla::LogLevel::Debug, args) #define LOG_ENABLED() MOZ_LOG_TEST(gOpenSLESProviderLog, mozilla::LogLevel::Debug) @@ -27,6 +27,8 @@ OpenSLESProvider::OpenSLESProvider() mIsRealized(false), mOpenSLESLib(nullptr) { + if (!gOpenSLESProviderLog) + gOpenSLESProviderLog = PR_NewLogModule("OpenSLESProvider"); LOG(("OpenSLESProvider being initialized")); } diff --git a/dom/media/systemservices/OpenSLESProvider.h b/dom/media/systemservices/OpenSLESProvider.h index 6253e9519ed4..2316dd862137 100644 --- a/dom/media/systemservices/OpenSLESProvider.h +++ b/dom/media/systemservices/OpenSLESProvider.h @@ -28,7 +28,7 @@ SLresult mozilla_realize_sles_engine(SLObjectItf aObjectm); #ifdef __cplusplus #include "mozilla/Mutex.h" -extern mozilla::LazyLogModule gOpenSLESProviderLog; +extern PRLogModuleInfo *gOpenSLESProviderLog; namespace mozilla { diff --git a/dom/media/systemservices/ShmemPool.cpp b/dom/media/systemservices/ShmemPool.cpp index e4d3a054ffbf..cd5e13e86f56 100644 --- a/dom/media/systemservices/ShmemPool.cpp +++ b/dom/media/systemservices/ShmemPool.cpp @@ -11,7 +11,7 @@ #undef LOG #undef LOG_ENABLED -extern mozilla::LazyLogModule gCamerasParentLog; +extern PRLogModuleInfo *gCamerasParentLog; #define LOG(args) MOZ_LOG(gCamerasParentLog, mozilla::LogLevel::Debug, args) #define LOG_ENABLED() MOZ_LOG_TEST(gCamerasParentLog, mozilla::LogLevel::Debug) diff --git a/dom/media/wave/WaveReader.cpp b/dom/media/wave/WaveReader.cpp index ec820c73ee42..9cb7d7855bdc 100644 --- a/dom/media/wave/WaveReader.cpp +++ b/dom/media/wave/WaveReader.cpp @@ -23,7 +23,7 @@ namespace mozilla { // Un-comment to enable logging of seek bisections. //#define SEEK_LOGGING -extern LazyLogModule gMediaDecoderLog; +extern PRLogModuleInfo* gMediaDecoderLog; #define LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) #ifdef SEEK_LOGGING #define SEEK_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) diff --git a/dom/media/webm/AudioDecoder.cpp b/dom/media/webm/AudioDecoder.cpp index cd2bd0342318..ac3fceca28f2 100644 --- a/dom/media/webm/AudioDecoder.cpp +++ b/dom/media/webm/AudioDecoder.cpp @@ -28,7 +28,7 @@ namespace mozilla { -extern LazyLogModule gMediaDecoderLog; +extern PRLogModuleInfo* gMediaDecoderLog; ogg_packet InitOggPacket(const unsigned char* aData, size_t aLength, bool aBOS, bool aEOS, diff --git a/dom/media/webm/WebMDemuxer.cpp b/dom/media/webm/WebMDemuxer.cpp index 80e75eb1d40c..d8687e094c25 100644 --- a/dom/media/webm/WebMDemuxer.cpp +++ b/dom/media/webm/WebMDemuxer.cpp @@ -32,8 +32,8 @@ namespace mozilla { using namespace gfx; -LazyLogModule gWebMDemuxerLog("WebMDemuxer"); -extern LazyLogModule gNesteggLog; +PRLogModuleInfo* gWebMDemuxerLog = nullptr; +extern PRLogModuleInfo* gNesteggLog; // How far ahead will we look when searching future keyframe. In microseconds. // This value is based on what appears to be a reasonable value as most webm @@ -145,6 +145,12 @@ WebMDemuxer::WebMDemuxer(MediaResource* aResource, bool aIsMediaSource) , mLastWebMBlockOffset(-1) , mIsMediaSource(aIsMediaSource) { + if (!gNesteggLog) { + gNesteggLog = PR_NewLogModule("Nestegg"); + } + if (!gWebMDemuxerLog) { + gWebMDemuxerLog = PR_NewLogModule("WebMDemuxer"); + } } WebMDemuxer::~WebMDemuxer() diff --git a/dom/media/webm/WebMReader.cpp b/dom/media/webm/WebMReader.cpp index 4083d49483f3..9095b5d1c328 100644 --- a/dom/media/webm/WebMReader.cpp +++ b/dom/media/webm/WebMReader.cpp @@ -39,8 +39,8 @@ using namespace gfx; using namespace layers; using namespace media; -extern LazyLogModule gMediaDecoderLog; -LazyLogModule gNesteggLog("Nestegg"); +extern PRLogModuleInfo* gMediaDecoderLog; +PRLogModuleInfo* gNesteggLog; // Functions for reading and seeking using MediaResource required for // nestegg_io. The 'user data' passed to these functions is the @@ -137,6 +137,9 @@ WebMReader::WebMReader(AbstractMediaDecoder* aDecoder) , mResource(aDecoder->GetResource()) { MOZ_COUNT_CTOR(WebMReader); + if (!gNesteggLog) { + gNesteggLog = PR_NewLogModule("Nestegg"); + } } WebMReader::~WebMReader() diff --git a/dom/media/webrtc/MediaEngineCameraVideoSource.cpp b/dom/media/webrtc/MediaEngineCameraVideoSource.cpp index 40c38f56990a..789e67a9fd54 100644 --- a/dom/media/webrtc/MediaEngineCameraVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineCameraVideoSource.cpp @@ -11,7 +11,7 @@ namespace mozilla { using namespace mozilla::gfx; using namespace mozilla::dom; -extern LogModule* GetMediaManagerLog(); +extern PRLogModuleInfo* GetMediaManagerLog(); #define LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg) #define LOGFRAME(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Verbose, msg) diff --git a/dom/media/webrtc/MediaEngineGonkVideoSource.cpp b/dom/media/webrtc/MediaEngineGonkVideoSource.cpp index 33c565add981..22fe90c1f253 100644 --- a/dom/media/webrtc/MediaEngineGonkVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineGonkVideoSource.cpp @@ -25,7 +25,7 @@ using namespace mozilla::gfx; using namespace android; #undef LOG -extern LogModule* GetMediaManagerLog(); +extern PRLogModuleInfo* GetMediaManagerLog(); #define LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg) #define LOGFRAME(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Verbose, msg) diff --git a/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp b/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp index 319f8a2d1f38..e2d898740dbf 100644 --- a/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp @@ -11,7 +11,7 @@ #include "MediaTrackConstraints.h" #include "CamerasChild.h" -extern mozilla::LogModule* GetMediaManagerLog(); +extern PRLogModuleInfo* GetMediaManagerLog(); #define LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg) #define LOGFRAME(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Verbose, msg) diff --git a/dom/media/webrtc/MediaEngineWebRTC.cpp b/dom/media/webrtc/MediaEngineWebRTC.cpp index 650656c5c032..bac98880c871 100644 --- a/dom/media/webrtc/MediaEngineWebRTC.cpp +++ b/dom/media/webrtc/MediaEngineWebRTC.cpp @@ -13,10 +13,12 @@ #include "mozilla/Logging.h" -static mozilla::LogModule* +static PRLogModuleInfo* GetUserMediaLog() { - static mozilla::LazyLogModule sLog("GetUserMedia"); + static PRLogModuleInfo *sLog; + if (!sLog) + sLog = PR_NewLogModule("GetUserMedia"); return sLog; } diff --git a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp index 57c5ad2aff72..dd72ff0b3732 100644 --- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp +++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp @@ -35,7 +35,7 @@ namespace mozilla { #undef LOG #endif -extern LogModule* GetMediaManagerLog(); +extern PRLogModuleInfo* GetMediaManagerLog(); #define LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg) #define LOG_FRAMES(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Verbose, msg) diff --git a/dom/media/webspeech/recognition/SpeechRecognition.cpp b/dom/media/webspeech/recognition/SpeechRecognition.cpp index 04e3862e0cef..0c2cb7f7a1a4 100644 --- a/dom/media/webspeech/recognition/SpeechRecognition.cpp +++ b/dom/media/webspeech/recognition/SpeechRecognition.cpp @@ -56,10 +56,14 @@ static const uint32_t kSPEECH_DETECTION_TIMEOUT_MS = 10000; // kSAMPLE_RATE frames = 1s, kESTIMATION_FRAMES frames = 300ms static const uint32_t kESTIMATION_SAMPLES = 300 * kSAMPLE_RATE / 1000; -LogModule* +PRLogModuleInfo* GetSpeechRecognitionLog() { - static LazyLogModule sLog("SpeechRecognition"); + static PRLogModuleInfo* sLog; + if (!sLog) { + sLog = PR_NewLogModule("SpeechRecognition"); + } + return sLog; } #define SR_LOG(...) MOZ_LOG(GetSpeechRecognitionLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) diff --git a/dom/media/webspeech/recognition/SpeechRecognition.h b/dom/media/webspeech/recognition/SpeechRecognition.h index 6fe4dc3bd98d..bce648ea6b8a 100644 --- a/dom/media/webspeech/recognition/SpeechRecognition.h +++ b/dom/media/webspeech/recognition/SpeechRecognition.h @@ -46,7 +46,7 @@ namespace dom { class GlobalObject; class SpeechEvent; -LogModule* GetSpeechRecognitionLog(); +PRLogModuleInfo* GetSpeechRecognitionLog(); #define SR_LOG(...) MOZ_LOG(GetSpeechRecognitionLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) class SpeechRecognition final : public DOMEventTargetHelper, diff --git a/dom/media/webspeech/synth/SpeechSynthesis.cpp b/dom/media/webspeech/synth/SpeechSynthesis.cpp index f0942b25becf..1d9888841130 100644 --- a/dom/media/webspeech/synth/SpeechSynthesis.cpp +++ b/dom/media/webspeech/synth/SpeechSynthesis.cpp @@ -16,10 +16,14 @@ #include "nsIDocument.h" #undef LOG -mozilla::LogModule* +PRLogModuleInfo* GetSpeechSynthLog() { - static mozilla::LazyLogModule sLog("SpeechSynthesis"); + static PRLogModuleInfo* sLog = nullptr; + + if (!sLog) { + sLog = PR_NewLogModule("SpeechSynthesis"); + } return sLog; } diff --git a/dom/media/webspeech/synth/nsSpeechTask.cpp b/dom/media/webspeech/synth/nsSpeechTask.cpp index 01f56216f87a..149f1c5bd76c 100644 --- a/dom/media/webspeech/synth/nsSpeechTask.cpp +++ b/dom/media/webspeech/synth/nsSpeechTask.cpp @@ -18,7 +18,7 @@ #endif #undef LOG -extern mozilla::LogModule* GetSpeechSynthLog(); +extern PRLogModuleInfo* GetSpeechSynthLog(); #define LOG(type, msg) MOZ_LOG(GetSpeechSynthLog(), type, msg) #define AUDIO_TRACK 1 diff --git a/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp b/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp index f1f5442deeb8..3cf59f72e321 100644 --- a/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp +++ b/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp @@ -24,7 +24,7 @@ #include "SpeechSynthesisParent.h" #undef LOG -extern mozilla::LogModule* GetSpeechSynthLog(); +extern PRLogModuleInfo* GetSpeechSynthLog(); #define LOG(type, msg) MOZ_LOG(GetSpeechSynthLog(), type, msg) namespace { diff --git a/media/libstagefright/binding/MoofParser.cpp b/media/libstagefright/binding/MoofParser.cpp index 415ac353a32b..f3c7a0e763c5 100644 --- a/media/libstagefright/binding/MoofParser.cpp +++ b/media/libstagefright/binding/MoofParser.cpp @@ -11,7 +11,7 @@ #include "mozilla/Logging.h" #if defined(MOZ_FMP4) -extern mozilla::LogModule* GetDemuxerLog(); +extern PRLogModuleInfo* GetDemuxerLog(); #define STRINGIFY(x) #x #define TOSTRING(x) STRINGIFY(x) diff --git a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp index 991a3582355f..49d63b31b6a1 100644 --- a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp +++ b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp @@ -33,7 +33,7 @@ namespace mozilla { #endif #ifdef MOZILLA_INTERNAL_API -extern mozilla::LogModule* GetGMPLog(); +extern PRLogModuleInfo* GetGMPLog(); #else // For CPP unit tests PRLogModuleInfo*