From 8861fc493bda14f3fd15cb6517be8317d4b3e9ac Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Mon, 6 May 2024 13:36:47 +0200 Subject: [PATCH] webrtcsink: improve error when no discovery pipeline runs If for instance no encoder was found or the RTP plugin was missing, it is possible that no discovery pipeline will run for a given stream. Provide a more helpful error message for that case. Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/534 Part-of: --- net/webrtc/src/webrtcsink/imp.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/net/webrtc/src/webrtcsink/imp.rs b/net/webrtc/src/webrtcsink/imp.rs index 3d8ec849..86e7ae38 100644 --- a/net/webrtc/src/webrtcsink/imp.rs +++ b/net/webrtc/src/webrtcsink/imp.rs @@ -3527,6 +3527,15 @@ impl BaseWebRTCSink { } else { let sink_caps = discovery_info.caps.clone(); + if codecs.is_empty() { + return Err(anyhow!( + "No codec available for encoding stream {}, \ + check the webrtcsink logs and verify that \ + the rtp plugin is available", + name + )); + } + let is_video = match sink_caps.structure(0).unwrap().name().as_str() { "video/x-raw" => true, "audio/x-raw" => false,