FIX: Removed unncessary NDI free methods

- when looping until a specific frame typeis returned no free are needed
This commit is contained in:
o-reo 2019-03-05 17:59:44 +01:00
parent 7c98b2e830
commit dc2591ab45
2 changed files with 16 additions and 12 deletions

View file

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

View file

@ -268,9 +268,9 @@ 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 {
NDIlib_recv_free_video_v2(pNDI_recv, &video_frame);
}
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);
if receiver.initial_timestamp <= video_frame.timestamp as u64
@ -278,7 +278,9 @@ impl ObjectSubclass for NdiVideoSrc {
{
receiver.initial_timestamp = video_frame.timestamp as u64;
}
unsafe {
NDIlib_recv_free_video_v2(pNDI_recv, &video_frame);
}
gst_debug!(self.cat, obj: element, "Setting initial timestamp to {}", receiver.initial_timestamp);
}
}
@ -364,9 +366,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 {
NDIlib_recv_free_video_v2(pNDI_recv, &video_frame);
}
while NDIlib_recv_capture_v2(pNDI_recv, &video_frame, ptr::null(), ptr::null(), 1000)
!= NDIlib_frame_type_e::NDIlib_frame_type_video {}
}
settings.latency = gst::SECOND.mul_div_floor(
video_frame.frame_rate_D as u64,