Closed
Bug 1053008
Opened 10 years ago
Closed 10 years ago
MediaDecoderStateMachine::FlushDecoding() not giving ResetDecode a chance to run
Categories
(Core :: Audio/Video, defect)
Tracking
()
RESOLVED
FIXED
mozilla34
People
(Reporter: cpearce, Assigned: cpearce)
References
Details
Attachments
(1 file, 1 obsolete file)
6.87 KB,
patch
|
kinetik
:
review+
|
Details | Diff | Splinter Review |
Spin off from bug 1046837 https://bugzilla.mozilla.org/show_bug.cgi?id=1046837#c38 > mDecodeTaskQueue->Flush(); at [1] is suspicious to me. > > Flush() doesn't guarantee MediaDecoderReader::ResetDecode() dispatched above > will be executed. It looks like we should call AwaitIdle() or reverse the > order of Flush()/MediaDecoderReader::ResetDecode(). > > > [1] > http://hg.mozilla.org/mozilla-central/file/e6614d8d85f9/content/media/ > MediaDecoderStateMachine.cpp#l2462 (In reply to Chris Pearce (:cpearce) from comment #48) > (In reply to JW Wang [:jwwang] from comment #38) > > mDecodeTaskQueue->Flush(); at [1] is suspicious to me. > > > > Flush() doesn't guarantee MediaDecoderReader::ResetDecode() dispatched above > > will be executed. It looks like we should call AwaitIdle() or reverse the > > order of Flush()/MediaDecoderReader::ResetDecode(). > > You're right. That Flush() should be an AwaitIdle(). Good catch! > > The idea here was to purge events in the task queue that would deliver > samples. But in hindsight, I don't think that's safe; the Reader may be > using the task queue for something else, and it will likely not expect this > behaviour.
Assignee | ||
Updated•10 years ago
|
Flags: needinfo?(cpearce)
Comment 1•10 years ago
|
||
The purpose of Flush() is to abort any existing decoding tasks (since SHUTDOWN doesn't care about it anymore) so that SHUTDOWN can proceed as fast as possible. It looks sub-optimal for AwaitIdle() waits for decoding tasks to finish which we don't need anymore during SHUTDOWN. However, I don't think it will make a noticable difference as long as the machine runs fast enough.
Comment 2•10 years ago
|
||
Btw, for the async behavior of Request{Audio|Video}Data (though it is not truly async for now), it is possible for tasks to be enqueued and run later than MediaDecoderReader::ResetDecode which is the situation we want to prevent.
Assignee | ||
Comment 3•10 years ago
|
||
Yeah. Based on the comment there, we do need the Flush(), otherwise we get problems on B2G... I recall I got backed out without the Flush there. We could do Flush(), syncDispatch(ResetDecode task), Flush().
Flags: needinfo?(cpearce)
Comment 4•10 years ago
|
||
Sounds promising. Given the code complexity of our media stack, I would also like to add some assertions to ensure the code flow proceed as expected and no tasks enqueued/run after the 2nd Flush().
Assignee | ||
Comment 5•10 years ago
|
||
Here's a WIP patch. Once Try re-opens, we can test this cross platforms easier...
Assignee | ||
Comment 6•10 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=2e1cfc7c2f16
Assignee | ||
Comment 7•10 years ago
|
||
Compile errors in first push, trying again: https://tbpl.mozilla.org/?tree=Try&rev=85a60179fb27
Comment 8•10 years ago
|
||
Bug 1033912 will allow running decoding tasks in separate MediaTaskQueues. It is possible for MediaCodecReader::DecodeAudioDataTask() to call GetCallback()->OnAudioDecoded() which will post a task back to |MediaDecoderStateMachine::mDecodeTaskQueue|, even after MediaDecoderReader::ResetDecode() is run. Is that something we want to avoid too?
Assignee | ||
Comment 9•10 years ago
|
||
After a seek, all samples up to the next "discontinuity" are ignored, so if OnAudioDecoded() is called after a seek with data from before the seek, it will just be ignored. The Reader therefore, needs to be careful that after ResetDecode is called, only the first sample that is input and decoded after the ResetDecode() is marked as a discontinuity, not any samples that were pending before the ResetDecode.
Assignee | ||
Comment 10•10 years ago
|
||
Patch; ensure the ResetDecode() task actually runs, and we flush other tasks and reject tasks while flushing.
Attachment #8472074 -
Attachment is obsolete: true
Attachment #8473462 -
Flags: review?(kinetik)
Updated•10 years ago
|
Attachment #8473462 -
Flags: review?(kinetik) → review+
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 11•10 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/5211f7049dc0
Keywords: checkin-needed
Comment 12•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/5211f7049dc0
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
You need to log in
before you can comment on or make changes to this bug.
Description
•