Open Bug 1270699 Opened 8 years ago Updated 2 years ago

Remove WaitForDataPromise object

Categories

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

defect

Tracking

()

People

(Reporter: jya, Unassigned)

References

(Blocks 1 open bug)

Details

The MediaFormatReader (MFR) if it has detected a gap in the data, will reject the MediaDataPromise with WAITING_FOR_DATA.

The MediaDecoderStateMachine (MDSM) then calls the MFR again MediaFormatReader::WaitForData which will return a WaitForDataPromise which will be resolved once more data is received.

The MDSM can then call the MFR with Request*Data once again.

When seeking however, the MDSM calls MediaFormatReader::Seek which returns a SeekPromise once the seek is resolved. The SeekPromise is only rejected if there's an actual error which pretty much never happens.

This is a non consistent behaviour and it could be simplified.

Handling the WaitForData promise, then handling of rejection of the promise when it's waiting for data and being able to resume adds a great deal of complexity to the code.

I suggest that the WaitForDataPromise be completely removed. A MediaDataPromise will only ever be resolved with the data, or rejected if it's a genuine decoding error.
If the MFR is waiting for data, then it simply do not resolve the promise.

The MDSM can decide what to do in regards to events to be fired based on the time it takes for a promise to be resolved.

The WaitForDataPromise promise is only used with MSE anyway ; for normal playback the MFR will never notify the MDSM that it's waiting. The demuxing request is blocking and the MediaDataPromise only ever gets resolved even if it takes a while to retrieve that data.

Removing the entire concept of waiting could also be expanded to the demuxers and the MSE TrackBufferManagers. Now if there is any need to wait, they just don't resolve the promise.
It looks like this change will allow us to remove MediaDecoderReader::UseBufferingHeuristics() as well so we don't need 2 buffering algorithms (one for MSE and the other for non-MSE) for MDSM.
Blocks: 1235301
No longer blocks: 1235301
Mass change P2 -> P3
Priority: P2 → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.