mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
videorate: stop copying buffers in drop-only mode
gst_video_rate_flush_prev() ensures that the pushed buffer is writable by calling gst_buffer_make_writable() on videorate->prevbuf. In drop-only mode we always push buffers directly when they are received from GstBaseTransform (gst_video_rate_transform_ip()) and do not keep them around. GstBaseTransform already ensures that those buffers are writable so there is no need to do it twice. This change saves us from copying buffers in drop-only mode as we no longer calls gst_buffer_make_writable() with a buffer having a refcount of 2 (one ref owned by GstBaseTransform and one in videorate->prevbuf). https://bugzilla.gnome.org/show_bug.cgi?id=780767
This commit is contained in:
parent
2c2d2a444c
commit
36b7e5890f
1 changed files with 5 additions and 5 deletions
|
@ -712,9 +712,6 @@ gst_video_rate_flush_prev (GstVideoRate * videorate, gboolean duplicate,
|
|||
goto eos_before_buffers;
|
||||
|
||||
outbuf = gst_buffer_ref (videorate->prevbuf);
|
||||
if (videorate->drop_only)
|
||||
gst_buffer_replace (&videorate->prevbuf, NULL);
|
||||
|
||||
/* make sure we can write to the metadata */
|
||||
outbuf = gst_buffer_make_writable (outbuf);
|
||||
|
||||
|
@ -1387,8 +1384,11 @@ gst_video_rate_transform_ip (GstBaseTransform * trans, GstBuffer * buffer)
|
|||
(videorate->segment.rate < 0.0 && intime <= videorate->next_ts)) {
|
||||
GstFlowReturn r;
|
||||
|
||||
/* on error the _flush function posted a warning already */
|
||||
if ((r = gst_video_rate_flush_prev (videorate, FALSE,
|
||||
/* The buffer received from basetransform is garanteed to be writable.
|
||||
* It just needs to be reffed so the buffer won't be consumed once pushed and
|
||||
* GstBaseTransform can get its reference back. */
|
||||
if ((r = gst_video_rate_push_buffer (videorate,
|
||||
gst_buffer_ref (buffer), FALSE,
|
||||
GST_CLOCK_TIME_NONE)) != GST_FLOW_OK) {
|
||||
res = r;
|
||||
goto done;
|
||||
|
|
Loading…
Reference in a new issue