Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decoder: Avoid unreachable code #301

Merged
merged 1 commit into from
Sep 27, 2024
Merged
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
23 changes: 11 additions & 12 deletions src/decoder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,31 +79,30 @@ impl CodecChoice {
match self {
CodecChoice::Auto => {
// Preferred order of codecs in Auto mode: Android MediaCodec, Dav1d, Libgav1.
return CodecChoice::MediaCodec
CodecChoice::MediaCodec
.get_codec()
.or_else(|_| CodecChoice::Dav1d.get_codec())
.or_else(|_| CodecChoice::Libgav1.get_codec());
.or_else(|_| CodecChoice::Libgav1.get_codec())
}
CodecChoice::Dav1d => {
#[cfg(feature = "dav1d")]
{
return Ok(Box::<Dav1d>::default());
}
return Ok(Box::<Dav1d>::default());
#[cfg(not(feature = "dav1d"))]
return Err(AvifError::NoCodecAvailable);
}
CodecChoice::Libgav1 => {
#[cfg(feature = "libgav1")]
{
return Ok(Box::<Libgav1>::default());
}
return Ok(Box::<Libgav1>::default());
#[cfg(not(feature = "libgav1"))]
return Err(AvifError::NoCodecAvailable);
}
CodecChoice::MediaCodec => {
#[cfg(feature = "android_mediacodec")]
{
return Ok(Box::<MediaCodec>::default());
}
return Ok(Box::<MediaCodec>::default());
#[cfg(not(feature = "android_mediacodec"))]
return Err(AvifError::NoCodecAvailable);
}
}
Err(AvifError::NoCodecAvailable)
}
}

Expand Down
Loading