Bug 1402584 - per comment 16, add more logs for debugging.
MozReview-Commit-ID: 9DDz0HNqgu2
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -6053,19 +6053,20 @@ void HTMLMediaElement::ChangeReadyState(
mReadyState >= nsIDOMHTMLMediaElement::HAVE_ENOUGH_DATA) {
DispatchAsyncEvent(NS_LITERAL_STRING("canplaythrough"));
}
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
if (mReadyState >= nsIDOMHTMLMediaElement::HAVE_METADATA && mDecoder &&
!mDecoder->IsMetadataLoaded()) {
MOZ_CRASH_UNSAFE_PRINTF(
- "Metadata not loaded! readyState=%d networkState=%d",
+ "Metadata not loaded! readyState=%d networkState=%d oldState=%d",
static_cast<int>(mReadyState.Ref()),
- static_cast<int>(mNetworkState));
+ static_cast<int>(mNetworkState),
+ static_cast<int>(oldState));
}
#endif
}
static const char* const gNetworkStateToString[] = {
"EMPTY",
"IDLE",
"LOADING",
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -712,21 +712,23 @@ MediaDecoder::OnMetadataUpdate(TimedMeta
void
MediaDecoder::MetadataLoaded(UniquePtr<MediaInfo> aInfo,
UniquePtr<MetadataTags> aTags,
MediaDecoderEventVisibility aEventVisibility)
{
MOZ_ASSERT(NS_IsMainThread());
AbstractThread::AutoEnter context(AbstractMainThread());
MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
+ MOZ_DIAGNOSTIC_ASSERT(aInfo, "Null media info!");
LOG("MetadataLoaded, channels=%u rate=%u hasAudio=%d hasVideo=%d",
aInfo->mAudio.mChannels, aInfo->mAudio.mRate,
aInfo->HasAudio(), aInfo->HasVideo());
+ mMetadataLoaded = true;
mMediaSeekable = aInfo->mMediaSeekable;
mMediaSeekableOnlyInBufferedRanges = aInfo->mMediaSeekableOnlyInBufferedRanges;
mInfo = aInfo.release();
GetOwner()->ConstructMediaTracks(mInfo);
// Make sure the element and the frame (if any) are told about
// our new size.
if (aEventVisibility != MediaDecoderEventVisibility::Suppressed) {
--- a/dom/media/MediaDecoder.h
+++ b/dom/media/MediaDecoder.h
@@ -235,17 +235,17 @@ public:
MediaDecoderStateMachine* GetStateMachine() const;
void SetStateMachine(MediaDecoderStateMachine* aStateMachine);
// Constructs the time ranges representing what segments of the media
// are buffered and playable.
virtual media::TimeIntervals GetBuffered();
// For debugging bug 1402584.
- bool IsMetadataLoaded() const { return !!mInfo; }
+ bool IsMetadataLoaded() const { return mMetadataLoaded; }
// Returns the size, in bytes, of the heap memory used by the currently
// queued decoded video and audio data.
size_t SizeOfVideoQueue();
size_t SizeOfAudioQueue();
// Helper struct for accumulating resource sizes that need to be measured
// asynchronously. Once all references are dropped the callback will be
@@ -693,13 +693,14 @@ public:
private:
// Notify owner when the audible state changed
void NotifyAudibleStateChanged();
bool mTelemetryReported;
const MediaContainerType mContainerType;
bool mCanPlayThrough = false;
+ bool mMetadataLoaded = false;
};
} // namespace mozilla
#endif