From 155a3fec9334a5a2f9918aff491b5926143cba71 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 28 Jun 2014 17:37:23 +0100 Subject: [PATCH] matroskaparse: don't error out if there's not enough data in the adapter gst_matroska_parse_take() would return FLOW_ERROR instead of FLOW_EOS in case there's less data in the adapter than requested, because buffer is NULL in that case which triggers the error code path. This made the unit test fail (occasionally at least, because of a bug in the unit test there's a race and it would happen only sporadically). --- gst/matroska/matroska-parse.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gst/matroska/matroska-parse.c b/gst/matroska/matroska-parse.c index 4d3cb42..1eeef5c 100644 --- a/gst/matroska/matroska-parse.c +++ b/gst/matroska/matroska-parse.c @@ -2274,10 +2274,10 @@ gst_matroska_parse_take (GstMatroskaParse * parse, guint64 bytes, ret = GST_FLOW_ERROR; goto exit; } - if (gst_adapter_available (parse->common.adapter) >= bytes) - buffer = gst_adapter_take_buffer (parse->common.adapter, bytes); - else - ret = GST_FLOW_EOS; + if (gst_adapter_available (parse->common.adapter) < bytes) + return GST_FLOW_EOS; + + buffer = gst_adapter_take_buffer (parse->common.adapter, bytes); if (G_LIKELY (buffer)) { gst_ebml_read_init (ebml, GST_ELEMENT_CAST (parse), buffer, parse->common.offset); @@ -2286,6 +2286,7 @@ gst_matroska_parse_take (GstMatroskaParse * parse, guint64 bytes, ret = GST_FLOW_ERROR; } exit: + return ret; } -- 2.7.4