Closed Bug 1177452 Opened 9 years ago Closed 9 years ago

Assertion failure in MDSM::On*Decoded

Categories

(Core :: Audio/Video, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla42
Tracking Status
firefox41 --- affected
firefox42 --- fixed

People

(Reporter: jya, Assigned: jya)

Details

Attachments

(1 file)

Was playing with start time adjustment enabled with MSE (I enabled it should the first sample be close to 0 but not exactly 0).

And I hit this assertion:
#01: mozilla::Maybe<long long>::ref()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x1ede0a0]
#02: mozilla::MediaDecoderStateMachine::StartTimeRendezvous::StartTime()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x310ade5]
#03: mozilla::MediaDecoderStateMachine::StartTime()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x306b294]
#04: mozilla::MediaDecoderStateMachine::OnAudioDecoded(mozilla::AudioData*)[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x302f389]
#05: mozilla::EnableIf<(ReturnTypeIs<void (mozilla::MediaDecoderStateMachine::*)(mozilla::AudioData*), void>::value) && (TakesArgument<void (mozilla::MediaDecoderStateMachine::*)(mozilla::AudioData*)>::value), already_AddRefed<mozilla::MediaPromise<nsRefPtr<moz\252[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x30c6cea]
#06: mozilla::MediaPromise<nsRefPtr<mozilla::AudioData>, mozilla::MediaDecoderReader::NotDecodedReason, true>::MethodThenValue<mozilla::MediaDecoderStateMachine, void (mozilla::MediaDecoderStateMachine::*)(mozilla::AudioData*), void (mozilla::MediaDecoderStateM\257[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x30c6b3f]
#07: mozilla::MediaPromise<nsRefPtr<mozilla::AudioData>, mozilla::MediaDecoderReader::NotDecodedReason, true>::ThenValueBase::DoResolveOrReject(mozilla::MediaPromise<nsRefPtr<mozilla::AudioData>, mozilla::MediaDecoderReader::NotDecodedReason, true>::ResolveOrRe\326[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x309c396]
#08: mozilla::MediaPromise<nsRefPtr<mozilla::AudioData>, mozilla::MediaDecoderReader::NotDecodedReason, true>::ThenValueBase::ResolveOrRejectRunnable::Run()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x309c0dc]
#09: mozilla::AutoTaskDispatcher::TaskGroupRunnable::Run()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x300b119]
#10: mozilla::MediaTaskQueue::Runner::Run()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x312050d]
#11: nsThreadPool::Run()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x198d18]
#12: non-virtual thunk to nsThreadPool::Run()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x198e1c]
#13: nsThread::ProcessNextEvent(bool, bool*)[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x195814]
#14: NS_ProcessNextEvent(nsIThread*, bool)[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x20bda7]
#15: mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*)[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x844c9e]
#16: MessageLoop::RunInternal()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x7b19a5]
#17: MessageLoop::RunHandler()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x7b18b5]
#18: MessageLoop::Run()[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x7b185d]
#19: nsThread::ThreadFunc(void*)[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/XUL +0x193d39]
#20: _pt_root[/Users/jyavenard/Work/Mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/libnss3.dylib +0x371621]
#21: _pthread_body[/usr/lib/system/libsystem_pthread.dylib +0x3268]
#22: _pthread_body[/usr/lib/system/libsystem_pthread.dylib +0x31e5]
(lldb) 

Not sure how we get there: mAudioStartTime not being defined yet we reach MediaDecoderStateMachine::OnAudioDecoded.
Step to reproduce:

modify dom/media/mediasource/MediaSourceDemuxer.h and modify ShouldComputeStartTime to return true.
starts FF, set: media.mediasource.format-reader to true
open: http://w3c-test.org/media-source/mediasource-seek-beyond-duration.html
Flags: needinfo?(bobbyholley)
The reason is MDSM::FirstSampleRejected is rejected with WAITING_FOR_DATA which is a case not handled, this cause OnVideoDecoded to be later called directly.
Oh, I bet I know what's going on here - when we go into WaitingForData mode and come back out of it, we invoke RequestAudioData from EnsureAudioDecodeTaskQueued rather than from DecodeFirstFrame - the latter pipes things through the start time machinery, the former does not.
Flags: needinfo?(bobbyholley)
Group: adobe-confidential
Assignee: nobody → jyavenard
Should the first frame decoding got delayed, such as due to WAITING_FOR_DATA, we wouldn't calculate the start time properly.
Attachment #8635892 - Flags: review?(jwwang)
Comment on attachment 8635892 [details] [diff] [review]
Ensure start time is always calculated on first frame decoding.

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

::: dom/media/MediaDecoderStateMachine.cpp
@@ +1668,5 @@
> +  return NS_OK;
> +}
> +
> +void
> +MediaDecoderStateMachine::RequestAudioData()

Assert OnTaskQueue() and monitor is held so we won't use it wrongly.
Attachment #8635892 - Flags: review?(jwwang) → review+
I think we can have a wrapper around the original MediadecoderReader to handle the start time chores without worrying MDSM in the future. The wrapper should expose exactly the same interface as MediadecoderReader and delegate most of its jobs to the underlying MediadecoderReader.
I'm not sure I see the advantages in doing so in the reader.
We had discussed this with bholley previously, and once all readers are converged to only use MediaFormatReader it would make sense.

But until then, it's much easier to do so in the MDSM.
What would make sense when MediaFormatReader is used?
Because we would only have a single MediaDecoderReader.

When you have multiple MediaDecoderReader, you're looking at modifying all of them and duplicating code.
That's why it is a wrapper around the reader. No readers need to be changed at all. It is something like StartTimeRendezvous exposing the reader interface.
https://hg.mozilla.org/mozilla-central/rev/b4b0bb04601d
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: