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.
This commit is contained in:
Robert Mader 2023-02-22 21:16:18 +01:00 committed by Wim Taymans
parent eb797cac48
commit 06bad5523d

View file

@ -944,18 +944,26 @@ no_nego_needed:
} }
no_caps: no_caps:
{ {
const gchar * error_string = "No supported formats found";
GST_ELEMENT_ERROR (basesrc, STREAM, FORMAT, GST_ELEMENT_ERROR (basesrc, STREAM, FORMAT,
("No supported formats found"), ("%s", error_string),
("This element did not produce valid caps")); ("This element did not produce valid caps"));
pw_stream_set_error (pwsrc->stream, -EINVAL, "%s", error_string);
if (thiscaps) if (thiscaps)
gst_caps_unref (thiscaps); gst_caps_unref (thiscaps);
return FALSE; return FALSE;
} }
no_common_caps: no_common_caps:
{ {
const gchar * error_string = "No supported formats found";
GST_ELEMENT_ERROR (basesrc, STREAM, FORMAT, GST_ELEMENT_ERROR (basesrc, STREAM, FORMAT,
("No supported formats found"), ("%s", error_string),
("This element does not have formats in common with the peer")); ("This element does not have formats in common with the peer"));
pw_stream_set_error (pwsrc->stream, -EPIPE, "%s", error_string);
if (caps) if (caps)
gst_caps_unref (caps); gst_caps_unref (caps);
return FALSE; return FALSE;