Add sdp message init in parse functions

This commit is contained in:
maxmcd 2018-05-31 08:09:49 -04:00 committed by Sebastian Dröge
parent 1192a027b4
commit 40c206d813

View file

@ -723,8 +723,8 @@ impl SDPMessage {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
let size = data.len() as u32; let size = data.len() as u32;
let msg = glib_ffi::g_malloc0(mem::size_of::<ffi::GstSDPMessage>()) let mut msg = mem::zeroed();
as *mut ffi::GstSDPMessage; ffi::gst_sdp_message_new(&mut msg);
let result = ffi::gst_sdp_message_parse_buffer(data.to_glib_none().0, size, msg); let result = ffi::gst_sdp_message_parse_buffer(data.to_glib_none().0, size, msg);
match result { match result {
ffi::GST_SDP_OK => Ok(from_glib_full(msg)), ffi::GST_SDP_OK => Ok(from_glib_full(msg)),
@ -739,8 +739,8 @@ impl SDPMessage {
pub fn parse_uri(uri: &str) -> Result<Self, ()> { pub fn parse_uri(uri: &str) -> Result<Self, ()> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
let msg = glib_ffi::g_malloc0(mem::size_of::<ffi::GstSDPMessage>()) let mut msg = mem::zeroed();
as *mut ffi::GstSDPMessage; ffi::gst_sdp_message_new(&mut msg);
let result = ffi::gst_sdp_message_parse_uri(uri.to_glib_none().0, msg); let result = ffi::gst_sdp_message_parse_uri(uri.to_glib_none().0, msg);
match result { match result {
ffi::GST_SDP_OK => Ok(from_glib_full(msg)), ffi::GST_SDP_OK => Ok(from_glib_full(msg)),