From 63e280df22073f06dc35a5cab03dad5d509eca71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 18 Feb 2017 20:18:50 +0200 Subject: rawbaseparse: Drop incomplete frames at EOS See https://bugzilla.gnome.org/show_bug.cgi?id=773666 This would ideally be solved in baseparse but that requires further thought at this point, and in the meantime it would be good to have rawbaseparse not assert on this but handle it gracefully instead. --- gst/rawparse/gstrawbaseparse.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gst/rawparse') diff --git a/gst/rawparse/gstrawbaseparse.c b/gst/rawparse/gstrawbaseparse.c index f5bb202e6..b41e4fa1c 100644 --- a/gst/rawparse/gstrawbaseparse.c +++ b/gst/rawparse/gstrawbaseparse.c @@ -528,6 +528,18 @@ gst_raw_base_parse_handle_frame (GstBaseParse * parse, in_size = gst_buffer_get_size (frame->buffer); + /* drop incomplete frame at the end of the stream + * https://bugzilla.gnome.org/show_bug.cgi?id=773666 + */ + if (GST_BASE_PARSE_DRAINING (parse) && in_size < frame_size) { + GST_DEBUG_OBJECT (raw_base_parse, + "Dropping %" G_GSIZE_FORMAT " bytes at EOS", in_size); + frame->flags |= GST_BASE_PARSE_FRAME_FLAG_DROP; + GST_RAW_BASE_PARSE_CONFIG_MUTEX_UNLOCK (raw_base_parse); + + return gst_base_parse_finish_frame (parse, frame, in_size); + } + /* gst_base_parse_set_min_frame_size() is called when the current * configuration changes and the change affects the frame size. This * means that a buffer must contain at least as many bytes as indicated -- cgit v1.2.1