Bug 1402584 - add logs for debugging. See comment 5 for the detail. r=gerald

MozReview-Commit-ID: 48zKkVt5hbK

--HG--
extra : rebase_source : 91a12ef83c5b2560eafe9f41226bfa87413aba92
This commit is contained in:
JW Wang 2017-10-02 13:51:04 +08:00
Родитель e9d579fe2a
Коммит 06967bc27c
2 изменённых файлов: 24 добавлений и 0 удалений

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

@ -2845,6 +2845,17 @@ HTMLMediaElement::Seek(double aTime,
mPlayingBeforeSeek = IsPotentiallyPlaying();
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
if (!mDecoder->IsMetadataLoaded()) {
// This is for debugging bug 1402584.
// We should reach here only after metadata loaded by the decoder.
MOZ_CRASH_UNSAFE_PRINTF(
"Metadata not loaded! readyState=%d networkState=%d",
static_cast<int>(mReadyState.Ref()),
static_cast<int>(mNetworkState));
}
#endif
// The media backend is responsible for dispatching the timeupdate
// event if it changes the playback position as a result of the seek.
LOG(LogLevel::Debug, ("%p SetCurrentTime(%f) starting seek", this, aTime));
@ -6042,6 +6053,16 @@ void HTMLMediaElement::ChangeReadyState(nsMediaReadyState aState)
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",
static_cast<int>(mReadyState.Ref()),
static_cast<int>(mNetworkState));
}
#endif
}
static const char* const gNetworkStateToString[] = {

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

@ -239,6 +239,9 @@ public:
// are buffered and playable.
virtual media::TimeIntervals GetBuffered();
// For debugging bug 1402584.
bool IsMetadataLoaded() const { return !!mInfo; }
// Returns the size, in bytes, of the heap memory used by the currently
// queued decoded video and audio data.
size_t SizeOfVideoQueue();