/* 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);
encoder->reconfig = FALSE;
- GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);
+ GST_OBJECT_UNLOCK (encoder);
encoder->x264enc = x264_encoder_open (&encoder->x264param);
if (!encoder->x264enc) {
return TRUE;
unlock_and_return:
- GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);
+ GST_OBJECT_UNLOCK (encoder);
return FALSE;
}
GstFlowReturn ret;
guint8 *data;
GstPad *srcpad;
+ gboolean update_latency = FALSE;
if (G_UNLIKELY (encoder->x264enc == NULL)) {
if (input_frame)
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) {
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);
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 ... */
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);
}
}
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);
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
- GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);
+ GST_OBJECT_UNLOCK (encoder);
}
static gboolean