Allowing invalid AAC streams?
- Dominant language
- Java
- Stars
- 21.9k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
### [REQUIRED] Searched documentation and issues
There are many issues related to this: #6112, #3712, #3158
### [REQUIRED] Question
I have many streams with a PMT header that declare tracks that don't contain any actual packets in the transport stream. My application use Exoplayer to play streams that are broadcasted using DVB-T/S/C/ATSC and my hypothesis is that broadcasters have a static set of PMT's. Some programs use one of these tracks and some use all. In the UK, _Freeview_ seem to be one of these companies.
Now, if not all of these PMT's have corresponding elementary stream packets in the transport stream it will fail to play in Exoplayer. In all the other issues related they are explained with "bad media" and are suggested to use the _FLAG_IGNORE_AAC_STREAM_ flag. This means that when a stream contain two AAC's in the PMT where only one is valid, both are ignored and the stream then plays without audio at all.
I can understand that you say "bad media" because in reality, it _is_ bad media, but there is no way to contact companies all over the world telling them to change their way of broadcasting their media. This leads me to my question: what should I do?
Also, I tested to implement a new flag that prematurely sets a dummy format for all AAC/LATM streams like this:
```
@Override
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator idGenerator) {
idGenerator.generateNewId();
formatId = idGenerator.getFormatId();
output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_AUDIO);
if(isSet(DefaultTsPayloadReaderFactory.FLAG_IGNORE_INVALID_AAC_STREAMS)) {
Format format = Format.createAudioSampleFormat(formatId, MimeTypes.AUDIO_AAC, null,
Format.NO_VALUE, Format.NO_VALUE, 2, 44100,
null, null, 0, language);
output.format(format);
}
...
}
```
Using the above code I get the results that I want. It does display an invalid non-playable audio track in the menu, but atleast I can play the stream at all. Do you see any downsides in using this implementation in a forked library?
Contributor guide
Assessment
This issue has not been assessed yet.