Closed Bug 1109433 Opened 5 years ago Closed 3 years ago

Split decoders from demuxers


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






(Reporter: jya, Unassigned)



Right now, media playback is made of MediaDecoderReaders that provides various methods, aimed at managing reading a container, its metadata, managing the flow of data as well as decoding audio or video content.

the WebMReader class for example, can read a webm file and decode the VPx video and ogg/vorbis audio such webm file contains.

In the case of fragmented mp4, the MP4Reader can decode h264, AAC or MP3 audio.

However, as it is, a decoder is tied to a particular format when it doesn't have to be. This is an unnecessary restriction, and causes code duplication (and we have multiple ways of doing the same thing).

An example is MP3; we have the MP3 decoders linked to the MP4Reader, and the various platform MP3 decoders linked to MP3 file demuxer (like AppleMP3Reader)

Aim of this bug is to track separating decoders from their matching demuxers.
On one hand we would have the various format demuxers, and on the other the codec decoders.
The Fragmented MP4 reader implements a PlatformDecoderModule class that is a wrapper to create a MediaDataDecoder instance.

We could use the MediaDataDecoder class as a template for the decoders.

Various demuxers (MediaDecoderReader) could then use the appropriate MediaDataDecoder.

This architecture is similar to how FFmpeg is operating. On one hand we have libavformat that handles the reading/demuxing of various sources, and libavcodec that contains the decoder of all codecs.

I strongly believe that doing so would simplify our architecture and allow a codec decoder to be reused multiple times.
One could imagine implementing a MPEG-TS demuxer, which would reuse directly our existing H264/AAC and MP3 decoders (MSE specifications allows for the use of TS segments)
Mark this as subtask of bug 1148292.
Blocks: 1148292
Priority: -- → P3
Depends on: 1156689
Depends on: 1163458
Once bug 1156708 , we have now fundamentally split the demuxer from the decoder.

Starting with the mp4 container.

Now remaining MediaDecoderReader need to be reworked so they support the MediaDataDemuxer and MediaDataDecoder API.
Depends on: 1156708
Depends on: oggdemuxer
Component: Audio/Video → Audio/Video: Playback
I assume this is fixed?
Flags: needinfo?(jyavenard)

There are no more of the old MediaDecoderReader ...
Closed: 3 years ago
Flags: needinfo?(jyavenard)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.