mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 00:06:36 +00:00
baseparse: Use buffer from short reads instead of pulling again
baseparse internally uses a 64kb buffer for pulling data from upstream. If a 64kb pull is failing with a short read, it would previously pull again the requested size. Doing so is not only inefficient but also seems to cause problems with some elements (rawvideoparse) where the second pull would fail with EOS. Short reads are only allowed in GStreamer at EOS. Closes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/294
This commit is contained in:
parent
9f5e65f0a2
commit
bf1979e55f
1 changed files with 0 additions and 22 deletions
|
@ -3343,28 +3343,6 @@ gst_base_parse_pull_range (GstBaseParse * parse, guint size,
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (gst_buffer_get_size (parse->priv->cache) >= size) {
|
||||
*buffer =
|
||||
gst_buffer_copy_region (parse->priv->cache, GST_BUFFER_COPY_ALL, 0,
|
||||
size);
|
||||
GST_BUFFER_OFFSET (*buffer) = parse->priv->offset;
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
/* Not possible to get enough data, try a last time with
|
||||
* requesting exactly the size we need */
|
||||
gst_buffer_unref (parse->priv->cache);
|
||||
parse->priv->cache = NULL;
|
||||
|
||||
ret = gst_pad_pull_range (parse->sinkpad, parse->priv->offset, size,
|
||||
&parse->priv->cache);
|
||||
|
||||
if (ret != GST_FLOW_OK) {
|
||||
GST_DEBUG_OBJECT (parse, "pull_range returned %d", ret);
|
||||
*buffer = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (gst_buffer_get_size (parse->priv->cache) < size) {
|
||||
GST_DEBUG_OBJECT (parse, "Returning short buffer at offset %"
|
||||
G_GUINT64_FORMAT ": wanted %u bytes, got %" G_GSIZE_FORMAT " bytes",
|
||||
|
|
Loading…
Reference in a new issue