Bug 1274913 - Use LazyLogModule directly for DirectShow logging. r=rillian

This should help fix unitialized statics crashes on Windows in the DirectShow logging code.

Additional changes are included to fix unified build issues.
This commit is contained in:
Eric Rahm 2016-07-08 11:47:04 -07:00
Родитель f5c6dc41eb
Коммит ddf74ea35b
9 изменённых файлов: 24 добавлений и 25 удалений

Просмотреть файл

@ -23,8 +23,8 @@ using namespace mozilla::media;
namespace mozilla {
extern LogModule* GetDirectShowLog();
#define LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
static LazyLogModule gDirectShowLog("DirectShowDecoder");
#define LOG(...) MOZ_LOG(gDirectShowLog, mozilla::LogLevel::Debug, (__VA_ARGS__))
AudioSinkFilter::AudioSinkFilter(const wchar_t* aObjectName, HRESULT* aOutResult)
: BaseFilter(aObjectName, CLSID_MozAudioSinkFilter),

Просмотреть файл

@ -15,8 +15,8 @@ using namespace mozilla::media;
namespace mozilla {
extern LogModule* GetDirectShowLog();
#define LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
static LazyLogModule gDirectShowLog("DirectShowDecoder");
#define LOG(...) MOZ_LOG(gDirectShowLog, mozilla::LogLevel::Debug, (__VA_ARGS__))
AudioSinkInputPin::AudioSinkInputPin(wchar_t* aObjectName,
AudioSinkFilter* aFilter,

Просмотреть файл

@ -6,6 +6,7 @@
#include "DirectShowDecoder.h"
#include "DirectShowReader.h"
#include "DirectShowUtils.h"
#include "MediaDecoderStateMachine.h"
#include "mozilla/Preferences.h"
#include "mozilla/WindowsVersion.h"

Просмотреть файл

@ -17,13 +17,14 @@ using namespace mozilla::media;
namespace mozilla {
LogModule*
GetDirectShowLog() {
static LazyLogModule log("DirectShowDecoder");
return log;
}
// Windows XP's MP3 decoder filter. This is available on XP only, on Vista
// and later we can use the DMO Wrapper filter and MP3 decoder DMO.
const GUID DirectShowReader::CLSID_MPEG_LAYER_3_DECODER_FILTER =
{ 0x38BE3000, 0xDBF4, 0x11D0, {0x86, 0x0E, 0x00, 0xA0, 0x24, 0xCF, 0xEF, 0x6D} };
#define LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
static LazyLogModule gDirectShowLog("DirectShowDecoder");
#define LOG(...) MOZ_LOG(gDirectShowLog, mozilla::LogLevel::Debug, (__VA_ARGS__))
DirectShowReader::DirectShowReader(AbstractMediaDecoder* aDecoder)
: MediaDecoderReader(aDecoder),
@ -78,11 +79,6 @@ ParseMP3Headers(MP3FrameParser *aParser, MediaResource *aResource)
return aParser->IsMP3() ? NS_OK : NS_ERROR_FAILURE;
}
// Windows XP's MP3 decoder filter. This is available on XP only, on Vista
// and later we can use the DMO Wrapper filter and MP3 decoder DMO.
static const GUID CLSID_MPEG_LAYER_3_DECODER_FILTER =
{ 0x38BE3000, 0xDBF4, 0x11D0, {0x86, 0x0E, 0x00, 0xA0, 0x24, 0xCF, 0xEF, 0x6D} };
nsresult
DirectShowReader::ReadMetadata(MediaInfo* aInfo,
MetadataTags** aTags)

Просмотреть файл

@ -60,6 +60,8 @@ public:
RefPtr<SeekPromise>
Seek(SeekTarget aTarget, int64_t aEndTime) override;
static const GUID CLSID_MPEG_LAYER_3_DECODER_FILTER;
private:
// Notifies the filter graph that playback is complete. aStatus is
// the code to send to the filter graph. Always returns false, so

Просмотреть файл

@ -287,7 +287,7 @@ CanDecodeMP3UsingDirectShow()
}
// Can we create either the WinXP MP3 decoder filter or the MP3 DMO decoder?
if (FAILED(CoCreateInstance(CLSID_MPEG_LAYER_3_DECODER_FILTER,
if (FAILED(CoCreateInstance(DirectShowReader::CLSID_MPEG_LAYER_3_DECODER_FILTER,
nullptr,
CLSCTX_INPROC_SERVER,
IID_IBaseFilter,

Просмотреть файл

@ -14,8 +14,8 @@ using namespace mozilla::media;
namespace mozilla {
extern LogModule* GetDirectShowLog();
#define LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
static LazyLogModule gDirectShowLog("DirectShowDecoder");
#define LOG(...) MOZ_LOG(gDirectShowLog, mozilla::LogLevel::Debug, (__VA_ARGS__))
SampleSink::SampleSink()
: mMonitor("SampleSink"),
@ -65,7 +65,7 @@ SampleSink::Receive(IMediaSample* aSample)
mon.Wait();
}
if (MOZ_LOG_TEST(GetDirectShowLog(), LogLevel::Debug)) {
if (MOZ_LOG_TEST(gDirectShowLog, LogLevel::Debug)) {
REFERENCE_TIME start = 0, end = 0;
HRESULT hr = aSample->GetMediaTime(&start, &end);
LOG("SampleSink::Receive() [%4.2lf-%4.2lf]",
@ -102,7 +102,7 @@ SampleSink::Extract(RefPtr<IMediaSample>& aOutSample)
}
aOutSample = mSample;
if (MOZ_LOG_TEST(GetDirectShowLog(), LogLevel::Debug)) {
if (MOZ_LOG_TEST(gDirectShowLog, LogLevel::Debug)) {
int64_t start = 0, end = 0;
mSample->GetMediaTime(&start, &end);
LOG("SampleSink::Extract() [%4.2lf-%4.2lf]",

Просмотреть файл

@ -20,8 +20,8 @@ namespace mozilla {
//#define DEBUG_SOURCE_TRACE 1
#if defined (DEBUG_SOURCE_TRACE)
extern LogModule* GetDirectShowLog();
#define DIRECTSHOW_LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
static LazyLogModule gDirectShowLog("DirectShowDecoder");
#define DIRECTSHOW_LOG(...) MOZ_LOG(gDirectShowLog, mozilla::LogLevel::Debug, (__VA_ARGS__))
#else
#define DIRECTSHOW_LOG(...)
#endif

Просмотреть файл

@ -13,16 +13,16 @@ EXPORTS += [
]
UNIFIED_SOURCES += [
'AudioSinkInputPin.cpp',
'DirectShowDecoder.cpp',
'DirectShowReader.cpp',
'DirectShowUtils.cpp',
'SampleSink.cpp',
'SourceFilter.cpp',
]
SOURCES += [
'AudioSinkFilter.cpp',
'AudioSinkInputPin.cpp',
'DirectShowReader.cpp',
'SampleSink.cpp',
]
# If WebRTC isn't being built, we need to compile the DirectShow base classes so that