mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-28 21:10:34 +00:00
FIX: Removed unncessary NDI free methods
- when looping until a specific frame typeis returned no free are needed
This commit is contained in:
parent
7c98b2e830
commit
dc2591ab45
2 changed files with 16 additions and 12 deletions
|
@ -259,9 +259,9 @@ 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 {
|
||||||
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_recv_free_audio_v2(pNDI_recv, &audio_frame);
|
!= 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
|
||||||
|
@ -269,7 +269,9 @@ impl ObjectSubclass for NdiAudioSrc {
|
||||||
{
|
{
|
||||||
receiver.initial_timestamp = audio_frame.timestamp as u64;
|
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);
|
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();
|
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 {
|
unsafe {
|
||||||
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 {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -268,9 +268,9 @@ 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) != NDIlib_frame_type_e::NDIlib_frame_type_video {
|
while NDIlib_recv_capture_v2(pNDI_recv, &video_frame, ptr::null(), ptr::null(), 1000)
|
||||||
NDIlib_recv_free_video_v2(pNDI_recv, &video_frame);
|
!= 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);
|
||||||
|
|
||||||
if receiver.initial_timestamp <= video_frame.timestamp as u64
|
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;
|
receiver.initial_timestamp = video_frame.timestamp as u64;
|
||||||
}
|
}
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -364,9 +366,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) != NDIlib_frame_type_e::NDIlib_frame_type_video {
|
while NDIlib_recv_capture_v2(pNDI_recv, &video_frame, ptr::null(), ptr::null(), 1000)
|
||||||
NDIlib_recv_free_video_v2(pNDI_recv, &video_frame);
|
!= NDIlib_frame_type_e::NDIlib_frame_type_video {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
settings.latency = gst::SECOND.mul_div_floor(
|
settings.latency = gst::SECOND.mul_div_floor(
|
||||||
video_frame.frame_rate_D as u64,
|
video_frame.frame_rate_D as u64,
|
||||||
|
|
Loading…
Reference in a new issue