mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 23:28:16 +00:00
x264enc: Don't set latency while holding object lock
This reverts commit 30a0b50e9ca0d625e61f994d4f8acd022dcddf38. https://bugzilla.gnome.org/show_bug.cgi?id=675762
This commit is contained in:
parent
017bb86d82
commit
3527ccc07e
1 changed files with 15 additions and 12 deletions
|
@ -985,7 +985,7 @@ gst_x264_enc_init_encoder (GstX264Enc * encoder)
|
|||
/* make sure that the encoder is closed */
|
||||
gst_x264_enc_close_encoder (encoder);
|
||||
|
||||
GST_VIDEO_ENCODER_STREAM_LOCK (encoder);
|
||||
GST_OBJECT_LOCK (encoder);
|
||||
|
||||
gst_x264_enc_build_tunings_string (encoder);
|
||||
|
||||
|
@ -1172,7 +1172,7 @@ gst_x264_enc_init_encoder (GstX264Enc * encoder)
|
|||
|
||||
encoder->reconfig = FALSE;
|
||||
|
||||
GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);
|
||||
GST_OBJECT_UNLOCK (encoder);
|
||||
|
||||
encoder->x264enc = x264_encoder_open (&encoder->x264param);
|
||||
if (!encoder->x264enc) {
|
||||
|
@ -1184,7 +1184,7 @@ gst_x264_enc_init_encoder (GstX264Enc * encoder)
|
|||
return TRUE;
|
||||
|
||||
unlock_and_return:
|
||||
GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);
|
||||
GST_OBJECT_UNLOCK (encoder);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1661,6 +1661,7 @@ gst_x264_enc_encode_frame (GstX264Enc * encoder, x264_picture_t * pic_in,
|
|||
GstFlowReturn ret;
|
||||
guint8 *data;
|
||||
GstPad *srcpad;
|
||||
gboolean update_latency = FALSE;
|
||||
|
||||
if (G_UNLIKELY (encoder->x264enc == NULL)) {
|
||||
if (input_frame)
|
||||
|
@ -1668,13 +1669,12 @@ gst_x264_enc_encode_frame (GstX264Enc * encoder, x264_picture_t * pic_in,
|
|||
return GST_FLOW_NOT_NEGOTIATED;
|
||||
}
|
||||
|
||||
GST_VIDEO_ENCODER_STREAM_LOCK (encoder);
|
||||
GST_OBJECT_LOCK (encoder);
|
||||
if (encoder->reconfig) {
|
||||
encoder->reconfig = FALSE;
|
||||
if (x264_encoder_reconfig (encoder->x264enc, &encoder->x264param) < 0)
|
||||
GST_WARNING_OBJECT (encoder, "Could not reconfigure");
|
||||
|
||||
gst_x264_enc_set_latency (encoder);
|
||||
update_latency = TRUE;
|
||||
}
|
||||
|
||||
if (pic_in && input_frame) {
|
||||
|
@ -1686,7 +1686,10 @@ gst_x264_enc_encode_frame (GstX264Enc * encoder, x264_picture_t * pic_in,
|
|||
pic_in->i_type = X264_TYPE_IDR;
|
||||
}
|
||||
}
|
||||
GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);
|
||||
GST_OBJECT_UNLOCK (encoder);
|
||||
|
||||
if (G_UNLIKELY (update_latency))
|
||||
gst_x264_enc_set_latency (encoder);
|
||||
|
||||
encoder_return = x264_encoder_encode (encoder->x264enc,
|
||||
&nal, i_nal, pic_in, &pic_out);
|
||||
|
@ -1800,7 +1803,7 @@ gst_x264_enc_set_property (GObject * object, guint prop_id,
|
|||
|
||||
encoder = GST_X264_ENC (object);
|
||||
|
||||
GST_VIDEO_ENCODER_STREAM_LOCK (encoder);
|
||||
GST_OBJECT_LOCK (encoder);
|
||||
/* state at least matters for sps, bytestream, pass,
|
||||
* and so by extension ... */
|
||||
|
||||
|
@ -1995,14 +1998,14 @@ gst_x264_enc_set_property (GObject * object, guint prop_id,
|
|||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);
|
||||
GST_OBJECT_UNLOCK (encoder);
|
||||
return;
|
||||
|
||||
/* ERROR */
|
||||
wrong_state:
|
||||
{
|
||||
GST_WARNING_OBJECT (encoder, "setting property in wrong state");
|
||||
GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);
|
||||
GST_OBJECT_UNLOCK (encoder);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2014,7 +2017,7 @@ gst_x264_enc_get_property (GObject * object, guint prop_id,
|
|||
|
||||
encoder = GST_X264_ENC (object);
|
||||
|
||||
GST_VIDEO_ENCODER_STREAM_LOCK (encoder);
|
||||
GST_OBJECT_LOCK (encoder);
|
||||
switch (prop_id) {
|
||||
case ARG_THREADS:
|
||||
g_value_set_uint (value, encoder->threads);
|
||||
|
@ -2135,7 +2138,7 @@ gst_x264_enc_get_property (GObject * object, guint prop_id,
|
|||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);
|
||||
GST_OBJECT_UNLOCK (encoder);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
Loading…
Reference in a new issue