fix: encode to a new vec instead of an empty one when rendering, log more stuff for debugging

This commit is contained in:
2026-05-28 11:30:48 -04:00
parent c351358947
commit 7b5be35112
2 changed files with 7 additions and 5 deletions

View File

@@ -304,7 +304,6 @@ pub async fn handle(state: State, interaction: Interaction) {
.between_in_vc(start, end, guild_id, voice_channel_id); .between_in_vc(start, end, guild_id, voice_channel_id);
while let Some(recording) = recordings.try_next().await.expect("TODO") { while let Some(recording) = recordings.try_next().await.expect("TODO") {
tracing::debug!(?recording);
let recording_data = state let recording_data = state
.recording_manager .recording_manager
.read(&recording) .read(&recording)

View File

@@ -66,13 +66,16 @@ impl RenderManager {
(), (),
Infallible, // TODO: a real error type Infallible, // TODO: a real error type
> { > {
let mut bytes = Vec::new();
let mut encoder = let mut encoder =
opus2::Encoder::new(sample_rate, channels, Application::Audio).expect("TODO"); opus2::Encoder::new(sample_rate, channels, Application::Audio).expect("TODO");
let encode_result = encoder.encode(&samples, &mut bytes); const MAX_SIZE: usize = usize::MAX / 4;
tracing::info!(?encode_result); let encode_result = encoder.encode_vec(&samples, MAX_SIZE);
if let Err(error) = &encode_result {
tracing::error!(?error);
} else {
tracing::info!("encode ok");
}
encode_result.expect("TODO"); encode_result.expect("TODO");
let path = render.to_string(); let path = render.to_string();