feat(voice): harden Android audio and channel joins
This commit is contained in:
@@ -12,8 +12,8 @@
|
||||
use audiopus::coder::{Decoder, Encoder};
|
||||
use audiopus::packet::Packet;
|
||||
use audiopus::{Application, Channels, MutSignals, SampleRate};
|
||||
use std::convert::TryFrom;
|
||||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
||||
use std::convert::TryFrom;
|
||||
|
||||
mod common;
|
||||
use common::{synthetic_opus_bytes, synthetic_opus_frame};
|
||||
@@ -43,11 +43,17 @@ fn bench_opus_decode_latency(c: &mut Criterion) {
|
||||
b.iter(|| {
|
||||
let input = Packet::try_from(black_box(&bytes[..])).expect("packet");
|
||||
let output = MutSignals::try_from(&mut pcm_out[..]).expect("signals");
|
||||
let n = dec.decode_float(Some(input), output, false).expect("decode");
|
||||
let n = dec
|
||||
.decode_float(Some(input), output, false)
|
||||
.expect("decode");
|
||||
black_box(n);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
criterion_group!(opus_codec, bench_opus_encode_latency, bench_opus_decode_latency);
|
||||
criterion_group!(
|
||||
opus_codec,
|
||||
bench_opus_encode_latency,
|
||||
bench_opus_decode_latency
|
||||
);
|
||||
criterion_main!(opus_codec);
|
||||
|
||||
@@ -80,9 +80,7 @@ fn bench_capture_alloc_count(c: &mut Criterion) {
|
||||
// here and the emitter reads it directly.
|
||||
if let Ok(dir) = std::env::var("CARGO_TARGET_DIR")
|
||||
.map(std::path::PathBuf::from)
|
||||
.or_else(|_| {
|
||||
std::env::current_dir().map(|d| d.join("target"))
|
||||
})
|
||||
.or_else(|_| std::env::current_dir().map(|d| d.join("target")))
|
||||
{
|
||||
let path = dir.join("criterion").join("capture_alloc_count.sidecar");
|
||||
if let Some(parent) = path.parent() {
|
||||
|
||||
Reference in New Issue
Block a user