net/webrtc/whip_signaller: Use the correct URL during redirect

Copy of 90e06dc3 for whipclientsink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1351>
This commit is contained in:
Taruntej Kanakamalla 2023-10-06 11:23:03 +05:30 committed by GStreamer Marge Bot
parent e4096b5157
commit 245185d2f6

View file

@ -107,28 +107,37 @@ impl Signaller {
); );
let timeout; let timeout;
let endpoint;
{ {
let settings = self.settings.lock().unwrap(); let settings = self.settings.lock().unwrap();
timeout = settings.timeout; timeout = settings.timeout;
endpoint =
reqwest::Url::parse(settings.whip_endpoint.as_ref().unwrap().as_str()).unwrap();
drop(settings); drop(settings);
} }
if let Err(e) = if let Err(e) = wait_async(
wait_async(&self.canceller, self.do_post(offer_sdp, webrtcbin), timeout).await &self.canceller,
self.do_post(offer_sdp, webrtcbin, endpoint),
timeout,
)
.await
{ {
self.handle_future_error(e); self.handle_future_error(e);
} }
} }
#[async_recursion] #[async_recursion]
async fn do_post(&self, offer: gst_webrtc::WebRTCSessionDescription, webrtcbin: &gst::Element) { async fn do_post(
&self,
offer: gst_webrtc::WebRTCSessionDescription,
webrtcbin: &gst::Element,
endpoint: reqwest::Url,
) {
let auth_token; let auth_token;
let endpoint;
{ {
let settings = self.settings.lock().unwrap(); let settings = self.settings.lock().unwrap();
endpoint =
reqwest::Url::parse(settings.whip_endpoint.as_ref().unwrap().as_str()).unwrap();
auth_token = settings.auth_token.clone(); auth_token = settings.auth_token.clone();
drop(settings); drop(settings);
} }
@ -324,7 +333,7 @@ impl Signaller {
redirect_url.as_str() redirect_url.as_str()
); );
self.do_post(offer, webrtcbin).await self.do_post(offer, webrtcbin, redirect_url).await
} }
Err(e) => self.raise_error(e.to_string()), Err(e) => self.raise_error(e.to_string()),
} }