Skip to content

Commit

Permalink
Improve the error message on sampling rate issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentMazare committed Aug 20, 2024
1 parent 23b1e17 commit 9ace9c4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/opus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ fn write_opus_tags<W: std::io::Write>(w: &mut W) -> std::io::Result<()> {
}

fn write_ogg_<W: std::io::Write>(w: &mut W, pcm: &[f32], sample_rate: u32) -> Result<()> {
match sample_rate {
8000 | 12000 | 16000 | 24000 | 48000 => {}
sample_rate => {
anyhow::bail!("unsupported sample rate for opus {sample_rate}, try resample_to=48000")
}
}
let mut pw = ogg::PacketWriter::new(w);

// Write the opus headers and tags
Expand Down

0 comments on commit 9ace9c4

Please sign in to comment.