mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
ac3parse, dcaparse: check buffer size before trimming
and unref old buffer as soon as possible.
This commit is contained in:
parent
3462282b83
commit
68ac392e8f
2 changed files with 27 additions and 13 deletions
|
@ -692,14 +692,21 @@ cleanup:
|
|||
static GstFlowReturn
|
||||
gst_ac3_parse_chain_priv (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
||||
{
|
||||
GstBuffer *newbuf;
|
||||
GstFlowReturn ret;
|
||||
GstAc3Parse *ac3parse = GST_AC3_PARSE (parent);
|
||||
GstFlowReturn ret;
|
||||
GstBuffer *newbuf;
|
||||
gsize size;
|
||||
|
||||
newbuf = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL,
|
||||
2, gst_buffer_get_size (buffer) - 2);
|
||||
ret = ac3parse->baseparse_chainfunc (pad, parent, newbuf);
|
||||
size = gst_buffer_get_size (buffer);
|
||||
if (size >= 2) {
|
||||
newbuf = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, 2, size - 2);
|
||||
gst_buffer_unref (buffer);
|
||||
ret = ac3parse->baseparse_chainfunc (pad, parent, newbuf);
|
||||
} else {
|
||||
gst_buffer_unref (buffer);
|
||||
ret = GST_FLOW_OK;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -454,16 +454,23 @@ cleanup:
|
|||
* */
|
||||
|
||||
static GstFlowReturn
|
||||
gst_dca_parse_chain_priv (GstPad * pad, GstObject *parent, GstBuffer * buffer)
|
||||
gst_dca_parse_chain_priv (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
||||
{
|
||||
GstBuffer *newbuf;
|
||||
GstFlowReturn ret;
|
||||
GstDcaParse *dcaparse = GST_DCA_PARSE (parent);
|
||||
GstFlowReturn ret;
|
||||
GstBuffer *newbuf;
|
||||
gsize size;
|
||||
|
||||
newbuf = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL,
|
||||
2, gst_buffer_get_size (buffer) - 2);
|
||||
ret = dcaparse->baseparse_chainfunc (pad, parent, newbuf);
|
||||
size = gst_buffer_get_size (buffer);
|
||||
if (size >= 2) {
|
||||
newbuf = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, 2, size - 2);
|
||||
gst_buffer_unref (buffer);
|
||||
ret = dcaparse->baseparse_chainfunc (pad, parent, newbuf);
|
||||
} else {
|
||||
gst_buffer_unref (buffer);
|
||||
ret = GST_FLOW_OK;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue