[FFmpeg-devel] Fix for KLV in mpegts

Peter Ross pross at xvid.org
Fri Dec 7 14:27:18 EET 2018


On Fri, Dec 07, 2018 at 12:06:36PM +0200, Artyom Lebedev wrote:
> This fixes bug which prevents from proper muxing-in KLV stream into mpeg-ts.
> 
> mpegtsenc.c:1526
> 
>     char *side_data = NULL;
>     int stream_id = -1;
> 
>     side_data = av_packet_get_side_data(pkt,
> AV_PKT_DATA_MPEGTS_STREAM_ID,
>                                         &side_data_size);
>     if (side_data)
>         stream_id = side_data[0];
> 
> One-byte stream ID is read from "char *" array to integer making it to
> sign-extend which is not correct. Although it writes it correctly to stream,
> since it is treated as one byte again, but it fails with some condition
> checks, e.g. in mpegtsenc.c:1278:
> 
> if (stream_id == 0xbd) /* asynchronous KLV */
>     pts = dts = AV_NOPTS_VALUE;
> stream_id value in such case is 0xffffffbd.
> 
> Fix should be changing side_data type from "char *" to "uint8_t *".

looks good. i will apply if no one else rejects.

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20181207/fbe99ac4/attachment.sig>


More information about the ffmpeg-devel mailing list