[FFmpeg-devel] ffprobe: Do not decode zero-sized packets in ffprobe -show_frame

Michael Niedermayer michaelni at gmx.at
Wed Feb 15 17:39:15 CET 2012


On Tue, Feb 14, 2012 at 05:26:13PM +0100, Petter Ericson wrote:
> Greetings
> 
> Ticket #997 details a segfault in ffprobe that was exposed by the file
> http://titan.codemill.se/~peteri/120210144737.ts
> 
> This patch fixes the segfault. However, the desyncing issue that I
> mentioned in the ticket still remains (I was sloppy when looking at the
> output - It is still present in git master). If anyone could advice on what
> it is that is causing transcoding to result in desynced output, I would be
> most grateful. 
> 
> The patched ffmpeg passes make fate.
> 
> Best regards
> 
> Petter Ericson
> 

>  ffprobe.c |    2 ++
>  1 file changed, 2 insertions(+)
> d4cd04827b5c74b8d5d67f85d3f49b9646ae392d  patch
> commit e40952af2f5b6eccf24b34926bf09747117affdc
> Author: Petter Ericson <petter.ericson at codemill.se>
> Date:   Tue Feb 14 16:59:56 2012 +0100
> 
>     ffprobe: Do not avcodec_decode_video2 video packets with size == 0
> 
> diff --git a/ffprobe.c b/ffprobe.c
> index 79f7494..e23ef98 100644
> --- a/ffprobe.c
> +++ b/ffprobe.c
> @@ -1349,6 +1349,8 @@ static av_always_inline int get_decoded_frame(AVFormatContext *fmt_ctx,
>      *got_frame = 0;
>      switch (dec_ctx->codec_type) {
>      case AVMEDIA_TYPE_VIDEO:
> +        if(pkt->size == 0)
> +            return ret;
>          ret = avcodec_decode_video2(dec_ctx, frame, got_frame, pkt);

This also will break flushing the last frames
the check could be moved to the non flushing codepath

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120215/0d53afb5/attachment.asc>


More information about the ffmpeg-devel mailing list