From 58816039c2846b0781b64e448c4e9ec28a6a3586 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Mon, 19 Mar 2012 11:58:15 +0100 Subject: flacparse: avoid indefinite extended search for frame end if possible ... which is particularly useful if locked on to the wrong frame start and/or corrupt frame being crc checked. diff --git a/gst/audioparsers/gstflacparse.c b/gst/audioparsers/gstflacparse.c index 9cfdb98..942914e 100644 --- a/gst/audioparsers/gstflacparse.c +++ b/gst/audioparsers/gstflacparse.c @@ -691,6 +691,15 @@ gst_flac_parse_frame_is_valid (GstFlacParse * flacparse, } } + /* so we searched to expected end and found nothing, + * give up on this frame (start) */ + if (flacparse->max_framesize && i > 2 * flacparse->max_framesize) { + GST_LOG_OBJECT (flacparse, + "could not determine valid frame end, discarding frame (start)"); + *ret = 1; + return FALSE; + } + need_more: max = flacparse->max_framesize + 16; if (max == 16) -- cgit v0.10.2