Closed Bug 1512506 Opened 6 years ago Closed 6 years ago

MDSM would dispatch LOTS audio decoding tasks when we seek audio directly to EOS during looping decoding

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: alwu, Assigned: alwu)

References

(Depends on 1 open bug)

Details

Attachments

(1 file)

No description provided.
Summary: MDSM would dispatch HUG → MDSM would dispatch LOTS audio decoding tasks when we seek audio directly to EOS during looping decoding
I found that if we seek looping audio directly into EOS, MDSM will dispatch LOTS of decoding tasks because of wrong estimation of decoded audio duration, which might cause CPU and memory waste. > [Child 38615: MediaPlayback #1]: V/MediaDecoder MediaDecoderStateMachine[0x12d79a000] Decoder=125817000 Queueing audio task - queued=6574, decoder-queued=1 From the log, you can see we've queued 6574 samples (and MDSM still continues to dispatch decoding task) in AudioQueue. --- The reason of this issue is that, when we directly seek to EOS, seeking state would change MDSM's `mCurrentPosition` when seeking finished. In this situation, when entering `loopingDecoding` state, it doesn't set `mAudioLoopingOffset` yet so that we can't do time-adjustment for decoding samples. When we start the media sink, we would use the time where EOS happens as media sink's start time. As we didn't get the audio offset before, we can't adjust audio sample time in order to make them larger than clock time. Therefore, the estimation of decoded audio duration would be incorrect, and MDSM would always think we don't have enough data because `mDecodedAudioEndTime - clock's time` is smaller zero.
Depends on: seamless-looping
Priority: -- → P2
To make sure media sink starts from the correct position, otherwise, we would get incorrect estimation of decoded audio duration when we directly seek looping audio to EOS. That would results in MDSM continually dispatching decoding tasks even if we've enough data.
Attachment #9029872 - Attachment description: Bug 1512506 - MDSM would dispatch LOTS audio decoding tasks when we seek audio directly to EOS during looping decoding. → Bug 1512506 - Prevent MDSM from dispatching lots of audio decoding tasks when seeking directly to EOS during looping.
Pushed by alwu@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/cc946b482d75 Prevent MDSM from dispatching lots of audio decoding tasks when seeking directly to EOS during looping. r=jya
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: