added many send+sync restrictions to error annotations for channel sending
This commit is contained in:
parent
570fae4017
commit
9942dca4fb
8 changed files with 10 additions and 10 deletions
|
@ -10,7 +10,7 @@ pub fn spawn(
|
|||
(
|
||||
mpsc::Receiver<util::RawMedia>,
|
||||
mpsc::Receiver<util::RawMedia>,
|
||||
mpsc::Receiver<Box<dyn Error>>
|
||||
mpsc::Receiver<Box<dyn Error + Send + Sync>>
|
||||
),
|
||||
Box<dyn Error>
|
||||
> {
|
||||
|
|
|
@ -74,7 +74,7 @@ impl input::FileReader for FLVReader {
|
|||
self.skip_init_header()?;
|
||||
return self.read_metadata()
|
||||
}
|
||||
fn read_nalu(&mut self, metadata: &util::Metadata) -> Result<util::NALUPacket, Box<dyn Error>> {
|
||||
fn read_nalu(&mut self, metadata: &util::Metadata) -> Result<util::NALUPacket, Box<dyn Error + Send + Sync>> {
|
||||
todo!();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ use crate::demux::flv;
|
|||
|
||||
pub trait FileReader {
|
||||
fn init(&mut self) -> Result<util::Metadata, Box<dyn Error>>;
|
||||
fn read_nalu(&mut self, metadata: &util::Metadata) -> Result<util::NALUPacket, Box<dyn Error>>;
|
||||
fn data_loop(&mut self, v_in: mpsc::Sender<util::NALUPacket>, a_in: mpsc::Sender<util::NALUPacket>, metadata: &util::Metadata, err_in: mpsc::Sender<Box<dyn Error>>) {
|
||||
fn read_nalu(&mut self, metadata: &util::Metadata) -> Result<util::NALUPacket, Box<dyn Error + Send + Sync>>;
|
||||
fn data_loop(&mut self, v_in: mpsc::Sender<util::NALUPacket>, a_in: mpsc::Sender<util::NALUPacket>, metadata: &util::Metadata, err_in: mpsc::Sender<Box<dyn Error + Send + Sync>>) {
|
||||
loop {
|
||||
let nalu = match self.read_nalu(metadata) {
|
||||
Ok(x) => x,
|
||||
|
|
|
@ -13,7 +13,7 @@ pub fn spawn() -> Result<
|
|||
mpsc::Receiver<util::NALUPacket>,
|
||||
mpsc::Receiver<util::NALUPacket>,
|
||||
util::Metadata,
|
||||
mpsc::Receiver<Box<dyn Error>>
|
||||
mpsc::Receiver<Box<dyn Error + Send + Sync>>
|
||||
),
|
||||
Box<dyn Error>
|
||||
> {
|
||||
|
|
|
@ -11,7 +11,7 @@ pub fn spawn(
|
|||
(
|
||||
mpsc::Receiver<util::NALUPacket>,
|
||||
mpsc::Receiver<util::NALUPacket>,
|
||||
mpsc::Receiver<Box<dyn Error>>
|
||||
mpsc::Receiver<Box<dyn Error + Send + Sync>>
|
||||
),
|
||||
Box<dyn Error>
|
||||
> {
|
||||
|
|
|
@ -7,7 +7,7 @@ mod muxer;
|
|||
use std::process::exit;
|
||||
use std::sync::mpsc;
|
||||
|
||||
fn init() -> Result<[mpsc::Receiver<Box<dyn std::error::Error>>; 4], Box<dyn std::error::Error>>{
|
||||
fn init() -> Result<[mpsc::Receiver<Box<dyn std::error::Error + Send + Sync>>; 4], Box<dyn std::error::Error>>{
|
||||
let (v_out, a_out, metadata, demux_err_recv) = demux::spawn()?;
|
||||
let (raw_v_out, raw_a_out, decode_err_recv) = decode::spawn(v_out, a_out, &metadata)?;
|
||||
let (enc_v_out, enc_a_out, encode_err_recv) = encode::spawn(raw_v_out, raw_a_out, &metadata)?;
|
||||
|
@ -15,7 +15,7 @@ fn init() -> Result<[mpsc::Receiver<Box<dyn std::error::Error>>; 4], Box<dyn std
|
|||
return Ok([demux_err_recv, decode_err_recv, encode_err_recv, muxer_err_recv]);
|
||||
}
|
||||
|
||||
fn process(error_handles: [mpsc::Receiver<Box<dyn std::error::Error>>; 4]) -> Result<(), Box<dyn std::error::Error>> {
|
||||
fn process(error_handles: [mpsc::Receiver<Box<dyn std::error::Error + Send + Sync>>; 4]) -> Result<(), Box<dyn std::error::Error>> {
|
||||
todo!();
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ pub fn spawn(
|
|||
a: mpsc::Receiver<util::NALUPacket>,
|
||||
metadata: &util::Metadata
|
||||
) -> Result<
|
||||
mpsc::Receiver<Box<dyn Error>>,
|
||||
mpsc::Receiver<Box<dyn Error + Send + Sync>>,
|
||||
Box<dyn Error>
|
||||
> {
|
||||
todo!();
|
||||
|
|
|
@ -113,7 +113,7 @@ impl fmt::Display for DemuxerError {
|
|||
|
||||
// funcs
|
||||
|
||||
pub fn thread_freeze(err_sender: mpsc::Sender<Box<dyn Error>>, err: Box<dyn Error>) {
|
||||
pub fn thread_freeze(err_sender: mpsc::Sender<Box<dyn Error + Send + Sync>>, err: Box<dyn Error + Send + Sync>) {
|
||||
err_sender.send(err).unwrap();
|
||||
thread::park();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue