From 9942dca4fb753c7e09041db9c2775591357600ce Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Fri, 6 Oct 2023 15:57:23 +0500 Subject: [PATCH] added many send+sync restrictions to error annotations for channel sending --- src/decode/mod.rs | 2 +- src/demux/flv.rs | 2 +- src/demux/input.rs | 4 ++-- src/demux/mod.rs | 2 +- src/encode/mod.rs | 2 +- src/main.rs | 4 ++-- src/muxer/mod.rs | 2 +- src/util/mod.rs | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/decode/mod.rs b/src/decode/mod.rs index 094ac03..72d9556 100644 --- a/src/decode/mod.rs +++ b/src/decode/mod.rs @@ -10,7 +10,7 @@ pub fn spawn( ( mpsc::Receiver, mpsc::Receiver, - mpsc::Receiver> + mpsc::Receiver> ), Box > { diff --git a/src/demux/flv.rs b/src/demux/flv.rs index 97cb56e..15a2ce2 100644 --- a/src/demux/flv.rs +++ b/src/demux/flv.rs @@ -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> { + fn read_nalu(&mut self, metadata: &util::Metadata) -> Result> { todo!(); } } diff --git a/src/demux/input.rs b/src/demux/input.rs index a4dece6..b5843d5 100644 --- a/src/demux/input.rs +++ b/src/demux/input.rs @@ -8,8 +8,8 @@ use crate::demux::flv; pub trait FileReader { fn init(&mut self) -> Result>; - fn read_nalu(&mut self, metadata: &util::Metadata) -> Result>; - fn data_loop(&mut self, v_in: mpsc::Sender, a_in: mpsc::Sender, metadata: &util::Metadata, err_in: mpsc::Sender>) { + fn read_nalu(&mut self, metadata: &util::Metadata) -> Result>; + fn data_loop(&mut self, v_in: mpsc::Sender, a_in: mpsc::Sender, metadata: &util::Metadata, err_in: mpsc::Sender>) { loop { let nalu = match self.read_nalu(metadata) { Ok(x) => x, diff --git a/src/demux/mod.rs b/src/demux/mod.rs index 7faa5cb..8985850 100644 --- a/src/demux/mod.rs +++ b/src/demux/mod.rs @@ -13,7 +13,7 @@ pub fn spawn() -> Result< mpsc::Receiver, mpsc::Receiver, util::Metadata, - mpsc::Receiver> + mpsc::Receiver> ), Box > { diff --git a/src/encode/mod.rs b/src/encode/mod.rs index 9572052..07fa3d6 100644 --- a/src/encode/mod.rs +++ b/src/encode/mod.rs @@ -11,7 +11,7 @@ pub fn spawn( ( mpsc::Receiver, mpsc::Receiver, - mpsc::Receiver> + mpsc::Receiver> ), Box > { diff --git a/src/main.rs b/src/main.rs index e1e45c4..59f5411 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,7 @@ mod muxer; use std::process::exit; use std::sync::mpsc; -fn init() -> Result<[mpsc::Receiver>; 4], Box>{ +fn init() -> Result<[mpsc::Receiver>; 4], Box>{ 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>; 4], Box>; 4]) -> Result<(), Box> { +fn process(error_handles: [mpsc::Receiver>; 4]) -> Result<(), Box> { todo!(); } diff --git a/src/muxer/mod.rs b/src/muxer/mod.rs index b5540f8..6a9e922 100644 --- a/src/muxer/mod.rs +++ b/src/muxer/mod.rs @@ -8,7 +8,7 @@ pub fn spawn( a: mpsc::Receiver, metadata: &util::Metadata ) -> Result< - mpsc::Receiver>, + mpsc::Receiver>, Box > { todo!(); diff --git a/src/util/mod.rs b/src/util/mod.rs index f6a3ce2..6f11f5e 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -113,7 +113,7 @@ impl fmt::Display for DemuxerError { // funcs -pub fn thread_freeze(err_sender: mpsc::Sender>, err: Box) { +pub fn thread_freeze(err_sender: mpsc::Sender>, err: Box) { err_sender.send(err).unwrap(); thread::park(); }