1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-03-03 14:32:16 +02:00

h264: retuen the amount read in case of NAL_END_SEQUENCE

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2011-12-16 18:55:04 +01:00
parent 902c090413
commit 227960427b

View File

@ -4046,15 +4046,15 @@ static int decode_frame(AVCodecContext *avctx,
MpegEncContext *s = &h->s; MpegEncContext *s = &h->s;
AVFrame *pict = data; AVFrame *pict = data;
int buf_index; int buf_index;
Picture *out;
int i, out_idx;
s->flags= avctx->flags; s->flags= avctx->flags;
s->flags2= avctx->flags2; s->flags2= avctx->flags2;
/* end of stream, output what is still in the buffers */ /* end of stream, output what is still in the buffers */
out:
if (buf_size == 0) { if (buf_size == 0) {
Picture *out; out:
int i, out_idx;
s->current_picture_ptr = NULL; s->current_picture_ptr = NULL;
@ -4075,7 +4075,7 @@ static int decode_frame(AVCodecContext *avctx,
*pict= *(AVFrame*)out; *pict= *(AVFrame*)out;
} }
return 0; return buf_size;
} }
if(h->is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && (buf[4]&0xFC)==0xFC && (buf[5]&0x1F) && buf[8]==0x67){ if(h->is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && (buf[4]&0xFC)==0xFC && (buf[5]&0x1F) && buf[8]==0x67){
int cnt= buf[5]&0x1f; int cnt= buf[5]&0x1f;
@ -4105,7 +4105,8 @@ not_extra:
return -1; return -1;
if (!s->current_picture_ptr && h->nal_unit_type == NAL_END_SEQUENCE) { if (!s->current_picture_ptr && h->nal_unit_type == NAL_END_SEQUENCE) {
buf_size = 0; av_assert0(buf_index <= buf_size);
buf_size = buf_index;
goto out; goto out;
} }