Skip to content
This repository was archived by the owner on Apr 25, 2023. It is now read-only.

Commit cf2de09

Browse files
committed
Remove unsafe fetching of sdp as text
1 parent d4165e4 commit cf2de09

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

sendrecv/gst-rust/src/main.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ extern crate ws;
99
#[macro_use]
1010
extern crate serde_json;
1111

12-
use glib::translate::*;
1312
use gst::prelude::*;
1413
use gst::{BinExt, ElementExt};
1514
use rand::Rng;
@@ -112,14 +111,6 @@ fn register_with_server(app_control: &Arc<Mutex<AppControl>>) -> AppState {
112111
return AppState::ServerRegistering;
113112
}
114113

115-
fn sdp_message_as_text(offer: gstreamer_webrtc::WebRTCSessionDescription) -> Option<String> {
116-
unsafe {
117-
from_glib_full(gstreamer_sdp_sys::gst_sdp_message_as_text(
118-
(*offer.to_glib_none().0).sdp,
119-
))
120-
}
121-
}
122-
123114
fn send_sdp_offer(
124115
app_control: &Arc<Mutex<AppControl>>,
125116
offer: gstreamer_webrtc::WebRTCSessionDescription,
@@ -130,11 +121,11 @@ fn send_sdp_offer(
130121
panic!("Can't send offer, not in call");
131122
};
132123
let message = json!({
133-
"sdp": {
134-
"type": "offer",
135-
"sdp": sdp_message_as_text(offer).unwrap(),
136-
}
137-
});
124+
"sdp": {
125+
"type": "offer",
126+
"sdp": offer.get_sdp().as_text(),
127+
}
128+
});
138129
app_control.ws_sender.send(message.to_string()).unwrap();
139130
}
140131

0 commit comments

Comments
 (0)