Closed Bug 1286454 Opened 3 years ago Closed 3 years ago

Assertion failure: audio->mDiscontinuity, at dom/media/AccurateSeekTask.cpp:314

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox50 --- affected
firefox51 --- fixed

People

(Reporter: jya, Assigned: kaku, Mentored)

References

()

Details

Attachments

(4 files)

(lldb) bt
* thread #187: tid = 0x37d28, 0x00000001058df38b XUL`mozilla::AccurateSeekTask::OnAudioDecoded(this=0x000000018ead82c0, aAudioSample=0x000000012f0deb30) + 507 at AccurateSeekTask.cpp:314, name = 'MediaPl~back #4', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x00000001058df38b XUL`mozilla::AccurateSeekTask::OnAudioDecoded(this=0x000000018ead82c0, aAudioSample=0x000000012f0deb30) + 507 at AccurateSeekTask.cpp:314
    frame #1: 0x00000001058f0fe5 XUL`mozilla::AccurateSeekTask::SetCallbacks(this=0x000000012e4529a0, aData=mozilla::AudioCallbackData @ 0x0000700001e99328)::$_0::operator()(mozilla::Variant<mozilla::MediaData*, mozilla::MediaDecoderReader::NotDecodedReason>) const + 69 at AccurateSeekTask.cpp:429
    frame #2: 0x00000001058f0f86 XUL`void mozilla::detail::ListenerHelper<(mozilla::DispatchPolicy)0, mozilla::AbstractThread, mozilla::AccurateSeekTask::SetCallbacks()::$_0>::R<mozilla::Variant<mozilla::MediaData*, mozilla::MediaDecoderReader::NotDecodedReason> >::Invoke<mozilla::Variant<mozilla::MediaData*, mozilla::MediaDecoderReader::NotDecodedReason>, 0ul>(this=0x000000012e452980, aEvents=0x000000012e4529a8, (null)=IndexSequence<0> @ 0x0000700001e99348) + 70 at MediaEventSource.h:177
    frame #3: 0x00000001058f0ee7 XUL`mozilla::detail::ListenerHelper<(mozilla::DispatchPolicy)0, mozilla::AbstractThread, mozilla::AccurateSeekTask::SetCallbacks()::$_0>::R<mozilla::Variant<mozilla::MediaData*, mozilla::MediaDecoderReader::NotDecodedReason> >::Run(this=0x000000012e452980) + 71 at MediaEventSource.h:183
    frame #4: 0x0000000105928337 XUL`mozilla::detail::EventTarget<(mozilla::DispatchPolicy)0, mozilla::AbstractThread>::Dispatch(aTarget=0x0000000122632de0, aTask=(mRawPtr = 0x0000000000000000)) + 135 at MediaEventSource.h:139
    frame #5: 0x00000001058f0dc1 XUL`mozilla::EnableIf<TakeArgs<mozilla::AccurateSeekTask::SetCallbacks()::$_0>::value, void>::Type mozilla::detail::ListenerHelper<(this=0x0000000120720b00, aFunc=0x0000000120720b10, aEvents=0x0000700001e994d0)0, mozilla::AbstractThread, mozilla::AccurateSeekTask::SetCallbacks()::$_0>::DispatchHelper<mozilla::AccurateSeekTask::SetCallbacks()::$_0, mozilla::Variant<mozilla::MediaData*, mozilla::MediaDecoderReader::NotDecodedReason> >(mozilla::AccurateSeekTask::SetCallbacks()::$_0 const&, mozilla::Variant<mozilla::MediaData*, mozilla::MediaDecoderReader::NotDecodedReason>&&) + 161 at MediaEventSource.h:207
    frame #6: 0x00000001058f0d0f XUL`void mozilla::detail::ListenerHelper<(mozilla::DispatchPolicy)0, mozilla::AbstractThread, mozilla::AccurateSeekTask::SetCallbacks()::$_0>::Dispatch<mozilla::Variant<mozilla::MediaData*, mozilla::MediaDecoderReader::NotDecodedReason> >(this=0x0000000120720b00, aEvents=0x0000700001e994d0) + 63 at MediaEventSource.h:226
    frame #7: 0x00000001058f0bac XUL`mozilla::detail::ListenerImpl<(mozilla::DispatchPolicy)0, mozilla::AbstractThread, mozilla::AccurateSeekTask::SetCallbacks()::$_0, (mozilla::detail::EventPassMode)1, mozilla::Variant<mozilla::MediaData*, mozilla::MediaDecoderReader::NotDecodedReason> >::Dispatch(this=0x0000000120720af0, aEvents=<unavailable>) + 44 at MediaEventSource.h:302
    frame #8: 0x0000000105a0483d XUL`mozilla::EnableIf<((mozilla::DispatchPolicy)0) == ((mozilla::DispatchPolicy)0), void>::Type mozilla::MediaEventSourceImpl<(this=0x00000001217dfd48, (null)=IntegralConstant<mozilla::DispatchPolicy, mozilla::DispatchPolicy::Sync> @ 0x0000700001e99518, aEvents=0x0000700001e99588)0, (mozilla::ListenerPolicy)0, mozilla::Variant<mozilla::MediaData*, mozilla::MediaDecoderReader::NotDecodedReason> >::NotifyInternal<(mozilla::DispatchPolicy)0, mozilla::detail::AsVariantTemporary<mozilla::MediaData*&> >(mozilla::IntegralConstant<mozilla::DispatchPolicy, (mozilla::DispatchPolicy)0>, mozilla::detail::AsVariantTemporary<mozilla::MediaData*&>&&) + 189 at MediaEventSource.h:525
    frame #9: 0x0000000105a04630 XUL`void mozilla::MediaEventSourceImpl<(mozilla::DispatchPolicy)0, (mozilla::ListenerPolicy)0, mozilla::Variant<mozilla::MediaData*, mozilla::MediaDecoderReader::NotDecodedReason> >::Notify<mozilla::detail::AsVariantTemporary<mozilla::MediaData*&> >(this=0x00000001217dfd48, aEvents=0x0000700001e99588) + 48 at MediaEventSource.h:540
    frame #10: 0x0000000105982584 XUL`mozilla::MediaDecoderReaderWrapper::RequestAudioData(this=0x0000000122910bd8, aAudioSample=0x000000012f0deb30)::$_13::operator()(mozilla::MediaData*) const + 148 at MediaDecoderReaderWrapper.cpp:202
    frame #11: 0x0000000105982441 XUL`mozilla::EnableIf<(ReturnTypeIs<void (mozilla::MediaDecoderReaderWrapper::RequestAudioData()::$_13::*)(mozilla::MediaData*) const, void>::value) && (TakesArgument<void (mozilla::MediaDecoderReaderWrapper::RequestAudioData()::$_13::*)(mozilla::MediaData*) const>::value), already_AddRefed<mozilla::MozPromise<RefPtr<mozilla::MediaData>, mozilla::MediaDecoderReader::NotDecodedReason, true> > >::Type mozilla::MozPromise<RefPtr<mozilla::MediaData>, mozilla::MediaDecoderReader::NotDecodedReason, true>::InvokeCallbackMethod<mozilla::MediaDecoderReaderWrapper::RequestAudioData(aThisVal=0x0000000122910bd8, aMethod=f0 24 98 05 01 00 00 00 00 00 00 00 00 00 00 00, aValue=0x000000013234afd0)::$_13, void (mozilla::MediaDecoderReaderWrapper::RequestAudioData()::$_13::*)(mozilla::MediaData*) const, RefPtr<mozilla::MediaData> const&>(mozilla::MediaDecoderReaderWrapper::RequestAudioData()::$_13*, void (mozilla::MediaDecoderReaderWrapper::RequestAudioData()::$_13::*)(mozilla::MediaData*) const, RefPtr<mozilla::MediaData> const&&&) + 161 at MozPromise.h:457
    frame #12: 0x0000000105981ea8 XUL`mozilla::MozPromise<RefPtr<mozilla::MediaData>, mozilla::MediaDecoderReader::NotDecodedReason, true>::FunctionThenValue<mozilla::MediaDecoderReaderWrapper::RequestAudioData(this=0x0000000122910ba0, aValue=0x000000013234afc8)::$_13, mozilla::MediaDecoderReaderWrapper::RequestAudioData()::$_14>::DoResolveOrRejectInternal(mozilla::MozPromise<RefPtr<mozilla::MediaData>, mozilla::MediaDecoderReader::NotDecodedReason, true>::ResolveOrRejectValue const&) + 152 at MozPromise.h:564
    frame #13: 0x00000001059b80e9 XUL`mozilla::MozPromise<RefPtr<mozilla::MediaData>, mozilla::MediaDecoderReader::NotDecodedReason, true>::ThenValueBase::DoResolveOrReject(this=0x0000000122910ba0, aValue=0x000000013234afc8) + 153 at MozPromise.h:407
    frame #14: 0x00000001059b7f3a XUL`mozilla::MozPromise<RefPtr<mozilla::MediaData>, mozilla::MediaDecoderReader::NotDecodedReason, true>::ThenValueBase::ResolveOrRejectRunnable::Run(this=0x000000011bdfb100) + 154 at MozPromise.h:323
    frame #15: 0x0000000101f2c785 XUL`mozilla::AutoTaskDispatcher::TaskGroupRunnable::Run(this=0x0000000132f84f20) + 261 at TaskDispatcher.h:192
    frame #16: 0x0000000101f153ab XUL`mozilla::TaskQueue::Runner::Run(this=0x0000000133495680) + 795 at TaskQueue.cpp:172
    frame #17: 0x0000000101f2169e XUL`nsThreadPool::Run(this=0x0000000193afc4f0) + 1390 at nsThreadPool.cpp:227
    frame #18: 0x0000000101f1dee9 XUL`nsThread::ProcessNextEvent(this=0x0000000191a45300, aMayWait=false, aResult=0x0000700001e99bfe) + 1289 at nsThread.cpp:1073
    frame #19: 0x0000000101fa903c XUL`NS_ProcessNextEvent(aThread=0x0000000191a45300, aMayWait=false) + 140 at nsThreadUtils.cpp:290
    frame #20: 0x00000001028fea06 XUL`mozilla::ipc::MessagePumpForNonMainThreads::Run(this=0x000000018f96c040, aDelegate=0x000000018feb6fe0) + 646 at MessagePump.cpp:354
    frame #21: 0x0000000102807425 XUL`MessageLoop::RunInternal(this=0x000000018feb6fe0) + 117 at message_loop.cc:235
    frame #22: 0x0000000102807385 XUL`MessageLoop::RunHandler(this=0x000000018feb6fe0) + 21 at message_loop.cc:228
    frame #23: 0x000000010280732d XUL`MessageLoop::Run(this=0x000000018feb6fe0) + 45 at message_loop.cc:208
    frame #24: 0x0000000101f1b7d8 XUL`nsThread::ThreadFunc(aArg=0x0000000191a45300) + 472 at nsThread.cpp:468
    frame #25: 0x0000000101b59d4d libnss3.dylib`_pt_root(arg=0x0000000193f141b0) + 429 at ptthread.c:216
    frame #26: 0x00000001000f8805 libsystem_pthread.dylib`_pthread_body + 131
    frame #27: 0x00000001000f8782 libsystem_pthread.dylib`_pthread_start + 168
    frame #28: 0x00000001000f5fa1 libsystem_pthread.dylib`thread_start + 13

while playing http://player.twitch.tv/?volume=0.4&channel=dansgaming&mseDev and changing the video resolution.
My guess is that it's bug 1257107 that introduced the problem. As the decoder now drops the frames prior the seek target and return a dummy MediaRawData ; the first dummy MediaData will be tagged as a discontinuity but not the first actual frame returned.
Blocks: 1257107
Flags: needinfo?(ayang)
Can we just remove the member which is used to discard samples produced before seek. Since we have MozPromise now, I don't think we still need the member.
(In reply to Jean-Yves Avenard [:jya] from comment #1)
> My guess is that it's bug 1257107 that introduced the problem. As the
> decoder now drops the frames prior the seek target and return a dummy
> MediaRawData ; the first dummy MediaData will be tagged as a discontinuity
> but not the first actual frame returned.

I don't get the point.
Bug 1257107 drops video output sample only. How can it cause this audio output sample crash?
Flags: needinfo?(ayang)
(In reply to Alfredo Yang (:alfredo) from comment #3)

> I don't get the point.
> Bug 1257107 drops video output sample only. How can it cause this audio
> output sample crash?

ah good point.

somehow the first frame returned isn't marked as discontinuity.

but as JW mentioned, the discontinuity flag is no longer necessary as when we reset the decoder we disconnect the MediaDataPromise so we don't need to identify what is the first frame received after the seek anymore.
I just tried for dozens minutes, it is ok in m-c 679118259e91.
Assignee: nobody → kaku
Comment on attachment 8784770 [details]
Bug 1286454 part 1 - remove MediaData::mDiscontinuity;

https://reviewboard.mozilla.org/r/74092/#review71970
Attachment #8784770 - Flags: review?(jwwang) → review+
Comment on attachment 8784771 [details]
Bug 1286454 part 2 - remove MediaDecoderReader::mAudioDiscontinuity since it leads to nothing now;

https://reviewboard.mozilla.org/r/74094/#review71972
Attachment #8784771 - Flags: review?(jwwang) → review+
Comment on attachment 8784772 [details]
Bug 1286454 part 3 - remove MediaDecoderReader::mVideoDiscontinuity since it leads to nothing now;

https://reviewboard.mozilla.org/r/74096/#review71974
Attachment #8784772 - Flags: review?(jwwang) → review+
Comment on attachment 8784773 [details]
Bug 1286454 part 4 - remove DecoderData::mDiscontinuity since it leads to nothing now;

https://reviewboard.mozilla.org/r/74098/#review71976
Attachment #8784773 - Flags: review?(jwwang) → review+
Thanks for the quick review, however, there are errors in the debug build.
We do check the MediaData::mDiscontinuity in assertion macros:
http://searchfox.org/mozilla-central/source/dom/media/AccurateSeekTask.cpp#308
http://searchfox.org/mozilla-central/source/dom/media/AccurateSeekTask.cpp#401

Just removing these two check should be safe, right?
Flags: needinfo?(jwwang)
Per comment 4, it is safe to remove the assertions as well as mFirst{Audio,Video}Sample.
Flags: needinfo?(jwwang)
https://treeherder.mozilla.org/#/jobs?repo=try&revision=aa44f824c13a
Try looks ok, nothing new introduced.
Thanks for the review.
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/4cb4952bbbde
part 1 - remove MediaData::mDiscontinuity; r=jwwang
https://hg.mozilla.org/integration/autoland/rev/78979124b83a
part 2 - remove MediaDecoderReader::mAudioDiscontinuity since it leads to nothing now; r=jwwang
https://hg.mozilla.org/integration/autoland/rev/37299ee3c9e0
part 3 - remove MediaDecoderReader::mVideoDiscontinuity since it leads to nothing now; r=jwwang
https://hg.mozilla.org/integration/autoland/rev/08ee2126ead3
part 4 - remove DecoderData::mDiscontinuity since it leads to nothing now; r=jwwang
Keywords: checkin-needed
You need to log in before you can comment on or make changes to this bug.