removed unnecessary logs
This commit is contained in:
@@ -245,7 +245,6 @@ where
|
|||||||
let mut resampler = LinearResampler::new();
|
let mut resampler = LinearResampler::new();
|
||||||
let mut mono_buffer = Vec::with_capacity(2048);
|
let mut mono_buffer = Vec::with_capacity(2048);
|
||||||
let mut resampled_buffer = Vec::with_capacity(2048);
|
let mut resampled_buffer = Vec::with_capacity(2048);
|
||||||
let mut callback_count: u64 = 0;
|
|
||||||
|
|
||||||
let inner_input_err = Arc::clone(&state_inner);
|
let inner_input_err = Arc::clone(&state_inner);
|
||||||
|
|
||||||
@@ -253,20 +252,6 @@ where
|
|||||||
.build_input_stream(
|
.build_input_stream(
|
||||||
config,
|
config,
|
||||||
move |data: &[T], _| {
|
move |data: &[T], _| {
|
||||||
callback_count += 1;
|
|
||||||
if callback_count % 200 == 0 {
|
|
||||||
let peak: f32 = data
|
|
||||||
.iter()
|
|
||||||
.map(|&s| s.to_sample::<f32>().abs())
|
|
||||||
.fold(0.0f32, f32::max);
|
|
||||||
eprintln!(
|
|
||||||
"[vc] input callback #{callback_count}: {} frames, {} ch, peak {:.4}",
|
|
||||||
data.len() / channels,
|
|
||||||
channels,
|
|
||||||
peak
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
mono_buffer.clear();
|
mono_buffer.clear();
|
||||||
resampled_buffer.clear();
|
resampled_buffer.clear();
|
||||||
|
|
||||||
@@ -352,7 +337,6 @@ where
|
|||||||
let mut raw_mono_samples = Vec::with_capacity(2048);
|
let mut raw_mono_samples = Vec::with_capacity(2048);
|
||||||
let mut resampled_mono = Vec::with_capacity(2048);
|
let mut resampled_mono = Vec::with_capacity(2048);
|
||||||
let mut last_sample = 0.0f32;
|
let mut last_sample = 0.0f32;
|
||||||
let mut callback_count: u64 = 0;
|
|
||||||
|
|
||||||
let inner_output_err = Arc::clone(&state_inner);
|
let inner_output_err = Arc::clone(&state_inner);
|
||||||
|
|
||||||
@@ -360,22 +344,12 @@ where
|
|||||||
.build_output_stream(
|
.build_output_stream(
|
||||||
config,
|
config,
|
||||||
move |data: &mut [T], _| {
|
move |data: &mut [T], _| {
|
||||||
callback_count += 1;
|
|
||||||
if callback_count % 200 == 0 {
|
|
||||||
eprintln!(
|
|
||||||
"[vc] output callback #{callback_count}: {} frames, {} ch",
|
|
||||||
data.len() / channels,
|
|
||||||
channels
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let required_mono_samples = (data.len() / channels) * TARGET_SAMPLE_RATE as usize
|
let required_mono_samples = (data.len() / channels) * TARGET_SAMPLE_RATE as usize
|
||||||
/ native_sample_rate as usize;
|
/ native_sample_rate as usize;
|
||||||
|
|
||||||
raw_mono_samples.clear();
|
raw_mono_samples.clear();
|
||||||
resampled_mono.clear();
|
resampled_mono.clear();
|
||||||
|
|
||||||
let mut underflow_count = 0usize;
|
|
||||||
if let Ok(mut cons) = consumer.lock() {
|
if let Ok(mut cons) = consumer.lock() {
|
||||||
for _ in 0..required_mono_samples {
|
for _ in 0..required_mono_samples {
|
||||||
if let Some(s) = cons.try_pop() {
|
if let Some(s) = cons.try_pop() {
|
||||||
@@ -385,18 +359,9 @@ where
|
|||||||
// Exponential decay to prevent clicking when underflowing
|
// Exponential decay to prevent clicking when underflowing
|
||||||
last_sample *= 0.92;
|
last_sample *= 0.92;
|
||||||
raw_mono_samples.push(last_sample);
|
raw_mono_samples.push(last_sample);
|
||||||
underflow_count += 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if callback_count % 200 == 0 {
|
|
||||||
eprintln!(
|
|
||||||
"[vc] output: got {}/{} mono samples ({} underflow)",
|
|
||||||
required_mono_samples - underflow_count,
|
|
||||||
required_mono_samples,
|
|
||||||
underflow_count
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resample from 48kHz mono to target native output rate
|
// Resample from 48kHz mono to target native output rate
|
||||||
resampler.process(
|
resampler.process(
|
||||||
@@ -635,12 +600,6 @@ pub fn connect_to_vc(
|
|||||||
};
|
};
|
||||||
|
|
||||||
loop_count += 1;
|
loop_count += 1;
|
||||||
if loop_count % 200 == 0 {
|
|
||||||
eprintln!(
|
|
||||||
"[vc] sender: buffered {} samples, frame rms {rms:.4}, floor {noise_floor:.4}, thr {threshold:.4}, speaking {is_speaking}, seq {sequence}",
|
|
||||||
consumer_in.occupied_len()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if is_speaking {
|
if is_speaking {
|
||||||
// sequence goes INSIDE the plaintext now, prefixed before the PCM
|
// sequence goes INSIDE the plaintext now, prefixed before the PCM
|
||||||
@@ -690,8 +649,6 @@ pub fn connect_to_vc(
|
|||||||
let mut last_good_frame = vec![0.0f32; PACKET_SAMPLES];
|
let mut last_good_frame = vec![0.0f32; PACKET_SAMPLES];
|
||||||
let mut udp_buffer = [0u8; MAX_PACKET_SIZE];
|
let mut udp_buffer = [0u8; MAX_PACKET_SIZE];
|
||||||
let mut next_frame_time = Instant::now();
|
let mut next_frame_time = Instant::now();
|
||||||
let mut recv_count: u64 = 0;
|
|
||||||
let mut loop_count: u64 = 0;
|
|
||||||
|
|
||||||
while !shutdown.load(Ordering::Relaxed) {
|
while !shutdown.load(Ordering::Relaxed) {
|
||||||
let is_deaf = { backend_config.lock().unwrap().is_deaf };
|
let is_deaf = { backend_config.lock().unwrap().is_deaf };
|
||||||
@@ -704,9 +661,7 @@ pub fn connect_to_vc(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
loop_count += 1;
|
|
||||||
if let Ok(len) = socket.recv(&mut udp_buffer) {
|
if let Ok(len) = socket.recv(&mut udp_buffer) {
|
||||||
recv_count += 1;
|
|
||||||
match cipher.lock().unwrap().decrypt(&udp_buffer[..len]) {
|
match cipher.lock().unwrap().decrypt(&udp_buffer[..len]) {
|
||||||
Ok(plaintext) => {
|
Ok(plaintext) => {
|
||||||
if plaintext.len() < 4 {
|
if plaintext.len() < 4 {
|
||||||
@@ -729,13 +684,6 @@ pub fn connect_to_vc(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if loop_count % 2000 == 0 {
|
|
||||||
eprintln!(
|
|
||||||
"[vc] receiver: received {recv_count} packets total, {} buffered, prebuffering {is_prebuffering}, expected {expected:?}",
|
|
||||||
packets.len()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if is_prebuffering {
|
if is_prebuffering {
|
||||||
if packets.len() >= INITIAL_PACKET_CUSHION {
|
if packets.len() >= INITIAL_PACKET_CUSHION {
|
||||||
expected = packets.keys().next().copied();
|
expected = packets.keys().next().copied();
|
||||||
|
|||||||
Reference in New Issue
Block a user