X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fh264_mp4toannexb_bsf.c;h=5085ecbdfd7afd012d02fe9e594ee8557879c651;hb=bd36ec55bef7c446079e192655d065fd86483876;hp=e85bdb671225d8b5cfe70ebc31f93906d2abc0ad;hpb=7876f14f8be9d78de1875ff38390d2a37ac86ec3;p=ffmpeg diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/h264_mp4toannexb_bsf.c index e85bdb67122..5085ecbdfd7 100644 --- a/libavcodec/h264_mp4toannexb_bsf.c +++ b/libavcodec/h264_mp4toannexb_bsf.c @@ -63,6 +63,7 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc, int32_t nal_size; uint32_t cumul_size = 0; const uint8_t *buf_end = buf + buf_size; + int ret = AVERROR(EINVAL); /* nothing to filter */ if (!avctx->extradata || avctx->extradata_size < 6) { @@ -137,6 +138,7 @@ pps: *poutbuf_size = 0; *poutbuf = NULL; do { + ret= AVERROR(EINVAL); if (buf + ctx->length_size > buf_end) goto fail; @@ -155,15 +157,15 @@ pps: /* prepend only to the first type 5 NAL unit of an IDR picture */ if (ctx->first_idr && unit_type == 5) { - if (alloc_and_copy(poutbuf, poutbuf_size, + if ((ret=alloc_and_copy(poutbuf, poutbuf_size, avctx->extradata, avctx->extradata_size, - buf, nal_size) < 0) + buf, nal_size)) < 0) goto fail; ctx->first_idr = 0; } else { - if (alloc_and_copy(poutbuf, poutbuf_size, + if ((ret=alloc_and_copy(poutbuf, poutbuf_size, NULL, 0, - buf, nal_size) < 0) + buf, nal_size)) < 0) goto fail; if (!ctx->first_idr && unit_type == 1) ctx->first_idr = 1; @@ -178,7 +180,7 @@ pps: fail: av_freep(poutbuf); *poutbuf_size = 0; - return AVERROR(EINVAL); + return ret; } AVBitStreamFilter ff_h264_mp4toannexb_bsf = {