Closed Bug 1498440 Opened Last year Closed 11 months ago

Refactor the logic of seamless looping audio

Categories

(Core :: Audio/Video: Playback, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla65
Tracking Status
firefox65 --- fixed

People

(Reporter: alwu, Assigned: alwu)

References

(Blocks 2 open bugs)

Details

Attachments

(6 files, 5 obsolete files)

46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
46 bytes, text/x-phabricator-request
Details | Review
The purpose of this bug is to move out the codes for seamless audio from DecodingState::Step().
Depends on: 1497629
If we're in seamless looping, ReaderProxy will not tell MDSM about EOS error which reader returned, so MDSM will stay at `decoding state` all the time.
We can say that the ReaderProxy hides EOS in this case.

When canceling seamless looping, if the playback position does not reach the EOS position yet and we had already hidden EOS, we need to create another
EOS to notify MDSM the demuxing has ended.

   playback   hidden    fake
   position    EOS      EOS
 ----|---------|---------|-------> (Increasing timeline)
When we cancel seamless looping, we should discard the audio data whose time are later than the last
audio frame's time in the audio track.
No need to check whether we need to dispatch looping event everytime when entering the DecodingState::Step().
We only have a interest in the data which is popped out from the front side of the queue.
Priority: -- → P2
Attachment #9016876 - Attachment is obsolete: true
Attachment #9016877 - Attachment is obsolete: true
Attachment #9016878 - Attachment is obsolete: true
Attachment #9016879 - Attachment is obsolete: true
This state is used to handle decoding when the media is in seamless looping.

It will be responsible for
(1) time adjustment
(2) handle EOS and seek to the first sample
When we cancel seamless looping, we should discard audio data whose time are later than the last
audio frame's time in the audio track.
We only have a interest in the data which is popped out from the front side of the queue.
We don't have any implementation for video seamless looping yet, so we only use 'loopingDecodingState' for
audio for now.
Ensure we disconnect all Then() before exit the state.
Attachment #9018766 - Attachment is obsolete: true
Pushed by alwu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8937fe137441
part1 : implement MDSM's 'LoopingDecodingState'. r=jya
https://hg.mozilla.org/integration/autoland/rev/f47b8fef7cc7
part2 : implement state transition. r=jya
https://hg.mozilla.org/integration/autoland/rev/c67e483b4ab4
part3 : remove time-adjustment related codes in ReaderProxy. r=jya
https://hg.mozilla.org/integration/autoland/rev/2e61ba5a50f2
part4 : discard redudant looping data when cancel looping. r=jya
https://hg.mozilla.org/integration/autoland/rev/1cd5c63b4182
part5 : rename PopEvent() to PopFrontEvent(). r=jya
https://hg.mozilla.org/integration/autoland/rev/93cfc552f067
part6 : only enable 'loopingDecodingState' for audio seamless looping r=jya
Blocks: 1499903
Duplicate of this bug: 1496474
Blocks: 1505972
Blocks: 1506286
You need to log in before you can comment on or make changes to this bug.