fake channel usage so testing can happen

This commit is contained in:
Muaz Ahmad 2023-10-08 16:00:00 +05:00
parent 3dc71e7ac7
commit 6c2553f82a
3 changed files with 41 additions and 9 deletions

View file

@ -1,11 +1,13 @@
use std::sync::mpsc;
use std::sync::{mpsc, Arc};
use std::error::Error;
use std::thread;
use crate::util;
pub fn spawn(
v: mpsc::Receiver<util::NALUPacket>,
a: mpsc::Receiver<util::NALUPacket>,
metadata: &util::Metadata
metadata: &Arc<util::Metadata>
) -> Result<
(
mpsc::Receiver<util::RawMedia>,
@ -14,8 +16,18 @@ pub fn spawn(
),
Box<dyn Error>
> {
let (_raw_v_in, raw_v_out) = mpsc::channel();
let (_raw_a_in, raw_a_out) = mpsc::channel();
let (_err_in, err_out) = mpsc::channel();
let (raw_v_in, raw_v_out) = mpsc::channel();
let (raw_a_in, raw_a_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));
}

View file

@ -1,12 +1,13 @@
use std::sync::mpsc;
use std::sync::{mpsc, Arc};
use std::error::Error;
use std::thread;
use crate::util;
pub fn spawn(
v: mpsc::Receiver<util::RawMedia>,
a: mpsc::Receiver<util::RawMedia>,
metadata: &util::Metadata
metadata: &Arc<util::Metadata>
) -> Result<
(
mpsc::Receiver<util::NALUPacket>,
@ -18,5 +19,15 @@ pub fn spawn(
let (v_in, v_out) = mpsc::channel();
let (a_in, a_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));
}

View file

@ -1,16 +1,25 @@
use std::sync::mpsc;
use std::sync::{mpsc, Arc};
use std::error::Error;
use std::thread;
use crate::util;
pub fn spawn(
v: mpsc::Receiver<util::NALUPacket>,
a: mpsc::Receiver<util::NALUPacket>,
metadata: &util::Metadata
metadata: &Arc<util::Metadata>
) -> Result<
mpsc::Receiver<Box<dyn Error + Send + Sync>>,
Box<dyn Error>
> {
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);
}