Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opus::Decoder and opus::Encoder fail, need python method how to get the error? #6

Open
weedge opened this issue Nov 18, 2024 · 1 comment

Comments

@weedge
Copy link

weedge commented Nov 18, 2024

example in rust StreamReader decode packet data error

                let bytes_read = decoder.decode_float(
                    &packet.data,
                    &mut pcm_buf,
                    /* Forward Error Correction */ false,
                );
                match bytes_read {
                    Err(err) => {
                        println!("decode error:{}", err);
                        if pcm_tx.send(Err(err.into())).is_err() {
                            break;
                        };
                        break;
                    }
                    Ok(n) => {
                        if pcm_tx.send(Ok(pcm_buf[..n].to_vec())).is_err() {
                            break;
                        }
                    }
                }

want to get the error in python method in try ... except ... get error to do something , e.g.:

try:
   pcm = OpusStreamReader(24000).read_pcm()
except OpusDecoderException as e:
   print(f"opus decode error: {e}")
@LaurentMazare
Copy link
Member

Could you provide some small reproducible example and detail the current behavior vs what yo would like to see? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants