summaryrefslogtreecommitdiff
path: root/ext/vpx/gstvp9enc.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/vpx/gstvp9enc.c')
-rw-r--r--ext/vpx/gstvp9enc.c7
1 files changed, 5 insertions, 2 deletions
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,