-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Description
The PMT in https://s3.amazonaws.com/tmm1/combined-pmt-tids.ts cannot be parsed by go-astits.
For reference, see my fixes for the same bug in ffmpeg and in gots
(FYI this contains another variant where some PMT payloads don't contain the program map table).
func TestDemuxerNextDataPMTMutipleTables(t *testing.T) {
// pmt with two tables in one packet, with 0xc0 preceeding the 0x2 program map
pmt := hexToBytes(`47403b1e00c000150000010061000000000000010000000045491be065
f0050e030004b00fe066f0060a04656e670086e06ef0007f
c9ad32ffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffff`)
r := bytes.NewReader(pmt)
assert.Equal(t, 188, r.Len())
dmx := NewDemuxer(context.Background(), r, DemuxerOptPacketSize(188))
dmx.programMap.set(59, 1)
d, err := dmx.NextData()
assert.NoError(t, err)
assert.NotNil(t, d)
assert.Equal(t, uint16(59), d.FirstPacket.Header.PID)
assert.NotNil(t, d.PMT)
}
func TestDemuxerNextDataPMTComplex(t *testing.T) {
// complex pmt with two tables (0xc0 and 0x2) split across two packets
pmt := hexToBytes(`47403b1e00c0001500000100610000000000000100000000
0035e3e2d702b0b20001c50000eefdf01809044749e10b05
0441432d330504454143330504435545491beefdf0102a02
7e1f9700e9080c001f418507d04181eefef00f810706380f
ff1f003f0a04656e670081eefff00f8107061003ff1f003f
0a047370610086ef00f00f8a01009700e9080c001f418507
d041c0ef01f012050445545631a100e9080c001f418507d0
41c0ef02f013050445545631a20100e9080c001f47003b1f
418507d041c0ef03f008bf06496e76696469a5cff3afffff
ffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffff`)
r := bytes.NewReader(pmt)
assert.Equal(t, 188*2, r.Len())
dmx := NewDemuxer(context.Background(), r, DemuxerOptPacketSize(188))
dmx.programMap.set(59, 1)
d, err := dmx.NextData()
assert.NoError(t, err)
assert.NotNil(t, d)
assert.Equal(t, uint16(59), d.FirstPacket.Header.PID)
assert.NotNil(t, d.PMT)
}Metadata
Metadata
Assignees
Labels
No labels