mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-26 13:31:00 +00:00
whipsink: Handle offer creation errors more gracefully
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/949>
This commit is contained in:
parent
8452cd9efa
commit
9b964db4c9
2 changed files with 21 additions and 6 deletions
|
@ -845,7 +845,7 @@ impl WhepSrc {
|
||||||
gst::element_imp_error!(
|
gst::element_imp_error!(
|
||||||
self_,
|
self_,
|
||||||
gst::LibraryError::Failed,
|
gst::LibraryError::Failed,
|
||||||
["generate offer::Promise returned with no reply: {}", error]
|
["generate offer::Promise returned with error: {}", error]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -427,11 +427,26 @@ impl ObjectImpl for WhipSink {
|
||||||
let whipsink = ele.imp();
|
let whipsink = ele.imp();
|
||||||
|
|
||||||
let offer_sdp = match reply {
|
let offer_sdp = match reply {
|
||||||
Ok(Some(sdp)) => sdp
|
Ok(Some(reply)) => {
|
||||||
.value("offer")
|
if let Ok(sdp) = reply.value("offer").map(|offer| {
|
||||||
.expect("structure must have an offer key")
|
offer.get::<gst_webrtc::WebRTCSessionDescription>().unwrap()
|
||||||
.get::<gst_webrtc::WebRTCSessionDescription>()
|
}) {
|
||||||
.expect("offer must be an SDP"),
|
sdp
|
||||||
|
} else {
|
||||||
|
let error = reply
|
||||||
|
.value("error")
|
||||||
|
.expect("structure must have an error value")
|
||||||
|
.get::<glib::Error>()
|
||||||
|
.expect("value must be a GLib error");
|
||||||
|
|
||||||
|
gst::element_imp_error!(
|
||||||
|
whipsink,
|
||||||
|
gst::LibraryError::Failed,
|
||||||
|
["generate offer::Promise returned with error: {}", error]
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
Ok(None) => {
|
Ok(None) => {
|
||||||
gst::element_error!(
|
gst::element_error!(
|
||||||
ele,
|
ele,
|
||||||
|
|
Loading…
Reference in a new issue