mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-18 16:16:28 +00:00
quinn: fix racy tests
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1867>
This commit is contained in:
parent
2d6f084596
commit
b020ae6fc2
1 changed files with 13 additions and 4 deletions
|
@ -9,6 +9,8 @@
|
|||
|
||||
use gst::prelude::*;
|
||||
use serial_test::serial;
|
||||
use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
use std::thread;
|
||||
|
||||
fn init() {
|
||||
|
@ -41,9 +43,13 @@ fn send_receive(src_pipeline_props: &str, sink_pipeline_props: &str) {
|
|||
address=127.0.0.1 secure-connection=false",
|
||||
sink_pipeline_props
|
||||
);
|
||||
let h1_orig = Arc::new(Mutex::new(gst_check::Harness::new_empty()));
|
||||
|
||||
let h11 = h1_orig.clone();
|
||||
|
||||
thread::spawn(move || {
|
||||
let mut h1 = gst_check::Harness::new_empty();
|
||||
let mut h1 = h11.lock().unwrap();
|
||||
|
||||
h1.add_parse(&sink_pipeline);
|
||||
|
||||
h1.set_src_caps(gst::Caps::builder("text/plain").build());
|
||||
|
@ -54,8 +60,6 @@ fn send_receive(src_pipeline_props: &str, sink_pipeline_props: &str) {
|
|||
|
||||
h1.push_event(gst::event::Eos::new());
|
||||
|
||||
h1.element().unwrap().set_state(gst::State::Null).unwrap();
|
||||
|
||||
drop(h1);
|
||||
});
|
||||
|
||||
|
@ -71,8 +75,13 @@ fn send_receive(src_pipeline_props: &str, sink_pipeline_props: &str) {
|
|||
buf.into_mapped_buffer_readable().unwrap().as_slice()
|
||||
);
|
||||
|
||||
h2.element().unwrap().set_state(gst::State::Null).unwrap();
|
||||
// Close the server now that the client has finished reading the data
|
||||
let h11 = h1_orig.clone();
|
||||
let h1 = h11.lock().unwrap();
|
||||
h1.element().unwrap().set_state(gst::State::Null).unwrap();
|
||||
drop(h1);
|
||||
|
||||
h2.element().unwrap().set_state(gst::State::Null).unwrap();
|
||||
drop(h2);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue