import changes from `dev' branch of rmottola/Arctic-Fox:

- bug 1191889 skip Close() when not initialized r=roc (9bbb78c01e)
- Bug 1175319 - Remove outdated MDSM documenation. r=jya DONTBUILD (775d7b1cb4)
- Bug 1265978. Part 1 - add mozDumpDebugInfo() to HTMLMediaElement.webidl. r=bz. (6518ad6a08)
- Bug 1265978. Part 2 - add methods to MediaDecoder and MDSM to dump debugging info. r=jya. (1b8ad138c8)
- Bug 1265978. Part 2.5 - also dump reader data. r=jya. (d866537269)
- Bug 1265978. Part 3 - invoke mozDumpDebugInfo() from JS. r=jya. (7a5a7b5837)
This commit is contained in:
2024-06-28 23:13:42 +08:00
parent 9c8d43b8a2
commit f69c4dc576
11 changed files with 97 additions and 181 deletions
+26
View File
@@ -63,6 +63,7 @@ using namespace mozilla::media;
#undef LOG
#undef DECODER_LOG
#undef VERBOSE_LOG
#undef DUMP_LOG
#define LOG(m, l, x, ...) \
MOZ_LOG(m, l, ("Decoder=%p " x, mDecoderID, ##__VA_ARGS__))
@@ -79,6 +80,9 @@ using namespace mozilla::media;
#define DECODER_WARN(x, ...) \
DECODER_WARN_HELPER(0, (nsPrintfCString("Decoder=%p " x, mDecoderID, ##__VA_ARGS__).get()))
#define DUMP_LOG(x, ...) \
NS_DebugBreak(NS_DEBUG_WARNING, nsPrintfCString("Decoder=%p " x, mDecoderID, ##__VA_ARGS__).get(), nullptr, nullptr, -1)
// Certain constants get stored as member variables and then adjusted by various
// scale factors on a per-decoder basis. We want to make sure to avoid using these
// constants directly, so we put them in a namespace.
@@ -2867,6 +2871,28 @@ uint32_t MediaDecoderStateMachine::GetAmpleVideoFrames() const
: std::max<uint32_t>(sVideoQueueDefaultSize, MIN_VIDEO_QUEUE_SIZE);
}
void
MediaDecoderStateMachine::DumpDebugInfo()
{
MOZ_ASSERT(NS_IsMainThread());
// It is fine to capture a raw pointer here because MediaDecoder only call
// this function before shutdown begins.
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([this] () {
DUMP_LOG(
"GetMediaTime=%lld GetClock=%lld "
"mState=%s mPlayState=%d mDecodingFirstFrame=%d IsPlaying=%d "
"mAudioStatus=%s mVideoStatus=%s mDecodedAudioEndTime=%lld mDecodedVideoEndTime=%lld "
"mIsAudioPrerolling=%d mIsVideoPrerolling=%d",
GetMediaTime(), mMediaSink->IsStarted() ? GetClock() : -1,
gMachineStateStr[mState], mPlayState.Ref(), mDecodingFirstFrame, IsPlaying(),
AudioRequestStatus(), VideoRequestStatus(), mDecodedAudioEndTime, mDecodedVideoEndTime,
mIsAudioPrerolling, mIsVideoPrerolling);
});
OwnerThread()->DispatchStateChange(r.forget());
}
void MediaDecoderStateMachine::AddOutputStream(ProcessedMediaStream* aStream,
bool aFinishWhenEnded)
{