mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-18 20:25:25 +00:00
nvenc: Fix deadlock when pad_push return was not GST_FLOW_OK
Encoding thread is terminated without any notification so upstream streaming thread is locked because there is nothing to pop from GAsyncQueue. If downstream returns error, we need put SHUTDOWN_COOKIE to GAsyncQueue for chain function can wakeup.
This commit is contained in:
parent
3faf439347
commit
0445ed6ba5
1 changed files with 6 additions and 0 deletions
|
@ -726,6 +726,7 @@ gst_nv_base_enc_bitstream_thread (gpointer user_data)
|
||||||
if (flow != GST_FLOW_OK) {
|
if (flow != GST_FLOW_OK) {
|
||||||
GST_INFO_OBJECT (enc, "got flow %s", gst_flow_get_name (flow));
|
GST_INFO_OBJECT (enc, "got flow %s", gst_flow_get_name (flow));
|
||||||
g_atomic_int_set (&nvenc->last_flow, flow);
|
g_atomic_int_set (&nvenc->last_flow, flow);
|
||||||
|
g_async_queue_push (nvenc->in_bufs_pool, SHUTDOWN_COOKIE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1462,6 +1463,9 @@ _acquire_input_buffer (GstNvBaseEnc * nvenc, gpointer * input)
|
||||||
*input = g_async_queue_pop (nvenc->in_bufs_pool);
|
*input = g_async_queue_pop (nvenc->in_bufs_pool);
|
||||||
GST_VIDEO_ENCODER_STREAM_LOCK (nvenc);
|
GST_VIDEO_ENCODER_STREAM_LOCK (nvenc);
|
||||||
|
|
||||||
|
if (*input == SHUTDOWN_COOKIE)
|
||||||
|
return g_atomic_int_get (&nvenc->last_flow);
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1569,6 +1573,8 @@ gst_nv_base_enc_handle_frame (GstVideoEncoder * enc, GstVideoCodecFrame * frame)
|
||||||
flow = _acquire_input_buffer (nvenc, &input_buffer);
|
flow = _acquire_input_buffer (nvenc, &input_buffer);
|
||||||
if (flow != GST_FLOW_OK)
|
if (flow != GST_FLOW_OK)
|
||||||
goto out;
|
goto out;
|
||||||
|
else if (input_buffer == SHUTDOWN_COOKIE)
|
||||||
|
goto out;
|
||||||
if (input_buffer == NULL)
|
if (input_buffer == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue