Open itsjamie opened 7 years ago
Thanks for the bug report and I am glad that gots
has helped you get started.
There are 6 bytes that are shared at the beginning of all PES packets. packet_start_code_prefix
is 3 bytes, stream_id
is 1 byte, and PES_packet_length
is 2 bytes. data_alignment_indicator
is not always present. I think the right thing to do is to move pes.dataAlignment = pesBytes[6]&0x04 != 0
down into the conditional that checks if pes.optionalFieldsExist()
. I'll look more into it soon.
Ping
While building a tool to do an analysis of MPEGTS for HLS delivery, ran into a panic while calling pes.NewPESHeader.
The code panics on the pesBytes[6] check being out of bounds.
I think that CheckLength should be called with a value of seven in this case since it's checking the length of the byte array which is one-based, but the index is zero based.
Thank you for this code, it made getting started much easier!