mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-24 02:50:34 +00:00
Close NDI stream when closing gstreamer
This commit is contained in:
parent
a89334a500
commit
e8ee6fd806
2 changed files with 18 additions and 3 deletions
|
@ -15,7 +15,8 @@ extern "C" {
|
|||
pub fn NDIlib_recv_create_v3(
|
||||
p_create_settings: *const NDIlib_recv_create_v3_t,
|
||||
) -> NDIlib_recv_instance_t;
|
||||
pub fn NDIlib_find_destroy(p_instance: NDIlib_find_instance_t);
|
||||
pub fn NDIlib_find_destroy(p_instance: NDIlib_recv_instance_t);
|
||||
pub fn NDIlib_recv_destroy(p_instance: NDIlib_recv_instance_t);
|
||||
pub fn NDIlib_recv_set_tally(
|
||||
p_instance: NDIlib_recv_instance_t,
|
||||
p_tally: *const NDIlib_tally_t,
|
||||
|
|
|
@ -415,9 +415,23 @@ impl NdiSrc {
|
|||
// Called when shutting down the element so we can release all stream-related state
|
||||
fn stop(&self, element: &BaseSrc) -> bool {
|
||||
// Reset state
|
||||
*self.state.lock().unwrap() = Default::default();
|
||||
let state = self.state.lock().unwrap();
|
||||
let recv = match state.recv{
|
||||
None => {
|
||||
//println!("pNDI_recv no encontrado");
|
||||
gst_element_error!(element, gst::CoreError::Negotiation, ["No encontramos ndi recv"]);
|
||||
return true;
|
||||
}
|
||||
Some(ref recv) => recv.clone(),
|
||||
};
|
||||
let pNDI_recv = recv.recv;
|
||||
unsafe{
|
||||
NDIlib_recv_destroy(pNDI_recv);
|
||||
//NDIlib_destroy();
|
||||
}
|
||||
// Commented because when adding ndi destroy stopped in this line
|
||||
//*self.state.lock().unwrap() = Default::default();
|
||||
self.unlock(element);
|
||||
|
||||
gst_info!(self.cat, obj: element, "Stopped");
|
||||
|
||||
true
|
||||
|
|
Loading…
Reference in a new issue