fake channel usage so testing can happen
This commit is contained in:
parent
3dc71e7ac7
commit
6c2553f82a
3 changed files with 41 additions and 9 deletions
|
@ -1,11 +1,13 @@
|
||||||
use std::sync::mpsc;
|
use std::sync::{mpsc, Arc};
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
use std::thread;
|
||||||
|
|
||||||
use crate::util;
|
use crate::util;
|
||||||
|
|
||||||
pub fn spawn(
|
pub fn spawn(
|
||||||
v: mpsc::Receiver<util::NALUPacket>,
|
v: mpsc::Receiver<util::NALUPacket>,
|
||||||
a: mpsc::Receiver<util::NALUPacket>,
|
a: mpsc::Receiver<util::NALUPacket>,
|
||||||
metadata: &util::Metadata
|
metadata: &Arc<util::Metadata>
|
||||||
) -> Result<
|
) -> Result<
|
||||||
(
|
(
|
||||||
mpsc::Receiver<util::RawMedia>,
|
mpsc::Receiver<util::RawMedia>,
|
||||||
|
@ -14,8 +16,18 @@ pub fn spawn(
|
||||||
),
|
),
|
||||||
Box<dyn Error>
|
Box<dyn Error>
|
||||||
> {
|
> {
|
||||||
let (_raw_v_in, raw_v_out) = mpsc::channel();
|
let (raw_v_in, raw_v_out) = mpsc::channel();
|
||||||
let (_raw_a_in, raw_a_out) = mpsc::channel();
|
let (raw_a_in, raw_a_out) = mpsc::channel();
|
||||||
let (_err_in, err_out) = mpsc::channel();
|
let (err_in, err_out) = mpsc::channel();
|
||||||
|
let metadata_handle = metadata.clone();
|
||||||
|
thread::spawn(move || {
|
||||||
|
&raw_v_in;
|
||||||
|
&raw_a_in;
|
||||||
|
&err_in;
|
||||||
|
&metadata_handle;
|
||||||
|
&v;
|
||||||
|
&a;
|
||||||
|
thread::park();
|
||||||
|
});
|
||||||
return Ok((raw_v_out, raw_a_out, err_out));
|
return Ok((raw_v_out, raw_a_out, err_out));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
use std::sync::mpsc;
|
use std::sync::{mpsc, Arc};
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
use std::thread;
|
||||||
|
|
||||||
use crate::util;
|
use crate::util;
|
||||||
|
|
||||||
pub fn spawn(
|
pub fn spawn(
|
||||||
v: mpsc::Receiver<util::RawMedia>,
|
v: mpsc::Receiver<util::RawMedia>,
|
||||||
a: mpsc::Receiver<util::RawMedia>,
|
a: mpsc::Receiver<util::RawMedia>,
|
||||||
metadata: &util::Metadata
|
metadata: &Arc<util::Metadata>
|
||||||
) -> Result<
|
) -> Result<
|
||||||
(
|
(
|
||||||
mpsc::Receiver<util::NALUPacket>,
|
mpsc::Receiver<util::NALUPacket>,
|
||||||
|
@ -18,5 +19,15 @@ pub fn spawn(
|
||||||
let (v_in, v_out) = mpsc::channel();
|
let (v_in, v_out) = mpsc::channel();
|
||||||
let (a_in, a_out) = mpsc::channel();
|
let (a_in, a_out) = mpsc::channel();
|
||||||
let (err_in, err_out) = mpsc::channel();
|
let (err_in, err_out) = mpsc::channel();
|
||||||
|
let metadata_handle = metadata.clone();
|
||||||
|
thread::spawn(move || {
|
||||||
|
&v;
|
||||||
|
&a;
|
||||||
|
&v_in;
|
||||||
|
&a_in;
|
||||||
|
&err_in;
|
||||||
|
&metadata_handle;
|
||||||
|
thread::park();
|
||||||
|
});
|
||||||
return Ok((v_out, a_out, err_out));
|
return Ok((v_out, a_out, err_out));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,25 @@
|
||||||
use std::sync::mpsc;
|
use std::sync::{mpsc, Arc};
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
use std::thread;
|
||||||
|
|
||||||
use crate::util;
|
use crate::util;
|
||||||
|
|
||||||
pub fn spawn(
|
pub fn spawn(
|
||||||
v: mpsc::Receiver<util::NALUPacket>,
|
v: mpsc::Receiver<util::NALUPacket>,
|
||||||
a: mpsc::Receiver<util::NALUPacket>,
|
a: mpsc::Receiver<util::NALUPacket>,
|
||||||
metadata: &util::Metadata
|
metadata: &Arc<util::Metadata>
|
||||||
) -> Result<
|
) -> Result<
|
||||||
mpsc::Receiver<Box<dyn Error + Send + Sync>>,
|
mpsc::Receiver<Box<dyn Error + Send + Sync>>,
|
||||||
Box<dyn Error>
|
Box<dyn Error>
|
||||||
> {
|
> {
|
||||||
let (err_in, err_out) = mpsc::channel();
|
let (err_in, err_out) = mpsc::channel();
|
||||||
|
let metadata_handle = metadata.clone();
|
||||||
|
thread::spawn(move || {
|
||||||
|
&v;
|
||||||
|
&a;
|
||||||
|
&err_in;
|
||||||
|
&metadata_handle;
|
||||||
|
thread::park();
|
||||||
|
});
|
||||||
return Ok(err_out);
|
return Ok(err_out);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue