From: Sebastian Dröge Date: Tue, 12 Oct 2010 08:27:53 +0000 (+0200) Subject: flacparse: Don't drop the last frame if it is followed by garbage X-Git-Tag: RELEASE-0.10.29~323 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=274414e3d6ae07b489fed8abb6ac66d280da0973;p=platform%2Fupstream%2Fgst-plugins-good.git flacparse: Don't drop the last frame if it is followed by garbage See bug #631814. --- diff --git a/gst/audioparsers/gstflacparse.c b/gst/audioparsers/gstflacparse.c index 7b70fe1..2a98891 100644 --- a/gst/audioparsers/gstflacparse.c +++ b/gst/audioparsers/gstflacparse.c @@ -620,13 +620,18 @@ gst_flac_parse_frame_is_valid (GstFlacParse * flacparse, GstBuffer * buffer, } } - /* For the last frame check the CRC16 instead of the following - * header, which does not exist */ + /* For the last frame output everything to the end */ if (G_UNLIKELY (gst_base_parse_get_drain (GST_BASE_PARSE (flacparse)))) { - guint16 actual_crc = gst_flac_calculate_crc16 (data, size - 2); - guint16 expected_crc = GST_READ_UINT16_BE (data + size - 2); + if (flacparse->check_frame_checksums) { + guint16 actual_crc = gst_flac_calculate_crc16 (data, size - 2); + guint16 expected_crc = GST_READ_UINT16_BE (data + size - 2); - if (actual_crc == expected_crc) { + if (actual_crc == expected_crc) { + *ret = size; + flacparse->block_size = block_size; + return TRUE; + } + } else { *ret = size; flacparse->block_size = block_size; return TRUE;