mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-02 18:01:31 +00:00
omxvideodec: Use the destroy notify to free the coder_hook
This commit is contained in:
parent
f79460ff52
commit
2042e08b33
1 changed files with 8 additions and 12 deletions
|
@ -36,6 +36,12 @@ struct _BufferIdentification
|
||||||
guint64 timestamp;
|
guint64 timestamp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
buffer_identification_free (BufferIdentification * id)
|
||||||
|
{
|
||||||
|
g_slice_free (BufferIdentification, id);
|
||||||
|
}
|
||||||
|
|
||||||
/* prototypes */
|
/* prototypes */
|
||||||
static void gst_omx_video_dec_finalize (GObject * object);
|
static void gst_omx_video_dec_finalize (GObject * object);
|
||||||
|
|
||||||
|
@ -279,7 +285,6 @@ _find_nearest_frame (GstOMXVideoDec * self, GstOMXBuffer * buf)
|
||||||
if (diff_ticks > MAX_FRAME_DIST_TICKS
|
if (diff_ticks > MAX_FRAME_DIST_TICKS
|
||||||
|| diff_frames > MAX_FRAME_DIST_FRAMES) {
|
|| diff_frames > MAX_FRAME_DIST_FRAMES) {
|
||||||
g_warning ("Too old frame, bug in decoder -- please file a bug");
|
g_warning ("Too old frame, bug in decoder -- please file a bug");
|
||||||
g_slice_free (BufferIdentification, id);
|
|
||||||
gst_base_video_decoder_finish_frame (GST_BASE_VIDEO_DECODER (self),
|
gst_base_video_decoder_finish_frame (GST_BASE_VIDEO_DECODER (self),
|
||||||
tmp);
|
tmp);
|
||||||
l = GST_BASE_VIDEO_CODEC (self)->frames;
|
l = GST_BASE_VIDEO_CODEC (self)->frames;
|
||||||
|
@ -381,18 +386,15 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self)
|
||||||
GST_ERROR_OBJECT (self, "Invalid frame size (%u < %u)",
|
GST_ERROR_OBJECT (self, "Invalid frame size (%u < %u)",
|
||||||
GST_BUFFER_SIZE (frame->src_buffer), buf->omx_buf->nFilledLen);
|
GST_BUFFER_SIZE (frame->src_buffer), buf->omx_buf->nFilledLen);
|
||||||
gst_buffer_replace (&frame->src_buffer, NULL);
|
gst_buffer_replace (&frame->src_buffer, NULL);
|
||||||
g_slice_free (BufferIdentification, frame->coder_hook);
|
|
||||||
gst_base_video_decoder_finish_frame (GST_BASE_VIDEO_DECODER (self),
|
gst_base_video_decoder_finish_frame (GST_BASE_VIDEO_DECODER (self),
|
||||||
frame);
|
frame);
|
||||||
goto invalid_frame_size;
|
goto invalid_frame_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_slice_free (BufferIdentification, frame->coder_hook);
|
|
||||||
flow_ret =
|
flow_ret =
|
||||||
gst_base_video_decoder_finish_frame (GST_BASE_VIDEO_DECODER (self),
|
gst_base_video_decoder_finish_frame (GST_BASE_VIDEO_DECODER (self),
|
||||||
frame);
|
frame);
|
||||||
} else if (frame != NULL) {
|
} else if (frame != NULL) {
|
||||||
g_slice_free (BufferIdentification, frame->coder_hook);
|
|
||||||
flow_ret =
|
flow_ret =
|
||||||
gst_base_video_decoder_finish_frame (GST_BASE_VIDEO_DECODER (self),
|
gst_base_video_decoder_finish_frame (GST_BASE_VIDEO_DECODER (self),
|
||||||
frame);
|
frame);
|
||||||
|
@ -619,19 +621,11 @@ static gboolean
|
||||||
gst_omx_video_dec_reset (GstBaseVideoDecoder * decoder)
|
gst_omx_video_dec_reset (GstBaseVideoDecoder * decoder)
|
||||||
{
|
{
|
||||||
GstOMXVideoDec *self;
|
GstOMXVideoDec *self;
|
||||||
GList *l;
|
|
||||||
|
|
||||||
self = GST_OMX_VIDEO_DEC (decoder);
|
self = GST_OMX_VIDEO_DEC (decoder);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (self, "Resetting decoder");
|
GST_DEBUG_OBJECT (self, "Resetting decoder");
|
||||||
|
|
||||||
for (l = GST_BASE_VIDEO_CODEC (self)->frames; l; l = l->next) {
|
|
||||||
GstVideoFrame *frame = l->data;
|
|
||||||
|
|
||||||
g_slice_free (BufferIdentification, frame->coder_hook);
|
|
||||||
frame->coder_hook = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_omx_port_set_flushing (self->in_port, TRUE);
|
gst_omx_port_set_flushing (self->in_port, TRUE);
|
||||||
gst_omx_port_set_flushing (self->out_port, TRUE);
|
gst_omx_port_set_flushing (self->out_port, TRUE);
|
||||||
|
|
||||||
|
@ -746,6 +740,8 @@ gst_omx_video_dec_handle_frame (GstBaseVideoDecoder * decoder,
|
||||||
|
|
||||||
id->timestamp = buf->omx_buf->nTimeStamp;
|
id->timestamp = buf->omx_buf->nTimeStamp;
|
||||||
frame->coder_hook = id;
|
frame->coder_hook = id;
|
||||||
|
frame->coder_hook_destroy_notify =
|
||||||
|
(GDestroyNotify) buffer_identification_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Set flags
|
/* TODO: Set flags
|
||||||
|
|
Loading…
Reference in a new issue