HLS: Consider all programs.

I'm not sure exactly what the implications of this change are,
but I'd really hope that only one program in each stream is carrying
audio/video. For GoPro cameras, they expose the video stream in
the second program, for some reason.

Issue: #116
This commit is contained in:
Oliver Woodman 2014-12-19 12:12:04 +00:00
parent 0756c3d28c
commit 1fce55f6fe

View File

@ -320,21 +320,17 @@ public final class TsExtractor {
tsBuffer.skipBytes(pointerField); tsBuffer.skipBytes(pointerField);
} }
// Skip PAT header. tsBuffer.skipBits(12); // 8+1+1+2
tsBuffer.skipBits(64); // 8+1+1+2+12+16+2+5+1+8+8 int sectionLength = tsBuffer.readBits(12);
tsBuffer.skipBits(40); // 16+2+5+1+8+8
// Only read the first program and take it. int programCount = (sectionLength - 9) / 4;
for (int i = 0; i < programCount; i++) {
// Skip program_number. tsBuffer.skipBits(19);
tsBuffer.skipBits(16 + 3); int pid = tsBuffer.readBits(13);
int pid = tsBuffer.readBits(13);
// Pick the first program.
if (tsPayloadReaders.get(pid) == null) {
tsPayloadReaders.put(pid, new PmtReader()); tsPayloadReaders.put(pid, new PmtReader());
} }
// Skip other programs if exist.
// Skip CRC_32. // Skip CRC_32.
} }