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

Commit

Permalink
Remove unsafe fetching of sdp as text
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmcd committed Jun 5, 2018
1 parent d4165e4 commit cf2de09
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions sendrecv/gst-rust/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ extern crate ws;
#[macro_use]
extern crate serde_json;

use glib::translate::*;
use gst::prelude::*;
use gst::{BinExt, ElementExt};
use rand::Rng;
Expand Down Expand Up @@ -112,14 +111,6 @@ fn register_with_server(app_control: &Arc<Mutex<AppControl>>) -> AppState {
return AppState::ServerRegistering;
}

fn sdp_message_as_text(offer: gstreamer_webrtc::WebRTCSessionDescription) -> Option<String> {
unsafe {
from_glib_full(gstreamer_sdp_sys::gst_sdp_message_as_text(
(*offer.to_glib_none().0).sdp,
))
}
}

fn send_sdp_offer(
app_control: &Arc<Mutex<AppControl>>,
offer: gstreamer_webrtc::WebRTCSessionDescription,
Expand All @@ -130,11 +121,11 @@ fn send_sdp_offer(
panic!("Can't send offer, not in call");
};
let message = json!({
"sdp": {
"type": "offer",
"sdp": sdp_message_as_text(offer).unwrap(),
}
});
"sdp": {
"type": "offer",
"sdp": offer.get_sdp().as_text(),
}
});
app_control.ws_sender.send(message.to_string()).unwrap();
}

Expand Down

0 comments on commit cf2de09

Please sign in to comment.