Closed Bug 1265978 Opened 8 years ago Closed 8 years ago

Add a method to HTMLMediaElement to print debugging information when mochitest times out

Categories

(Core :: Audio/Video: Playback, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla48
Tracking Status
firefox48 --- fixed

People

(Reporter: jwwang, Assigned: jwwang)

References

Details

Attachments

(4 files, 2 obsolete files)

We will add |void mozDumpDebugInfo()| to HTMLMediaElement.webidl.

The usage is like:

SimpleTest.registerTimeoutFunction(function() {
  for (var v of document.getElementsByTagName("video")) {
    v.mozDumpDebugInfo();
  }
  for (var a of document.getElementsByTagName("audio")) {
    a.mozDumpDebugInfo();
  }
});

This method will dump object states to PR logs to help debugging.
Assignee: nobody → jwwang
Blocks: 1259650
Depends on: 1259651
Attachment #8744131 - Flags: review?(bzbarsky)
Attachment #8744132 - Flags: review?(jyavenard)
Attachment #8744133 - Flags: review?(jyavenard)
Comment on attachment 8744131 [details] [diff] [review]
1265978_part1_add_mozDumpDebugInfo.patch

We do not want to expose this to the web.  Either condition it on some pref that's set only when running tests or make it chrome-only and call it via SpecialPowers.wrap, or something.
Attachment #8744131 - Flags: review?(bzbarsky) → review-
Attachment #8744133 - Flags: review?(jyavenard)
Hide the function behind pref "media.test.dumpDebugInfo" which will be preffed on only during testing.
Attachment #8744131 - Attachment is obsolete: true
Attachment #8744148 - Flags: review?(bzbarsky)
Comment on attachment 8744148 [details] [diff] [review]
1265978_part1_add_mozDumpDebugInfo.patch v2

r=me
Attachment #8744148 - Flags: review?(bzbarsky) → review+
Comment on attachment 8744132 [details] [diff] [review]
1265978_part2_add_DumpDebugInfo.patch

Review of attachment 8744132 [details] [diff] [review]:
-----------------------------------------------------------------

could you also display the content of MediaDecoder::GetMozDebugReaderData

it will be very useful for MSE debugging.
Attachment #8744132 - Flags: review?(jyavenard) → review+
Sure. Let me have a try.
Attachment #8744168 - Flags: review?(jyavenard)
Attachment #8744133 - Attachment is obsolete: true
Attachment #8744169 - Flags: review?(jyavenard)
Comment on attachment 8744168 [details] [diff] [review]
1265978_part2.5_dump_reader.patch

Review of attachment 8744168 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/media/MediaDecoder.cpp
@@ +1879,5 @@
>  void
>  MediaDecoder::DumpDebugInfo()
>  {
>    DUMP_LOG("metadata: channels=%u rate=%u hasAudio=%d hasVideo=%d, "
>             "state: mPlayState=%s mIsDormant=%d, mShuttingDown=%d",

Do you need an end \n here? (I don't know how that function works)
Attachment #8744168 - Flags: review?(jyavenard) → review+
Attachment #8744169 - Flags: review?(jyavenard) → review+
Comment on attachment 8744168 [details] [diff] [review]
1265978_part2.5_dump_reader.patch

Review of attachment 8744168 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/media/MediaDecoder.cpp
@@ +1879,5 @@
>  void
>  MediaDecoder::DumpDebugInfo()
>  {
>    DUMP_LOG("metadata: channels=%u rate=%u hasAudio=%d hasVideo=%d, "
>             "state: mPlayState=%s mIsDormant=%d, mShuttingDown=%d",

DUMP_LOG calls NS_DebugBreak(NS_DEBUG_WARNING, ...) which appends '\n' at the end.
https://dxr.mozilla.org/mozilla-central/source/xpcom/base/nsDebugImpl.cpp#370

@@ +1885,5 @@
>             PlayStateStr(), mIsDormant, mShuttingDown);
> +
> +  nsString str;
> +  GetMozDebugReaderData(str);
> +  DUMP_LOG("reader data:\n%s", NS_ConvertUTF16toUTF8(str).get());

The string returned by GetMozDebugReaderData() already contains new lines. We insert a '\n' in the middle for pretty print.

With '\n' in the middle:
[Child 31890] WARNING: Decoder=7f627479f800 reader data:
audio decoder: ffmpeg audio decoder
audio frames decoded: 35
video decoder: ffmpeg video decoder
hardware video decoding: disabled
video frames decoded: 71 (skipped:0)
Dumping data for demuxer 7f627479fc00:
        Dumping Audio Track Buffer(audio/mp4a-latm): - mLastAudioTime: 1.625396
                NumSamples:53 Size:13628 NextGetSampleIndex:4294967295 NextInsertionIndex:53
                Buffered: ranges=[(0.000000, 1.625396), (3.204353, 4.040272)]
        Dumping Video Track Buffer(video/avc) - mLastVideoTime: 1.696666
                NumSamples:72 Size:79426 NextGetSampleIndex:48 NextInsertionIndex:72
                Buffered: ranges=[(0.095000, 1.696666), (3.298333, 4.100000)]

Without:
[Child 31890] WARNING: Decoder=7f627479f800 reader data:audio decoder: ffmpeg audio decoder
audio frames decoded: 35
video decoder: ffmpeg video decoder
hardware video decoding: disabled
video frames decoded: 71 (skipped:0)
Dumping data for demuxer 7f627479fc00:
        Dumping Audio Track Buffer(audio/mp4a-latm): - mLastAudioTime: 1.625396
                NumSamples:53 Size:13628 NextGetSampleIndex:4294967295 NextInsertionIndex:53
                Buffered: ranges=[(0.000000, 1.625396), (3.204353, 4.040272)]
        Dumping Video Track Buffer(video/avc) - mLastVideoTime: 1.696666
                NumSamples:72 Size:79426 NextGetSampleIndex:48 NextInsertionIndex:72
                Buffered: ranges=[(0.095000, 1.696666), (3.298333, 4.100000)]
You need to log in before you can comment on or make changes to this bug.