[FFmpeg-devel] [PATCH]lavc/h264_mp4toannexb: Do not fail if frame already starts with startcode
Hendrik Leppkes
h.leppkes at gmail.com
Sat Mar 26 11:21:34 CET 2016
On Sat, Mar 26, 2016 at 11:10 AM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> Hendrik Leppkes <h.leppkes <at> gmail.com> writes:
>
>> On Sat, Mar 26, 2016 at 10:38 AM, Carl Eugen Hoyos wrote:
>
>> > /* nothing to filter */
>> > - if (!avctx->extradata || avctx->extradata_size < 6) {
>> > + if ( !avctx->extradata || avctx->extradata_size < 6
>> > + || !buf[0] && !buf[1] && (buf[2] == 1 || !buf[2] && buf[3] == 1)) {
>> > *poutbuf = (uint8_t *)buf;
>> > *poutbuf_size = buf_size;
>> > return 0;
>>
>> A 4-byte mp4 style size code could conceivably start with 0x000001xx
>> (ie. a size from 256 bytes to 511 bytes), this seems very risky.
>
> Understood.
> Is it ok to test for 32bit "1"?
> ie:
> || !buf[0] && !buf[1] && !buf[2] && buf[3] == 1)
>
Conceivably a stream could also have a 1-byte sized NAL, ie. a AUD, or
EOS, there are a number of NALs without payload.
Checking for only 4 byte start codes would be incomplete either way
and probably not worth tripping into new bugs along the way, IMHO
anyway.
- Hendrik
More information about the ffmpeg-devel
mailing list