mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 04:31:06 +00:00
videodecoder: Use GSlice to allocate the timestamp tracking structures
This commit is contained in:
parent
3327d13f1b
commit
43e94eea98
1 changed files with 9 additions and 3 deletions
|
@ -1432,13 +1432,19 @@ struct _Timestamp
|
||||||
GstClockTime duration;
|
GstClockTime duration;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
timestamp_free (Timestamp * ts)
|
||||||
|
{
|
||||||
|
g_slice_free (Timestamp, ts);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_video_decoder_add_timestamp (GstVideoDecoder * decoder, GstBuffer * buffer)
|
gst_video_decoder_add_timestamp (GstVideoDecoder * decoder, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
GstVideoDecoderPrivate *priv = decoder->priv;
|
GstVideoDecoderPrivate *priv = decoder->priv;
|
||||||
Timestamp *ts;
|
Timestamp *ts;
|
||||||
|
|
||||||
ts = g_malloc (sizeof (Timestamp));
|
ts = g_slice_new (Timestamp);
|
||||||
|
|
||||||
GST_LOG_OBJECT (decoder,
|
GST_LOG_OBJECT (decoder,
|
||||||
"adding PTS %" GST_TIME_FORMAT " DTS %" GST_TIME_FORMAT
|
"adding PTS %" GST_TIME_FORMAT " DTS %" GST_TIME_FORMAT
|
||||||
|
@ -1479,7 +1485,7 @@ gst_video_decoder_get_timestamp_at_offset (GstVideoDecoder *
|
||||||
*pts = ts->pts;
|
*pts = ts->pts;
|
||||||
*dts = ts->dts;
|
*dts = ts->dts;
|
||||||
*duration = ts->duration;
|
*duration = ts->duration;
|
||||||
g_free (ts);
|
timestamp_free (ts);
|
||||||
g = g->next;
|
g = g->next;
|
||||||
decoder->priv->timestamps = g_list_remove (decoder->priv->timestamps, ts);
|
decoder->priv->timestamps = g_list_remove (decoder->priv->timestamps, ts);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1549,7 +1555,7 @@ gst_video_decoder_reset (GstVideoDecoder * decoder, gboolean full)
|
||||||
priv->frame_offset = 0;
|
priv->frame_offset = 0;
|
||||||
gst_adapter_clear (priv->input_adapter);
|
gst_adapter_clear (priv->input_adapter);
|
||||||
gst_adapter_clear (priv->output_adapter);
|
gst_adapter_clear (priv->output_adapter);
|
||||||
g_list_free_full (priv->timestamps, (GDestroyNotify) g_free);
|
g_list_free_full (priv->timestamps, (GDestroyNotify) timestamp_free);
|
||||||
priv->timestamps = NULL;
|
priv->timestamps = NULL;
|
||||||
|
|
||||||
if (priv->current_frame) {
|
if (priv->current_frame) {
|
||||||
|
|
Loading…
Reference in a new issue