implement assuming arc mutex (non-mutable ptr) not actual variable

This commit is contained in:
Muaz Ahmad 2023-10-10 14:38:58 +05:00
parent 6b9427aec1
commit 44b647615e

View file

@ -7,8 +7,8 @@ use std::error::Error;
use crate::util; use crate::util;
pub trait Decoder { pub trait Decoder {
fn write_nalu(&mut self, nalu: util::NALUPacket) -> Result<(), Box<dyn Error + Send + Sync>>; fn write_nalu(&self, nalu: util::NALUPacket) -> Result<(), Box<dyn Error + Send + Sync>>;
fn write_loop(&mut self, chan_in: mpsc::Receiver<util::NALUPacket>, err_in: mpsc::Sender<Box<dyn Error + Send + Sync>>) { fn write_loop(&self, chan_in: mpsc::Receiver<util::NALUPacket>, err_in: mpsc::Sender<Box<dyn Error + Send + Sync>>) {
loop { loop {
let nalu = match chan_in.recv() { let nalu = match chan_in.recv() {
Ok(x) => x, Ok(x) => x,
@ -20,8 +20,8 @@ pub trait Decoder {
} }
} }
} }
fn read_raw(&mut self) -> Result<util::RawMedia, Box<dyn Error + Send + Sync>>; fn read_raw(&self) -> Result<util::RawMedia, Box<dyn Error + Send + Sync>>;
fn read_loop(&mut self, chan_out: mpsc::Sender<util::RawMedia>, err_in: mpsc::Sender<Box<dyn Error + Send + Sync>>) { fn read_loop(&self, chan_out: mpsc::Sender<util::RawMedia>, err_in: mpsc::Sender<Box<dyn Error + Send + Sync>>) {
loop { loop {
let raw_sample = match self.read_raw() { let raw_sample = match self.read_raw() {
Ok(x) => x, Ok(x) => x,