# HG changeset patch # User skal # Date 1212091785 0 # Node ID ea72fccbfc3b3bb0a8b0a78d87069bb342b5252f # Parent 8decc970f9c8d1c8525062f55d78ed0129aaaf38 in TRUNCATED mode, use residual fragments in ParseContext for decoding the very last frame. diff -r 8decc970f9c8 -r ea72fccbfc3b h264.c --- a/h264.c Thu May 29 11:04:42 2008 +0000 +++ b/h264.c Thu May 29 20:09:45 2008 +0000 @@ -7656,6 +7656,15 @@ s->flags= avctx->flags; s->flags2= avctx->flags2; + if(s->flags&CODEC_FLAG_TRUNCATED){ + const int next= ff_h264_find_frame_end(h, buf, buf_size); + assert((buf_size > 0) || (next == END_NOT_FOUND)); + + if( ff_combine_frame(&s->parse_context, next, &buf, &buf_size) < 0 ) + return buf_size; +//printf("next:%d buf_size:%d last_index:%d\n", next, buf_size, s->parse_context.last_index); + } + /* no supplementary picture */ if (buf_size == 0) { Picture *out; @@ -7681,14 +7690,6 @@ return 0; } - if(s->flags&CODEC_FLAG_TRUNCATED){ - int next= ff_h264_find_frame_end(h, buf, buf_size); - - if( ff_combine_frame(&s->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0 ) - return buf_size; -//printf("next:%d buf_size:%d last_index:%d\n", next, buf_size, s->parse_context.last_index); - } - if(h->is_avc && !h->got_avcC) { int i, cnt, nalsize; unsigned char *p = avctx->extradata;