[FFmpeg-devel] [PATCHv3 3/6] dvbsubdec: always return the whole buffer as consumed bytes

Clément Bœsch u at pkh.me
Tue Oct 15 07:53:58 CEST 2013


On Sun, Oct 06, 2013 at 09:14:12PM +0200, Marton Balint wrote:
> We don't want leftover junk bytes to be accidentally feeded to us again. Also
> show the number of skipped bytes in the debug output.
> 
> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
>  libavcodec/dvbsubdec.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
> index 4ce40aa..9754179 100644
> --- a/libavcodec/dvbsubdec.c
> +++ b/libavcodec/dvbsubdec.c
> @@ -1538,7 +1538,10 @@ static int dvbsub_decode(AVCodecContext *avctx,
>      if (got_segment == 15 && sub)
>          *data_size = dvbsub_display_end_segment(avctx, p, 0, sub);
>  
> -    return p - buf;
> +    if (p - buf < buf_size)
> +        av_log(avctx, AV_LOG_DEBUG, "skipping %d leftover junk bytes\n", buf_size - (int)(p - buf));
> +
> +    return buf_size;
>  }

Any idea what those junk bytes are? Maybe empty packets to stop previous
sub presentation?

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131015/bd88df90/attachment.asc>


More information about the ffmpeg-devel mailing list