Handle dynamic appearance/disappearance of ID3 track in HLS.

This commit is contained in:
Oliver Woodman 2015-04-17 20:04:52 +01:00
parent 5f74226d67
commit fb97fca04e

View file

@ -231,6 +231,10 @@ public final class TsExtractor implements Extractor {
// Skip the descriptors.
data.skipBytes(programInfoLength);
// Setup an ID3 track regardless of whether there's a corresponding entry, in case one
// appears intermittently during playback. See b/20261500.
Id3Reader id3Reader = new Id3Reader(output.track(TS_STREAM_TYPE_ID3));
int entriesSize = sectionLength - 9 /* Size of the rest of the fields before descriptors */
- programInfoLength - 4 /* CRC size */;
while (entriesSize > 0) {
@ -261,7 +265,7 @@ public final class TsExtractor implements Extractor {
seiReader);
break;
case TS_STREAM_TYPE_ID3:
pesPayloadReader = new Id3Reader(output.track(TS_STREAM_TYPE_ID3));
pesPayloadReader = id3Reader;
break;
}