Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fixed error parsing for functions that return size.
  • Loading branch information
JelliiDev committed Dec 13, 2025
commit adf52c51a338f26b309918ba14b5d3d4d7b055a6
9 changes: 5 additions & 4 deletions ndk/src/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,14 +479,15 @@ impl AudioError {
ptr.to_string_lossy()
}

/// Returns [`Ok`] on [`ffi::AAUDIO_OK`], [`Err`] otherwise (including positive values).
/// Returns [`Ok`] on [`ffi::AAUDIO_OK`] or any positive value, for example, size, [`Err`] otherwise.
///
/// Note that some known error codes (currently only for `AMediaCodec`) are positive.
pub(crate) fn from_result(status: ffi::aaudio_result_t) -> Result<()> {
match status {
ffi::AAUDIO_OK => Ok(()),
x => Err(Self::from(x)),
if status >= ffi::AAUDIO_OK {
return Ok(())
}

Err(Self::from(status))
}
}

Expand Down