Bug 1611622 - Add some logging to MediaBufferDecoder.cpp. r=bryce

Differential Revision: https://phabricator.services.mozilla.com/D70894
This commit is contained in:
Paul Adenot 2020-04-17 17:55:59 +00:00
Родитель 1e20b5d27c
Коммит 60a6cea746
1 изменённых файлов: 16 добавлений и 0 удалений

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

@ -31,6 +31,7 @@
#include "WebAudioUtils.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Logging.h"
#include "nsPrintfCString.h"
#include "AudioNodeEngine.h"
@ -38,6 +39,9 @@ namespace mozilla {
extern LazyLogModule gMediaDecoderLog;
#define LOG(x, ...) \
MOZ_LOG(gMediaDecoderLog, LogLevel::Debug, (x, ##__VA_ARGS__))
using namespace dom;
class ReportResultTask final : public Runnable {
@ -242,6 +246,7 @@ void MediaDecodeTask::OnInitDemuxerCompleted() {
if (!!mDemuxer->GetNumberTracks(TrackInfo::kAudioTrack)) {
mTrackDemuxer = mDemuxer->GetTrackDemuxer(TrackInfo::kAudioTrack, 0);
if (!mTrackDemuxer) {
LOG("MediaDecodeTask: Could not get a track demuxer.");
ReportFailureOnMainThread(WebAudioDecodeJob::UnknownContent);
return;
}
@ -256,6 +261,7 @@ void MediaDecodeTask::OnInitDemuxerCompleted() {
}
if (NS_FAILED(CreateDecoder(*mMediaInfo.mAudio.GetAsAudioInfo()))) {
LOG("MediaDecodeTask: Could not create a decoder.");
ReportFailureOnMainThread(WebAudioDecodeJob::UnknownContent);
return;
}
@ -265,6 +271,7 @@ void MediaDecodeTask::OnInitDemuxerCompleted() {
void MediaDecodeTask::OnInitDemuxerFailed(const MediaResult& aError) {
MOZ_ASSERT(OnPDecoderTaskQueue());
LOG("MediaDecodeTask: Could not initialize the demuxer.");
ReportFailureOnMainThread(WebAudioDecodeJob::InvalidContent);
}
@ -308,6 +315,7 @@ void MediaDecodeTask::OnInitDecoderFailed() {
MOZ_ASSERT(OnPDecoderTaskQueue());
ShutdownDecoder();
LOG("MediaDecodeTask: Could not initialize the decoder");
ReportFailureOnMainThread(WebAudioDecodeJob::InvalidContent);
}
@ -336,6 +344,7 @@ void MediaDecodeTask::OnAudioDemuxFailed(const MediaResult& aError) {
DoDecode();
} else {
ShutdownDecoder();
LOG("MediaDecodeTask: Audio demux failed");
ReportFailureOnMainThread(WebAudioDecodeJob::InvalidContent);
}
}
@ -394,6 +403,7 @@ void MediaDecodeTask::OnAudioDecodeFailed(const MediaResult& aError) {
MOZ_ASSERT(OnPDecoderTaskQueue());
ShutdownDecoder();
LOG("MediaDecodeTask: decode audio failed.");
ReportFailureOnMainThread(WebAudioDecodeJob::InvalidContent);
}
@ -427,6 +437,7 @@ void MediaDecodeTask::OnAudioDrainFailed(const MediaResult& aError) {
MOZ_ASSERT(OnPDecoderTaskQueue());
ShutdownDecoder();
LOG("MediaDecodeTask: Drain audio failed");
ReportFailureOnMainThread(WebAudioDecodeJob::InvalidContent);
}
@ -452,6 +463,8 @@ void MediaDecodeTask::FinishDecode() {
uint32_t sampleRate = mMediaInfo.mAudio.mRate;
if (!frameCount || !channelCount || !sampleRate) {
LOG("MediaDecodeTask: invalid content frame count, channel count or "
"sample-rate");
ReportFailureOnMainThread(WebAudioDecodeJob::InvalidContent);
return;
}
@ -483,6 +496,7 @@ void MediaDecodeTask::FinishDecode() {
ThreadSharedFloatArrayBufferList::Create(channelCount, resampledFrames,
fallible);
if (!buffer) {
LOG("MediaDecodeTask: Could not create final buffer (f32)");
ReportFailureOnMainThread(WebAudioDecodeJob::UnknownError);
return;
}
@ -495,6 +509,7 @@ void MediaDecodeTask::FinishDecode() {
bufferSize *= channelCount;
RefPtr<SharedBuffer> buffer = SharedBuffer::Create(bufferSize);
if (!buffer) {
LOG("MediaDecodeTask: Could not create final buffer (i16)");
ReportFailureOnMainThread(WebAudioDecodeJob::UnknownError);
return;
}
@ -581,6 +596,7 @@ void MediaDecodeTask::AllocateBuffer() {
MOZ_ASSERT(NS_IsMainThread());
if (!mDecodeJob.AllocateBuffer()) {
LOG("MediaDecodeTask: Could not allocate final buffer");
ReportFailureOnMainThread(WebAudioDecodeJob::UnknownError);
return;
}