diff options
author | He Junyan <junyan.he@intel.com> | 2021-08-04 15:02:01 +0800 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2021-08-09 12:47:06 +0100 |
commit | a2844f29d32a25462cf34d60ffc84fc45af5a8ac (patch) | |
tree | c8a090f94dd2365f2e8ab33b195cce3801c286fa | |
parent | ff04bd8cf266e06487cfad2a1f7676c80ecfdaff (diff) | |
download | gstreamer-plugins-bad-a2844f29d32a25462cf34d60ffc84fc45af5a8ac.tar.gz |
x265: Fix a deadlock when failing to create the x265enc.
The GST_ELEMENT_ERROR will call the gst_object_get_path_string and
use gst_object_get_parent to get the full object path name, which
needs to lock the object. But we are already in a locked context and
so this will cause a deadlock, the pipeline can not exit normally.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2460>
-rw-r--r-- | ext/x265/gstx265enc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/x265/gstx265enc.c b/ext/x265/gstx265enc.c index d0dc3f761..430f11c98 100644 --- a/ext/x265/gstx265enc.c +++ b/ext/x265/gstx265enc.c @@ -980,8 +980,7 @@ gst_x265_enc_init_encoder_locked (GstX265Enc * encoder) encoder->x265enc = encoder->api->encoder_open (&encoder->x265param); if (!encoder->x265enc) { - GST_ELEMENT_ERROR (encoder, STREAM, ENCODE, - ("Can not initialize x265 encoder."), (NULL)); + GST_ERROR_OBJECT (encoder, "Can not open x265 encoder."); return FALSE; } @@ -1006,6 +1005,10 @@ gst_x265_enc_init_encoder (GstX265Enc * encoder) result = gst_x265_enc_init_encoder_locked (encoder); GST_OBJECT_UNLOCK (encoder); + if (!result) + GST_ELEMENT_ERROR (encoder, STREAM, ENCODE, + ("Can not initialize x265 encoder."), (NULL)); + return result; } |