mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
convertframe: Fix async video sample conversion with non-default context
The GSource for dealing with timeouts in gst_video_convert_sample_async() might be attached to a non-default context, so we should not be using g_source_remove() on the returned ID. The correct thing to do is to keep a reference to the actual GSource and then call g_source_destroy() on it. https://bugzilla.gnome.org/show_bug.cgi?id=780297
This commit is contained in:
parent
587c417d89
commit
a6742e81b9
1 changed files with 9 additions and 10 deletions
|
@ -422,7 +422,7 @@ typedef struct
|
||||||
GMainContext *context;
|
GMainContext *context;
|
||||||
GstSample *sample;
|
GstSample *sample;
|
||||||
//GstBuffer *buffer;
|
//GstBuffer *buffer;
|
||||||
gulong timeout_id;
|
GSource *timeout_source;
|
||||||
gboolean finished;
|
gboolean finished;
|
||||||
} GstVideoConvertSampleContext;
|
} GstVideoConvertSampleContext;
|
||||||
|
|
||||||
|
@ -445,8 +445,8 @@ gst_video_convert_frame_context_free (GstVideoConvertSampleContext * ctx)
|
||||||
g_mutex_lock (&ctx->mutex);
|
g_mutex_lock (&ctx->mutex);
|
||||||
g_mutex_unlock (&ctx->mutex);
|
g_mutex_unlock (&ctx->mutex);
|
||||||
g_mutex_clear (&ctx->mutex);
|
g_mutex_clear (&ctx->mutex);
|
||||||
if (ctx->timeout_id)
|
if (ctx->timeout_source)
|
||||||
g_source_remove (ctx->timeout_id);
|
g_source_destroy (ctx->timeout_source);
|
||||||
//if (ctx->buffer)
|
//if (ctx->buffer)
|
||||||
// gst_buffer_unref (ctx->buffer);
|
// gst_buffer_unref (ctx->buffer);
|
||||||
if (ctx->sample)
|
if (ctx->sample)
|
||||||
|
@ -486,9 +486,9 @@ convert_frame_finish (GstVideoConvertSampleContext * context,
|
||||||
GSource *source;
|
GSource *source;
|
||||||
GstVideoConvertSampleCallbackContext *ctx;
|
GstVideoConvertSampleCallbackContext *ctx;
|
||||||
|
|
||||||
if (context->timeout_id)
|
if (context->timeout_source)
|
||||||
g_source_remove (context->timeout_id);
|
g_source_destroy (context->timeout_source);
|
||||||
context->timeout_id = 0;
|
context->timeout_source = NULL;
|
||||||
|
|
||||||
ctx = g_slice_new (GstVideoConvertSampleCallbackContext);
|
ctx = g_slice_new (GstVideoConvertSampleCallbackContext);
|
||||||
ctx->callback = context->callback;
|
ctx->callback = context->callback;
|
||||||
|
@ -712,11 +712,10 @@ gst_video_convert_sample_async (GstSample * sample,
|
||||||
ctx->pipeline = pipeline;
|
ctx->pipeline = pipeline;
|
||||||
|
|
||||||
if (timeout != GST_CLOCK_TIME_NONE) {
|
if (timeout != GST_CLOCK_TIME_NONE) {
|
||||||
source = g_timeout_source_new (timeout / GST_MSECOND);
|
ctx->timeout_source = g_timeout_source_new (timeout / GST_MSECOND);
|
||||||
g_source_set_callback (source,
|
g_source_set_callback (ctx->timeout_source,
|
||||||
(GSourceFunc) convert_frame_timeout_callback, ctx, NULL);
|
(GSourceFunc) convert_frame_timeout_callback, ctx, NULL);
|
||||||
ctx->timeout_id = g_source_attach (source, context);
|
g_source_attach (ctx->timeout_source, context);
|
||||||
g_source_unref (source);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_signal_connect (src, "need-data",
|
g_signal_connect (src, "need-data",
|
||||||
|
|
Loading…
Reference in a new issue