baseparse: Always clear drain flag before pulling

In pull mode, each pull is unique. A following pull can be well inside the
range even if the previous one wasn't. Fix this my moving the drain flag
right before the pull.

This avoids passing a bad drain flag to parsers, which may endup truncate
buffers causing data corruption.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1275

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/446>
This commit is contained in:
Nicolas Dufresne 2020-04-22 12:58:35 -04:00 committed by GStreamer Merge Bot
parent a4caf7b254
commit 8ecf0956d7

View file

@ -3524,6 +3524,7 @@ gst_base_parse_scan_frame (GstBaseParse * parse, GstBaseParseClass * klass)
GST_LOG_OBJECT (parse, "reading buffer size %u", min_size);
parse->priv->drain = FALSE;
ret = gst_base_parse_pull_range (parse, min_size, &buffer);
if (ret != GST_FLOW_OK)
goto done;
@ -3592,7 +3593,6 @@ gst_base_parse_scan_frame (GstBaseParse * parse, GstBaseParseClass * klass)
/* Double our frame size, or increment by at most 64KB */
fsize += MIN (fsize, 64 * 1024);
}
parse->priv->drain = FALSE;
}
done: