From e72e361b63a9bc370abbbaa79c3a2fd5324401e2 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 9bce326c..d05d0732 100644 --- a/net/webrtc/src/webrtcsink/imp.rs +++ b/net/webrtc/src/webrtcsink/imp.rs @@ -3436,6 +3436,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,