transcoder: Handle the case where several errors are posted

There were cases where the loop was already destroyed when we were
receiving the following message.
This commit is contained in:
Thibault Saunier 2020-11-19 17:55:10 -03:00
parent 9d890c152e
commit b3544e24ba

View file

@ -1079,13 +1079,20 @@ _error_cb (GstTranscoder * self, GError * error, GstStructure * details,
{
if (data->error == NULL)
g_propagate_error (&data->error, error);
g_main_loop_quit (data->loop);
if (data->loop) {
g_main_loop_quit (data->loop);
data->loop = NULL;
}
}
static void
_done_cb (GstTranscoder * self, RunSyncData * data)
{
g_main_loop_quit (data->loop);
if (data->loop) {
g_main_loop_quit (data->loop);
data->loop = NULL;
}
}
/**
@ -1110,6 +1117,9 @@ gst_transcoder_run (GstTranscoder * self, GError ** error)
if (!data.error)
g_main_loop_run (data.loop);
g_signal_handlers_disconnect_by_func (self, _error_cb, &data);
g_signal_handlers_disconnect_by_func (self, _done_cb, &data);
if (data.error) {
if (error)
g_propagate_error (error, data.error);