diff --git a/net/webrtchttp/src/whepsrc/imp.rs b/net/webrtchttp/src/whepsrc/imp.rs index 18a81e46..a0b56f11 100644 --- a/net/webrtchttp/src/whepsrc/imp.rs +++ b/net/webrtchttp/src/whepsrc/imp.rs @@ -748,7 +748,7 @@ impl WhepSrc { redirect_url.as_str() ); - self.do_post(sess_desc).await + self.do_post(sess_desc, redirect_url).await } Err(e) => self.raise_error(gst::ResourceError::Failed, e.to_string()), } @@ -918,26 +918,29 @@ impl WhepSrc { let sess_desc = WebRTCSessionDescription::new(WebRTCSDPType::Offer, offer_sdp.sdp()); let timeout; + let endpoint; + { let settings = self.settings.lock().unwrap(); timeout = settings.timeout; + endpoint = + reqwest::Url::parse(settings.whep_endpoint.as_ref().unwrap().as_str()).unwrap(); drop(settings); } - if let Err(e) = wait_async(&self.canceller, self.do_post(sess_desc), timeout).await { + if let Err(e) = + wait_async(&self.canceller, self.do_post(sess_desc, endpoint), timeout).await + { self.handle_future_error(e); } } #[async_recursion] - async fn do_post(&self, offer: WebRTCSessionDescription) { + async fn do_post(&self, offer: WebRTCSessionDescription, endpoint: reqwest::Url) { let auth_token; - let endpoint; { let settings = self.settings.lock().unwrap(); - endpoint = - reqwest::Url::parse(settings.whep_endpoint.as_ref().unwrap().as_str()).unwrap(); auth_token = settings.auth_token.clone(); drop(settings); } diff --git a/net/webrtchttp/src/whipsink/imp.rs b/net/webrtchttp/src/whipsink/imp.rs index bfae01a0..0d1d3649 100644 --- a/net/webrtchttp/src/whipsink/imp.rs +++ b/net/webrtchttp/src/whipsink/imp.rs @@ -343,8 +343,12 @@ impl ObjectImpl for WhipSink { obj.set_suppressed_flags(gst::ElementFlags::SINK | gst::ElementFlags::SOURCE); obj.set_element_flags(gst::ElementFlags::SINK); - gst::warning!(CAT, imp: self, "whipsink will be deprecated in the future, \ - it is recommended that whipclientsink be used instead"); + gst::warning!( + CAT, + imp: self, + "whipsink will be deprecated in the future, \ + it is recommended that whipclientsink be used instead" + ); // The spec requires all m= lines to be bundled (section 4.2) self.webrtcbin @@ -553,26 +557,29 @@ impl WhipSink { ); let timeout; + let endpoint; + { let settings = self.settings.lock().unwrap(); timeout = settings.timeout; + endpoint = + reqwest::Url::parse(settings.whip_endpoint.as_ref().unwrap().as_str()).unwrap(); drop(settings); } - if let Err(e) = wait_async(&self.canceller, self.do_post(offer_sdp), timeout).await { + if let Err(e) = + wait_async(&self.canceller, self.do_post(offer_sdp, endpoint), timeout).await + { self.handle_future_error(e); } } #[async_recursion] - async fn do_post(&self, offer: gst_webrtc::WebRTCSessionDescription) { + async fn do_post(&self, offer: gst_webrtc::WebRTCSessionDescription, endpoint: reqwest::Url) { let auth_token; - let endpoint; { 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(); drop(settings); } @@ -777,7 +784,7 @@ impl WhipSink { redirect_url.as_str() ); - self.do_post(offer).await + self.do_post(offer, redirect_url).await } Err(e) => self.raise_error(gst::ResourceError::Failed, e.to_string()), }