Merge branch 'd-e-s-o-topic/full'

This commit is contained in:
Niko 2025-12-06 11:36:18 -08:00
commit 484d33da3f
No known key found for this signature in database

View file

@ -280,7 +280,7 @@ impl WhisperState {
/// See utilities in the root of this crate for functions to convert audio to this format. /// See utilities in the root of this crate for functions to convert audio to this format.
/// ///
/// # Returns /// # Returns
/// Ok(c_int) on success, Err(WhisperError) on failure. /// Ok(()) on success, Err(WhisperError) on failure.
/// ///
/// # C++ equivalent /// # C++ equivalent
/// `int whisper_full_with_state( /// `int whisper_full_with_state(
@ -289,7 +289,7 @@ impl WhisperState {
/// struct whisper_full_params params, /// struct whisper_full_params params,
/// const float * samples, /// const float * samples,
/// int n_samples)` /// int n_samples)`
pub fn full(&mut self, params: FullParams, data: &[f32]) -> Result<c_int, WhisperError> { pub fn full(&mut self, params: FullParams, data: &[f32]) -> Result<(), WhisperError> {
if data.is_empty() { if data.is_empty() {
// can randomly trigger segmentation faults if we don't check this // can randomly trigger segmentation faults if we don't check this
return Err(WhisperError::NoSamples); return Err(WhisperError::NoSamples);
@ -311,7 +311,7 @@ impl WhisperState {
} else if ret == 8 { } else if ret == 8 {
Err(WhisperError::FailedToDecode) Err(WhisperError::FailedToDecode)
} else if ret == 0 { } else if ret == 0 {
Ok(ret) Ok(())
} else { } else {
Err(WhisperError::GenericError(ret)) Err(WhisperError::GenericError(ret))
} }