From 7d3b0cd1e87a18ed65f7f58a988ae693c7bc94af Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Tue, 15 May 2018 09:56:10 +0200 Subject: [PATCH] omxvideoenc: factor out gst_omx_video_enc_deallocate_in_buffers() Will add extra code when adding input buffer pool. https://bugzilla.gnome.org/show_bug.cgi?id=796918 --- omx/gstomxvideoenc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c index 314e98dc51..174bc93cca 100644 --- a/omx/gstomxvideoenc.c +++ b/omx/gstomxvideoenc.c @@ -914,6 +914,15 @@ gst_omx_video_enc_open (GstVideoEncoder * encoder) return TRUE; } +static gboolean +gst_omx_video_enc_deallocate_in_buffers (GstOMXVideoEnc * self) +{ + if (gst_omx_port_deallocate_buffers (self->enc_in_port) != OMX_ErrorNone) + return FALSE; + + return TRUE; +} + static gboolean gst_omx_video_enc_shutdown (GstOMXVideoEnc * self) { @@ -928,7 +937,7 @@ gst_omx_video_enc_shutdown (GstOMXVideoEnc * self) gst_omx_component_get_state (self->enc, 5 * GST_SECOND); } gst_omx_component_set_state (self->enc, OMX_StateLoaded); - gst_omx_port_deallocate_buffers (self->enc_in_port); + gst_omx_video_enc_deallocate_in_buffers (self); gst_omx_port_deallocate_buffers (self->enc_out_port); if (state > OMX_StateLoaded) gst_omx_component_get_state (self->enc, 5 * GST_SECOND); @@ -1767,7 +1776,7 @@ gst_omx_video_enc_disable (GstOMXVideoEnc * self) if (gst_omx_port_wait_buffers_released (self->enc_in_port, 5 * GST_SECOND) != OMX_ErrorNone) return FALSE; - if (gst_omx_port_deallocate_buffers (self->enc_in_port) != OMX_ErrorNone) + if (!gst_omx_video_enc_deallocate_in_buffers (self)) return FALSE; if (gst_omx_port_wait_enabled (self->enc_in_port, 1 * GST_SECOND) != OMX_ErrorNone)