mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 00:06:36 +00:00
dec: avoid making the buffer writable
Set the caps right after allocation of the buffer because we know the buffer is writable then and we are correctly negotiated. Since ffmpeg keeps around references to frames, making the buffer metadata writable where it was done before pushing will always end up with a copy and that makes the sink do a slow memcpy all the time.
This commit is contained in:
parent
f63d36ade8
commit
6444bd2557
1 changed files with 4 additions and 3 deletions
|
@ -940,6 +940,10 @@ alloc_output_buffer (GstFFMpegDec * ffmpegdec, GstBuffer ** outbuf,
|
||||||
*outbuf = new_aligned_buffer (fsize, GST_PAD_CAPS (ffmpegdec->srcpad));
|
*outbuf = new_aligned_buffer (fsize, GST_PAD_CAPS (ffmpegdec->srcpad));
|
||||||
ret = GST_FLOW_OK;
|
ret = GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
/* set caps, we do this here because the buffer is still writable here and we
|
||||||
|
* are sure to be negotiated */
|
||||||
|
gst_buffer_set_caps (*outbuf, GST_PAD_CAPS (ffmpegdec->srcpad));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* special cases */
|
/* special cases */
|
||||||
|
@ -2239,9 +2243,6 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec,
|
||||||
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
|
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
|
||||||
ffmpegdec->discont = FALSE;
|
ffmpegdec->discont = FALSE;
|
||||||
}
|
}
|
||||||
/* set caps */
|
|
||||||
outbuf = gst_buffer_make_metadata_writable (outbuf);
|
|
||||||
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (ffmpegdec->srcpad));
|
|
||||||
|
|
||||||
if (ffmpegdec->segment.rate > 0.0) {
|
if (ffmpegdec->segment.rate > 0.0) {
|
||||||
/* and off we go */
|
/* and off we go */
|
||||||
|
|
Loading…
Reference in a new issue