Bug 950840 - Rename some logging macros in content/media/wmf; r=cpearce

This commit is contained in:
Ehsan Akhgari 2013-12-17 14:43:29 -05:00
Родитель e396fc159d
Коммит c0846a3517
3 изменённых файлов: 68 добавлений и 68 удалений

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

@ -26,9 +26,9 @@ namespace mozilla {
#ifdef PR_LOGGING
PRLogModuleInfo* gWMFByteStreamLog = nullptr;
#define LOG(...) PR_LOG(gWMFByteStreamLog, PR_LOG_DEBUG, (__VA_ARGS__))
#define WMF_BS_LOG(...) PR_LOG(gWMFByteStreamLog, PR_LOG_DEBUG, (__VA_ARGS__))
#else
#define LOG(...)
#define WMF_BS_LOG(...)
#endif
// Limit the number of threads that we use for IO.
@ -116,7 +116,7 @@ WMFByteStream::WMFByteStream(MediaResource* aResource,
gWMFByteStreamLog = PR_NewLogModule("WMFByteStream");
}
#endif
LOG("[%p] WMFByteStream CTOR", this);
WMF_BS_LOG("[%p] WMFByteStream CTOR", this);
MOZ_COUNT_CTOR(WMFByteStream);
}
@ -129,7 +129,7 @@ WMFByteStream::~WMFByteStream()
nsCOMPtr<nsIRunnable> event =
new ReleaseWMFByteStreamResourcesEvent(mResource.forget());
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
LOG("[%p] WMFByteStream DTOR", this);
WMF_BS_LOG("[%p] WMFByteStream DTOR", this);
}
nsresult
@ -180,7 +180,7 @@ WMFByteStream::Init()
contentTypeUTF16.get());
NS_ENSURE_TRUE(SUCCEEDED(hr), NS_ERROR_FAILURE);
LOG("[%p] WMFByteStream has Content-Type=%s", this, mResource->GetContentType().get());
WMF_BS_LOG("[%p] WMFByteStream has Content-Type=%s", this, mResource->GetContentType().get());
}
return NS_OK;
}
@ -200,7 +200,7 @@ WMFByteStream::Shutdown()
STDMETHODIMP
WMFByteStream::QueryInterface(REFIID aIId, void **aInterface)
{
LOG("[%p] WMFByteStream::QueryInterface %s", this, GetGUIDName(aIId).get());
WMF_BS_LOG("[%p] WMFByteStream::QueryInterface %s", this, GetGUIDName(aIId).get());
if (aIId == IID_IMFByteStream) {
return DoGetInterface(static_cast<IMFByteStream*>(this), aInterface);
@ -252,7 +252,7 @@ NS_IMPL_RELEASE(ReadRequest)
STDMETHODIMP
ReadRequest::QueryInterface(REFIID aIId, void **aInterface)
{
LOG("ReadRequest::QueryInterface %s", GetGUIDName(aIId).get());
WMF_BS_LOG("ReadRequest::QueryInterface %s", GetGUIDName(aIId).get());
if (aIId == IID_IUnknown) {
return DoGetInterface(static_cast<IUnknown*>(this), aInterface);
@ -292,8 +292,8 @@ WMFByteStream::BeginRead(BYTE *aBuffer,
NS_ENSURE_TRUE(aCallback, E_POINTER);
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
LOG("[%p] WMFByteStream::BeginRead() mOffset=%lld tell=%lld length=%lu mIsShutdown=%d",
this, mOffset, mResource->Tell(), aLength, mIsShutdown);
WMF_BS_LOG("[%p] WMFByteStream::BeginRead() mOffset=%lld tell=%lld length=%lu mIsShutdown=%d",
this, mOffset, mResource->Tell(), aLength, mIsShutdown);
if (mIsShutdown || mOffset < 0) {
return E_INVALIDARG;
@ -359,7 +359,7 @@ WMFByteStream::ProcessReadRequest(IMFAsyncResult* aResult,
aRequestState->mOffset > mResource->GetLength()) {
aResult->SetStatus(S_OK);
wmf::MFInvokeCallback(aResult);
LOG("[%p] WMFByteStream::ProcessReadRequest() read offset greater than length, soft-failing read", this);
WMF_BS_LOG("[%p] WMFByteStream::ProcessReadRequest() read offset greater than length, soft-failing read", this);
return;
}
@ -371,8 +371,8 @@ WMFByteStream::ProcessReadRequest(IMFAsyncResult* aResult,
aResult->SetStatus(S_OK);
}
LOG("[%p] WMFByteStream::ProcessReadRequest() read %d at %lld finished rv=%x",
this, aRequestState->mBytesRead, aRequestState->mOffset, rv);
WMF_BS_LOG("[%p] WMFByteStream::ProcessReadRequest() read %d at %lld finished rv=%x",
this, aRequestState->mBytesRead, aRequestState->mOffset, rv);
// Let caller know read is complete.
DebugOnly<HRESULT> hr = wmf::MFInvokeCallback(aResult);
@ -384,14 +384,14 @@ WMFByteStream::BeginWrite(const BYTE *, ULONG ,
IMFAsyncCallback *,
IUnknown *)
{
LOG("[%p] WMFByteStream::BeginWrite()", this);
WMF_BS_LOG("[%p] WMFByteStream::BeginWrite()", this);
return E_NOTIMPL;
}
STDMETHODIMP
WMFByteStream::Close()
{
LOG("[%p] WMFByteStream::Close()", this);
WMF_BS_LOG("[%p] WMFByteStream::Close()", this);
return S_OK;
}
@ -415,8 +415,8 @@ WMFByteStream::EndRead(IMFAsyncResult* aResult, ULONG *aBytesRead)
// Report result.
*aBytesRead = requestState->mBytesRead;
LOG("[%p] WMFByteStream::EndRead() offset=%lld *aBytesRead=%u mOffset=%lld status=0x%x hr=0x%x eof=%d",
this, requestState->mOffset, *aBytesRead, mOffset, aResult->GetStatus(), hr, IsEOS());
WMF_BS_LOG("[%p] WMFByteStream::EndRead() offset=%lld *aBytesRead=%u mOffset=%lld status=0x%x hr=0x%x eof=%d",
this, requestState->mOffset, *aBytesRead, mOffset, aResult->GetStatus(), hr, IsEOS());
return aResult->GetStatus();
}
@ -424,21 +424,21 @@ WMFByteStream::EndRead(IMFAsyncResult* aResult, ULONG *aBytesRead)
STDMETHODIMP
WMFByteStream::EndWrite(IMFAsyncResult *, ULONG *)
{
LOG("[%p] WMFByteStream::EndWrite()", this);
WMF_BS_LOG("[%p] WMFByteStream::EndWrite()", this);
return E_NOTIMPL;
}
STDMETHODIMP
WMFByteStream::Flush()
{
LOG("[%p] WMFByteStream::Flush()", this);
WMF_BS_LOG("[%p] WMFByteStream::Flush()", this);
return S_OK;
}
STDMETHODIMP
WMFByteStream::GetCapabilities(DWORD *aCapabilities)
{
LOG("[%p] WMFByteStream::GetCapabilities()", this);
WMF_BS_LOG("[%p] WMFByteStream::GetCapabilities()", this);
NS_ENSURE_TRUE(aCapabilities, E_POINTER);
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
bool seekable = mResource->IsTransportSeekable();
@ -463,7 +463,7 @@ WMFByteStream::GetCurrentPosition(QWORD *aPosition)
// seek to < 0 and read, the read is expected to fails... So
// go figure...
*aPosition = mOffset < 0 ? mResource->GetLength() : mOffset;
LOG("[%p] WMFByteStream::GetCurrentPosition() %lld", this, mOffset);
WMF_BS_LOG("[%p] WMFByteStream::GetCurrentPosition() %lld", this, mOffset);
return S_OK;
}
@ -473,7 +473,7 @@ WMFByteStream::GetLength(QWORD *aLength)
NS_ENSURE_TRUE(aLength, E_POINTER);
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
*aLength = mResource->GetLength();
LOG("[%p] WMFByteStream::GetLength() %lld", this, *aLength);
WMF_BS_LOG("[%p] WMFByteStream::GetLength() %lld", this, *aLength);
return S_OK;
}
@ -491,7 +491,7 @@ WMFByteStream::IsEndOfStream(BOOL *aEndOfStream)
{
NS_ENSURE_TRUE(aEndOfStream, E_POINTER);
*aEndOfStream = IsEOS();
LOG("[%p] WMFByteStream::IsEndOfStream() %d", this, *aEndOfStream);
WMF_BS_LOG("[%p] WMFByteStream::IsEndOfStream() %d", this, *aEndOfStream);
return S_OK;
}
@ -501,14 +501,14 @@ WMFByteStream::Read(BYTE* aBuffer, ULONG aBufferLength, ULONG* aOutBytesRead)
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
ReadRequest request(mOffset, aBuffer, aBufferLength);
if (NS_FAILED(Read(&request))) {
LOG("[%p] WMFByteStream::Read() offset=%lld failed!", this, mOffset);
WMF_BS_LOG("[%p] WMFByteStream::Read() offset=%lld failed!", this, mOffset);
return E_FAIL;
}
if (aOutBytesRead) {
*aOutBytesRead = request.mBytesRead;
}
LOG("[%p] WMFByteStream::Read() offset=%lld length=%u bytesRead=%u",
this, mOffset, aBufferLength, request.mBytesRead);
WMF_BS_LOG("[%p] WMFByteStream::Read() offset=%lld length=%u bytesRead=%u",
this, mOffset, aBufferLength, request.mBytesRead);
mOffset += request.mBytesRead;
return S_OK;
}
@ -519,7 +519,7 @@ WMFByteStream::Seek(MFBYTESTREAM_SEEK_ORIGIN aSeekOrigin,
DWORD aSeekFlags,
QWORD *aCurrentPosition)
{
LOG("[%p] WMFByteStream::Seek(%d, %lld)", this, aSeekOrigin, aSeekOffset);
WMF_BS_LOG("[%p] WMFByteStream::Seek(%d, %lld)", this, aSeekOrigin, aSeekOffset);
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
@ -546,8 +546,8 @@ STDMETHODIMP
WMFByteStream::SetCurrentPosition(QWORD aPosition)
{
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
LOG("[%p] WMFByteStream::SetCurrentPosition(%lld)",
this, aPosition);
WMF_BS_LOG("[%p] WMFByteStream::SetCurrentPosition(%lld)",
this, aPosition);
int64_t length = mResource->GetLength();
if (length > -1) {
@ -562,14 +562,14 @@ WMFByteStream::SetCurrentPosition(QWORD aPosition)
STDMETHODIMP
WMFByteStream::SetLength(QWORD)
{
LOG("[%p] WMFByteStream::SetLength()", this);
WMF_BS_LOG("[%p] WMFByteStream::SetLength()", this);
return E_NOTIMPL;
}
STDMETHODIMP
WMFByteStream::Write(const BYTE *, ULONG, ULONG *)
{
LOG("[%p] WMFByteStream::Write()", this);
WMF_BS_LOG("[%p] WMFByteStream::Write()", this);
return E_NOTIMPL;
}

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

@ -32,9 +32,9 @@ namespace mozilla {
#ifdef PR_LOGGING
extern PRLogModuleInfo* gMediaDecoderLog;
#define LOG(...) PR_LOG(gMediaDecoderLog, PR_LOG_DEBUG, (__VA_ARGS__))
#define DECODER_LOG(...) PR_LOG(gMediaDecoderLog, PR_LOG_DEBUG, (__VA_ARGS__))
#else
#define LOG(...)
#define DECODER_LOG(...)
#endif
// Uncomment to enable verbose per-sample logging.
@ -208,7 +208,7 @@ ConfigureSourceReaderStream(IMFSourceReader *aReader,
}
if (!isSubTypeAllowed) {
nsCString name = GetGUIDName(subType);
LOG("ConfigureSourceReaderStream subType=%s is not allowed to be decoded", name.get());
DECODER_LOG("ConfigureSourceReaderStream subType=%s is not allowed to be decoded", name.get());
return E_FAIL;
}
@ -323,12 +323,12 @@ WMFReader::ConfigureVideoFrameGeometry(IMFMediaType* aMediaType)
mVideoHeight = height;
mPictureRegion = pictureRegion;
LOG("WMFReader frame geometry frame=(%u,%u) stride=%u picture=(%d, %d, %d, %d) display=(%d,%d) PAR=%d:%d",
width, height,
mVideoStride,
mPictureRegion.x, mPictureRegion.y, mPictureRegion.width, mPictureRegion.height,
displaySize.width, displaySize.height,
aspectNum, aspectDenom);
DECODER_LOG("WMFReader frame geometry frame=(%u,%u) stride=%u picture=(%d, %d, %d, %d) display=(%d,%d) PAR=%d:%d",
width, height,
mVideoStride,
mPictureRegion.x, mPictureRegion.y, mPictureRegion.width, mPictureRegion.height,
displaySize.width, displaySize.height,
aspectNum, aspectDenom);
return S_OK;
}
@ -354,7 +354,7 @@ WMFReader::ConfigureVideoDecoder()
MP4VideoTypes,
NS_ARRAY_LENGTH(MP4VideoTypes));
if (FAILED(hr)) {
LOG("Failed to configured video output");
DECODER_LOG("Failed to configured video output");
return hr;
}
@ -371,7 +371,7 @@ WMFReader::ConfigureVideoDecoder()
return hr;
}
LOG("Successfully configured video stream");
DECODER_LOG("Successfully configured video stream");
mHasVideo = mInfo.mVideo.mHasVideo = true;
@ -444,8 +444,8 @@ WMFReader::ConfigureAudioDecoder()
mInfo.mAudio.mRate = mAudioRate;
mHasAudio = mInfo.mAudio.mHasAudio = true;
LOG("Successfully configured audio stream. rate=%u channels=%u bitsPerSample=%u",
mAudioRate, mAudioChannels, mAudioBytesPerSample);
DECODER_LOG("Successfully configured audio stream. rate=%u channels=%u bitsPerSample=%u",
mAudioRate, mAudioChannels, mAudioBytesPerSample);
return S_OK;
}
@ -456,7 +456,7 @@ WMFReader::ReadMetadata(MediaInfo* aInfo,
{
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
LOG("WMFReader::ReadMetadata()");
DECODER_LOG("WMFReader::ReadMetadata()");
HRESULT hr;
RefPtr<IMFAttributes> attr;
@ -470,7 +470,7 @@ WMFReader::ReadMetadata(MediaInfo* aInfo,
hr = attr->SetUnknown(MF_SOURCE_READER_D3D_MANAGER,
mDXVA2Manager->GetDXVADeviceManager());
if (FAILED(hr)) {
LOG("Failed to set DXVA2 D3D Device manager on source reader attributes");
DECODER_LOG("Failed to set DXVA2 D3D Device manager on source reader attributes");
mUseHwAccel = false;
}
}
@ -504,7 +504,7 @@ WMFReader::ReadMetadata(MediaInfo* aInfo,
}
}
if (FAILED(hr)) {
LOG("Failed to set DXVA2 D3D Device manager on decoder hr=0x%x", hr);
DECODER_LOG("Failed to set DXVA2 D3D Device manager on decoder hr=0x%x", hr);
mUseHwAccel = false;
// Re-run the configuration process, so that the output video format
// is set correctly to reflect that hardware acceleration is disabled.
@ -515,7 +515,7 @@ WMFReader::ReadMetadata(MediaInfo* aInfo,
}
}
if (mInfo.HasVideo()) {
LOG("Using DXVA: %s", (mUseHwAccel ? "Yes" : "No"));
DECODER_LOG("Using DXVA: %s", (mUseHwAccel ? "Yes" : "No"));
}
// Abort if both video and audio failed to initialize.
@ -559,7 +559,7 @@ WMFReader::DecodeAudioData()
nullptr);
if (FAILED(hr)) {
LOG("WMFReader::DecodeAudioData() ReadSample failed with hr=0x%x", hr);
DECODER_LOG("WMFReader::DecodeAudioData() ReadSample failed with hr=0x%x", hr);
// End the stream.
return false;
}
@ -572,8 +572,8 @@ WMFReader::DecodeAudioData()
(flags & MF_SOURCE_READERF_ERROR) ||
(flags & MF_SOURCE_READERF_ENDOFSTREAM) ||
(flags & MF_SOURCE_READERF_CURRENTMEDIATYPECHANGED)) {
LOG("WMFReader::DecodeAudioData() ReadSample failed with hr=0x%x flags=0x%x",
hr, flags);
DECODER_LOG("WMFReader::DecodeAudioData() ReadSample failed with hr=0x%x flags=0x%x",
hr, flags);
// End the stream.
return false;
}
@ -632,8 +632,8 @@ WMFReader::DecodeAudioData()
mAudioChannels));
#ifdef LOG_SAMPLE_DECODE
LOG("Decoded audio sample! timestamp=%lld duration=%lld currentLength=%u",
timestamp, duration, currentLength);
DECODER_LOG("Decoded audio sample! timestamp=%lld duration=%lld currentLength=%u",
timestamp, duration, currentLength);
#endif
return true;
@ -793,7 +793,7 @@ WMFReader::DecodeVideoFrame(bool &aKeyframeSkip,
nullptr,
nullptr);
if (FAILED(hr)) {
LOG("WMFReader::DecodeVideoData() ReadSample failed with hr=0x%x", hr);
DECODER_LOG("WMFReader::DecodeVideoData() ReadSample failed with hr=0x%x", hr);
return false;
}
@ -815,15 +815,15 @@ WMFReader::DecodeVideoFrame(bool &aKeyframeSkip,
if (!sample) {
if ((flags & MF_SOURCE_READERF_ENDOFSTREAM)) {
LOG("WMFReader; Null sample after video decode, at end of stream");
DECODER_LOG("WMFReader; Null sample after video decode, at end of stream");
return false;
}
LOG("WMFReader; Null sample after video decode. Maybe insufficient data...");
DECODER_LOG("WMFReader; Null sample after video decode. Maybe insufficient data...");
return true;
}
if ((flags & MF_SOURCE_READERF_CURRENTMEDIATYPECHANGED)) {
LOG("WMFReader: Video media type changed!");
DECODER_LOG("WMFReader: Video media type changed!");
RefPtr<IMFMediaType> mediaType;
hr = mSourceReader->GetCurrentMediaType(MF_SOURCE_READER_FIRST_VIDEO_STREAM,
byRef(mediaType));
@ -854,13 +854,13 @@ WMFReader::DecodeVideoFrame(bool &aKeyframeSkip,
mVideoQueue.Push(v);
#ifdef LOG_SAMPLE_DECODE
LOG("Decoded video sample timestamp=%lld duration=%lld stride=%d height=%u flags=%u",
timestamp, duration, mVideoStride, mVideoHeight, flags);
DECODER_LOG("Decoded video sample timestamp=%lld duration=%lld stride=%d height=%u flags=%u",
timestamp, duration, mVideoStride, mVideoHeight, flags);
#endif
if ((flags & MF_SOURCE_READERF_ENDOFSTREAM)) {
// End of stream.
LOG("End of video stream");
DECODER_LOG("End of video stream");
return false;
}
@ -873,7 +873,7 @@ WMFReader::Seek(int64_t aTargetUs,
int64_t aEndTime,
int64_t aCurrentTime)
{
LOG("WMFReader::Seek() %lld", aTargetUs);
DECODER_LOG("WMFReader::Seek() %lld", aTargetUs);
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
#ifdef DEBUG

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

@ -11,16 +11,16 @@ namespace mozilla {
#ifdef PR_LOGGING
static PRLogModuleInfo* gWMFSourceReaderCallbackLog = nullptr;
#define LOG(...) PR_LOG(gWMFSourceReaderCallbackLog, PR_LOG_DEBUG, (__VA_ARGS__))
#define WMF_CB_LOG(...) PR_LOG(gWMFSourceReaderCallbackLog, PR_LOG_DEBUG, (__VA_ARGS__))
#else
#define LOG(...)
#define WMF_CB_LOG(...)
#endif
// IUnknown Methods
STDMETHODIMP
WMFSourceReaderCallback::QueryInterface(REFIID aIId, void **aInterface)
{
LOG("WMFSourceReaderCallback::QueryInterface %s", GetGUIDName(aIId).get());
WMF_CB_LOG("WMFSourceReaderCallback::QueryInterface %s", GetGUIDName(aIId).get());
if (aIId == IID_IMFSourceReaderCallback) {
return DoGetInterface(static_cast<WMFSourceReaderCallback*>(this), aInterface);
@ -96,8 +96,8 @@ WMFSourceReaderCallback::OnReadSample(HRESULT aReadStatus,
LONGLONG aTimestamp,
IMFSample *aSample)
{
LOG("WMFSourceReaderCallback::OnReadSample() hr=0x%x flags=0x%x time=%lld sample=%p",
aReadStatus, aStreamFlags, aTimestamp, aSample);
WMF_CB_LOG("WMFSourceReaderCallback::OnReadSample() hr=0x%x flags=0x%x time=%lld sample=%p",
aReadStatus, aStreamFlags, aTimestamp, aSample);
return NotifyReadComplete(aReadStatus,
aStreamIndex,
aStreamFlags,
@ -108,7 +108,7 @@ WMFSourceReaderCallback::OnReadSample(HRESULT aReadStatus,
HRESULT
WMFSourceReaderCallback::Cancel()
{
LOG("WMFSourceReaderCallback::Cancel()");
WMF_CB_LOG("WMFSourceReaderCallback::Cancel()");
return NotifyReadComplete(E_ABORT,
0,
0,
@ -134,12 +134,12 @@ WMFSourceReaderCallback::Wait(DWORD* aStreamFlags,
IMFSample** aSample)
{
ReentrantMonitorAutoEnter mon(mMonitor);
LOG("WMFSourceReaderCallback::Wait() starting wait");
WMF_CB_LOG("WMFSourceReaderCallback::Wait() starting wait");
while (!mReadFinished) {
mon.Wait();
}
mReadFinished = false;
LOG("WMFSourceReaderCallback::Wait() done waiting");
WMF_CB_LOG("WMFSourceReaderCallback::Wait() done waiting");
*aStreamFlags = mStreamFlags;
*aTimeStamp = mTimestamp;