mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 14:06:23 +00:00
vtenc: Fix PAUSED->READY deadlock when output loop is running
Explicitly calls gst_vtenc_pause_output_loop when going PAUSED->READY to make sure GST_PAD_STREAM_LOCK is not taken. Before this change, a deadlock would occur if pipeline got stopped right after one output buffer was generated by vtenc. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5933>
This commit is contained in:
parent
978b75b18a
commit
3f67e70f39
1 changed files with 19 additions and 0 deletions
|
@ -156,6 +156,8 @@ static gboolean gst_vtenc_set_format (GstVideoEncoder * enc,
|
|||
GstVideoCodecState * input_state);
|
||||
static GstFlowReturn gst_vtenc_handle_frame (GstVideoEncoder * enc,
|
||||
GstVideoCodecFrame * frame);
|
||||
static GstStateChangeReturn gst_vtenc_change_state (GstElement * element,
|
||||
GstStateChange transition);
|
||||
static GstFlowReturn gst_vtenc_finish (GstVideoEncoder * enc);
|
||||
static gboolean gst_vtenc_flush (GstVideoEncoder * enc);
|
||||
static gboolean gst_vtenc_sink_event (GstVideoEncoder * enc, GstEvent * event);
|
||||
|
@ -342,9 +344,11 @@ static void
|
|||
gst_vtenc_class_init (GstVTEncClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *element_class;
|
||||
GstVideoEncoderClass *gstvideoencoder_class;
|
||||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
element_class = (GstElementClass *) klass;
|
||||
gstvideoencoder_class = (GstVideoEncoderClass *) klass;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
@ -353,6 +357,8 @@ gst_vtenc_class_init (GstVTEncClass * klass)
|
|||
gobject_class->set_property = gst_vtenc_set_property;
|
||||
gobject_class->finalize = gst_vtenc_finalize;
|
||||
|
||||
element_class->change_state = GST_DEBUG_FUNCPTR (gst_vtenc_change_state);
|
||||
|
||||
gstvideoencoder_class->start = gst_vtenc_start;
|
||||
gstvideoencoder_class->stop = gst_vtenc_stop;
|
||||
gstvideoencoder_class->set_format = gst_vtenc_set_format;
|
||||
|
@ -1191,6 +1197,19 @@ gst_vtenc_sink_event (GstVideoEncoder * enc, GstEvent * event)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static GstStateChangeReturn
|
||||
gst_vtenc_change_state (GstElement * element, GstStateChange transition)
|
||||
{
|
||||
GstVTEnc *self = GST_VTENC_CAST (element);
|
||||
|
||||
if (transition == GST_STATE_CHANGE_PAUSED_TO_READY) {
|
||||
GST_DEBUG_OBJECT (self, "pausing output loop on PAUSED->READY");
|
||||
gst_vtenc_pause_output_loop (self);
|
||||
}
|
||||
|
||||
return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_vtenc_finish (GstVideoEncoder * enc)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue