FIX: left a bracked after unsafe block refactoring

This commit is contained in:
o-reo 2019-03-06 16:16:47 +01:00
parent dc2591ab45
commit 547df0f042
2 changed files with 16 additions and 21 deletions

View file

@ -262,19 +262,17 @@ impl ObjectSubclass for NdiAudioSrc {
while NDIlib_recv_capture_v2(pNDI_recv, ptr::null(), &audio_frame, ptr::null(), 1000) while NDIlib_recv_capture_v2(pNDI_recv, ptr::null(), &audio_frame, ptr::null(), 1000)
!= NDIlib_frame_type_e::NDIlib_frame_type_audio {} != 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 if receiver.initial_timestamp <= audio_frame.timestamp as u64
|| receiver.initial_timestamp == 0 || receiver.initial_timestamp == 0 {
{ receiver.initial_timestamp = audio_frame.timestamp as u64;
receiver.initial_timestamp = audio_frame.timestamp as u64; }
} unsafe {
unsafe { NDIlib_recv_free_audio_v2(pNDI_recv, &audio_frame);
NDIlib_recv_free_audio_v2(pNDI_recv, &audio_frame); }
} gst_debug!(self.cat, obj: element, "Setting initial timestamp to {}", receiver.initial_timestamp);
gst_debug!(self.cat, obj: element, "Setting initial timestamp to {}", receiver.initial_timestamp);
} }
}
self.parent_change_state(element, transition) self.parent_change_state(element, transition)
} }
} }
@ -359,10 +357,8 @@ impl ObjectSubclass for NdiAudioSrc {
let audio_frame: NDIlib_audio_frame_v2_t = Default::default(); let audio_frame: NDIlib_audio_frame_v2_t = Default::default();
unsafe { unsafe {
unsafe { while NDIlib_recv_capture_v2(pNDI_recv, ptr::null(), &audio_frame, ptr::null(), 1000)
while NDIlib_recv_capture_v2(pNDI_recv, ptr::null(), &audio_frame, ptr::null(), 1000) != NDIlib_frame_type_e::NDIlib_frame_type_audio {}
!= NDIlib_frame_type_e::NDIlib_frame_type_audio {}
}
} }
let no_samples = audio_frame.no_samples as u64; let no_samples = audio_frame.no_samples as u64;

View file

@ -268,8 +268,8 @@ impl ObjectSubclass for NdiVideoSrc {
let video_frame: NDIlib_video_frame_v2_t = Default::default(); let video_frame: NDIlib_video_frame_v2_t = Default::default();
unsafe { unsafe {
while NDIlib_recv_capture_v2(pNDI_recv, &video_frame, ptr::null(), ptr::null(), 1000) while NDIlib_recv_capture_v2(pNDI_recv, &video_frame, ptr::null(), ptr::null(), 1000)
!= NDIlib_frame_type_e::NDIlib_frame_type_video {} != NDIlib_frame_type_e::NDIlib_frame_type_video {}
} }
gst_debug!(self.cat, obj: element, "NDI video frame received: {:?}", video_frame); 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; receiver.initial_timestamp = video_frame.timestamp as u64;
} }
unsafe { unsafe {
NDIlib_recv_free_video_v2(pNDI_recv, &video_frame); NDIlib_recv_free_video_v2(pNDI_recv, &video_frame);
} }
gst_debug!(self.cat, obj: element, "Setting initial timestamp to {}", receiver.initial_timestamp); gst_debug!(self.cat, obj: element, "Setting initial timestamp to {}", receiver.initial_timestamp);
} }
}
self.parent_change_state(element, transition) self.parent_change_state(element, transition)
} }
} }