From 9171fa9c19a50181bd90458d98abc280bf2c2b89 Mon Sep 17 00:00:00 2001 From: Bernhard Miller Date: Mon, 1 Aug 2016 11:45:30 +0200 Subject: [PATCH] aiffparse: keep end_offset when seeking After seeking in aiff files the information about the data end offset is discarded, leading to audio artifacts with metadata chunks at the end of a file. This patch retains the end offset information after a seek event. https://bugzilla.gnome.org//show_bug.cgi?id=769376 --- gst/aiff/aiffparse.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gst/aiff/aiffparse.c b/gst/aiff/aiffparse.c index bde90fcd5d..194857be31 100644 --- a/gst/aiff/aiffparse.c +++ b/gst/aiff/aiffparse.c @@ -1933,6 +1933,15 @@ gst_aiff_parse_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) aiff->start_segment = gst_event_new_segment (&segment); + /* If the seek is within the same SSND chunk and there is no new + * end_offset defined keep the previous end_offset. This will avoid noise + * at the end of playback if e.g. a metadata chunk is located at the end + * of the file. */ + if (aiff->end_offset > 0 && offset < aiff->end_offset && + offset >= aiff->datastart && end_offset == -1) { + end_offset = aiff->end_offset; + } + /* stream leftover data in current segment */ if (aiff->state == AIFF_PARSE_DATA) gst_aiff_parse_flush_data (aiff);