diff --git a/omx/gstomxh264enc.c b/omx/gstomxh264enc.c index 94963e12e2..51d84a805a 100644 --- a/omx/gstomxh264enc.c +++ b/omx/gstomxh264enc.c @@ -879,9 +879,7 @@ gst_omx_h264_enc_handle_output_frame (GstOMXVideoEnc * enc, GstOMXPort * port, frame->output_buffer = hdrs; flow_ret = gst_video_encoder_finish_subframe (GST_VIDEO_ENCODER (self), frame); - - if (frame) - gst_video_codec_frame_unref (frame); + gst_video_codec_frame_unref (frame); return flow_ret; } else if (self->headers) { diff --git a/omx/gstomxh265enc.c b/omx/gstomxh265enc.c index aaddd5f707..3fd8c0d27b 100644 --- a/omx/gstomxh265enc.c +++ b/omx/gstomxh265enc.c @@ -730,13 +730,10 @@ gst_omx_h265_enc_handle_output_frame (GstOMXVideoEnc * enc, GstOMXPort * port, buf->omx_buf->nFilledLen); gst_buffer_unmap (hdrs, &map); self->headers = g_list_append (self->headers, gst_buffer_ref (hdrs)); - frame->output_buffer = hdrs; flow_ret = gst_video_encoder_finish_subframe (GST_VIDEO_ENCODER (self), frame); - - if (frame) - gst_video_codec_frame_unref (frame); + gst_video_codec_frame_unref (frame); return flow_ret; } else if (self->headers) { diff --git a/omx/gstomxvideo.c b/omx/gstomxvideo.c index 28d7bd1897..a761e70b1d 100644 --- a/omx/gstomxvideo.c +++ b/omx/gstomxvideo.c @@ -225,7 +225,8 @@ gst_omx_video_find_nearest_frame (GstElement * element, GstOMXBuffer * buf, GST_TIME_FORMAT ") seems too high (%" GST_TIME_FORMAT ")", GST_TIME_ARGS (timestamp), best->system_frame_number, GST_TIME_ARGS (best->pts), GST_TIME_ARGS (best_diff)); - } + } else + GST_WARNING_OBJECT (element, "No best frame has been found"); g_list_foreach (frames, (GFunc) gst_video_codec_frame_unref, NULL); g_list_free (frames); diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c index 42a8db421d..5da6085ae4 100644 --- a/omx/gstomxvideoenc.c +++ b/omx/gstomxvideoenc.c @@ -1707,7 +1707,15 @@ gst_omx_video_enc_loop (GstOMXVideoEnc * self) gst_video_encoder_get_frames (GST_VIDEO_ENCODER (self))); g_assert (klass->handle_output_frame); - flow_ret = klass->handle_output_frame (self, self->enc_out_port, buf, frame); + + if (frame) + flow_ret = + klass->handle_output_frame (self, self->enc_out_port, buf, frame); + else { + gst_omx_port_release_buffer (self->enc_out_port, buf); + goto flow_error; + } + GST_DEBUG_OBJECT (self, "Finished frame: %s", gst_flow_get_name (flow_ret));