summaryrefslogtreecommitdiff
path: root/gst/rawparse
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2017-02-18 20:18:50 +0200
committerSebastian Dröge <sebastian@centricular.com>2017-02-18 20:18:50 +0200
commit63e280df22073f06dc35a5cab03dad5d509eca71 (patch)
tree37d28db4f545f46a08619d64dd306a7af0335bb8 /gst/rawparse
parent0c902ff24906e8c91b0af449a294e9df0706a3b7 (diff)
downloadgstreamer-plugins-bad-63e280df22073f06dc35a5cab03dad5d509eca71.tar.gz
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.
Diffstat (limited to 'gst/rawparse')
-rw-r--r--gst/rawparse/gstrawbaseparse.c12
1 files changed, 12 insertions, 0 deletions
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