diff options
-rw-r--r-- | ext/vpx/gstvp8enc.c | 7 | ||||
-rw-r--r-- | ext/vpx/gstvp9enc.c | 7 |
2 files changed, 10 insertions, 4 deletions
diff --git a/ext/vpx/gstvp8enc.c b/ext/vpx/gstvp8enc.c index 613ce8ada..3dad28344 100644 --- a/ext/vpx/gstvp8enc.c +++ b/ext/vpx/gstvp8enc.c @@ -1512,10 +1512,13 @@ gst_vp8_enc_set_format (GstVideoEncoder * video_encoder, if (encoder->inited) { gst_vp8_enc_drain (video_encoder); + g_mutex_lock (&encoder->encoder_lock); vpx_codec_destroy (&encoder->encoder); + encoder->inited = FALSE; + } else { + g_mutex_lock (&encoder->encoder_lock); } - g_mutex_lock (&encoder->encoder_lock); encoder->cfg.g_profile = gst_vp8_enc_get_downstream_profile (encoder); /* Scale default bitrate to our size */ @@ -1888,11 +1891,11 @@ gst_vp8_enc_drain (GstVideoEncoder * video_encoder) g_mutex_lock (&encoder->encoder_lock); deadline = encoder->deadline; - g_mutex_unlock (&encoder->encoder_lock); status = vpx_codec_encode (&encoder->encoder, NULL, encoder->n_frames, 1, flags, deadline); + g_mutex_unlock (&encoder->encoder_lock); if (status != 0) { GST_ERROR_OBJECT (encoder, "encode returned %d %s", status, diff --git a/ext/vpx/gstvp9enc.c b/ext/vpx/gstvp9enc.c index c4c2c9d81..58c98c74e 100644 --- a/ext/vpx/gstvp9enc.c +++ b/ext/vpx/gstvp9enc.c @@ -1488,10 +1488,13 @@ gst_vp9_enc_set_format (GstVideoEncoder * video_encoder, if (encoder->inited) { gst_vp9_enc_drain (video_encoder); + g_mutex_lock (&encoder->encoder_lock); vpx_codec_destroy (&encoder->encoder); + encoder->inited = FALSE; + } else { + g_mutex_lock (&encoder->encoder_lock); } - g_mutex_lock (&encoder->encoder_lock); encoder->cfg.g_profile = gst_vp9_enc_get_downstream_profile (encoder); /* Scale default bitrate to our size */ @@ -1827,11 +1830,11 @@ gst_vp9_enc_drain (GstVideoEncoder * video_encoder) g_mutex_lock (&encoder->encoder_lock); deadline = encoder->deadline; - g_mutex_unlock (&encoder->encoder_lock); status = vpx_codec_encode (&encoder->encoder, NULL, encoder->n_frames, 1, flags, deadline); + g_mutex_unlock (&encoder->encoder_lock); if (status != 0) { GST_ERROR_OBJECT (encoder, "encode returned %d %s", status, |