10l (returning negative number of consumed bytes if the first startcode of a frame was split between 2 buffers)

Originally committed as revision 1824 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer
2003-04-27 01:11:26 +00:00
parent 7c9375f15a
commit bb463d8102
3 changed files with 39 additions and 9 deletions

View File

@@ -2190,7 +2190,7 @@ static int mpeg1_find_frame_end(MpegEncContext *s, uint8_t *buf, int buf_size){
}
}
pc->state= state;
return -1;
return END_NOT_FOUND;
}
/* handle buffering and image synchronisation */
@@ -2218,9 +2218,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
}
if(s2->flags&CODEC_FLAG_TRUNCATED){
int next;
next= mpeg1_find_frame_end(s2, buf, buf_size);
int next= mpeg1_find_frame_end(s2, buf, buf_size);
if( ff_combine_frame(s2, next, &buf, &buf_size) < 0 )
return buf_size;
@@ -2288,7 +2286,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
if (ret == DECODE_SLICE_EOP) {
if(s2->last_picture_ptr) //FIXME merge with the stuff in mpeg_decode_slice
*data_size = sizeof(AVPicture);
return FFMAX(1, buf_ptr - buf - s2->parse_context.last_index);
return FFMAX(0, buf_ptr - buf - s2->parse_context.last_index);
}else if(ret < 0){
if(ret == DECODE_SLICE_ERROR)
ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x, s2->mb_y, AC_ERROR|DC_ERROR|MV_ERROR);