From 547df0f042e827df92f096dbac94133dff2f0fc8 Mon Sep 17 00:00:00 2001 From: o-reo Date: Wed, 6 Mar 2019 16:16:47 +0100 Subject: [PATCH] FIX: left a bracked after unsafe block refactoring --- src/ndiaudiosrc.rs | 26 +++++++++++--------------- src/ndivideosrc.rs | 11 +++++------ 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/ndiaudiosrc.rs b/src/ndiaudiosrc.rs index 797c4228..a6be9d36 100644 --- a/src/ndiaudiosrc.rs +++ b/src/ndiaudiosrc.rs @@ -262,19 +262,17 @@ impl ObjectSubclass for NdiAudioSrc { while NDIlib_recv_capture_v2(pNDI_recv, ptr::null(), &audio_frame, ptr::null(), 1000) != NDIlib_frame_type_e::NDIlib_frame_type_audio {} } - gst_debug!(self.cat, obj: element, "NDI audio frame received: {:?}", audio_frame); + gst_debug!(self.cat, obj: element, "NDI audio frame received: {:?}", audio_frame); - if receiver.initial_timestamp <= audio_frame.timestamp as u64 - || receiver.initial_timestamp == 0 - { - receiver.initial_timestamp = audio_frame.timestamp as u64; - } - unsafe { - NDIlib_recv_free_audio_v2(pNDI_recv, &audio_frame); - } - gst_debug!(self.cat, obj: element, "Setting initial timestamp to {}", receiver.initial_timestamp); + if receiver.initial_timestamp <= audio_frame.timestamp as u64 + || receiver.initial_timestamp == 0 { + receiver.initial_timestamp = audio_frame.timestamp as u64; + } + unsafe { + NDIlib_recv_free_audio_v2(pNDI_recv, &audio_frame); + } + gst_debug!(self.cat, obj: element, "Setting initial timestamp to {}", receiver.initial_timestamp); } - } self.parent_change_state(element, transition) } } @@ -359,10 +357,8 @@ impl ObjectSubclass for NdiAudioSrc { let audio_frame: NDIlib_audio_frame_v2_t = Default::default(); unsafe { - unsafe { - while NDIlib_recv_capture_v2(pNDI_recv, ptr::null(), &audio_frame, ptr::null(), 1000) - != NDIlib_frame_type_e::NDIlib_frame_type_audio {} - } + while NDIlib_recv_capture_v2(pNDI_recv, ptr::null(), &audio_frame, ptr::null(), 1000) + != NDIlib_frame_type_e::NDIlib_frame_type_audio {} } let no_samples = audio_frame.no_samples as u64; diff --git a/src/ndivideosrc.rs b/src/ndivideosrc.rs index 283a68a2..487865c2 100644 --- a/src/ndivideosrc.rs +++ b/src/ndivideosrc.rs @@ -268,8 +268,8 @@ impl ObjectSubclass for NdiVideoSrc { let video_frame: NDIlib_video_frame_v2_t = Default::default(); unsafe { - while NDIlib_recv_capture_v2(pNDI_recv, &video_frame, ptr::null(), ptr::null(), 1000) - != NDIlib_frame_type_e::NDIlib_frame_type_video {} + while NDIlib_recv_capture_v2(pNDI_recv, &video_frame, ptr::null(), ptr::null(), 1000) + != NDIlib_frame_type_e::NDIlib_frame_type_video {} } gst_debug!(self.cat, obj: element, "NDI video frame received: {:?}", video_frame); @@ -278,12 +278,11 @@ impl ObjectSubclass for NdiVideoSrc { { receiver.initial_timestamp = video_frame.timestamp as u64; } - unsafe { - NDIlib_recv_free_video_v2(pNDI_recv, &video_frame); - } + unsafe { + NDIlib_recv_free_video_v2(pNDI_recv, &video_frame); + } gst_debug!(self.cat, obj: element, "Setting initial timestamp to {}", receiver.initial_timestamp); } - } self.parent_change_state(element, transition) } }