From 06bad5523d0b4571ffcf78b83aa20d2298b83f15 Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Wed, 22 Feb 2023 21:16:18 +0100 Subject: [PATCH] gstpipewiresrc: Set stream error on caps negotiation failure In order to make `wait_started()` error out accordingly, which otherwise blocks `change_state()` until the timeout is over. --- src/gst/gstpipewiresrc.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gst/gstpipewiresrc.c b/src/gst/gstpipewiresrc.c index baed43bb0..892162aed 100644 --- a/src/gst/gstpipewiresrc.c +++ b/src/gst/gstpipewiresrc.c @@ -944,18 +944,26 @@ no_nego_needed: } no_caps: { + const gchar * error_string = "No supported formats found"; + GST_ELEMENT_ERROR (basesrc, STREAM, FORMAT, - ("No supported formats found"), + ("%s", error_string), ("This element did not produce valid caps")); + pw_stream_set_error (pwsrc->stream, -EINVAL, "%s", error_string); + if (thiscaps) gst_caps_unref (thiscaps); return FALSE; } no_common_caps: { + const gchar * error_string = "No supported formats found"; + GST_ELEMENT_ERROR (basesrc, STREAM, FORMAT, - ("No supported formats found"), + ("%s", error_string), ("This element does not have formats in common with the peer")); + pw_stream_set_error (pwsrc->stream, -EPIPE, "%s", error_string); + if (caps) gst_caps_unref (caps); return FALSE;