Skip to content

Commit

Permalink
mediacodec: Do not prefer hardware if profile != 0
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 682026600
  • Loading branch information
vigneshvg authored and copybara-github committed Oct 3, 2024
1 parent b221bc8 commit c92ac86
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/codecs/android_mediacodec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ fn prefer_hw(config: &DecoderConfig) -> bool {
// 2) category is not Alpha. We do not prefer hardware for decoding the alpha plane since
// they generally tend to be monochrome images and using hardware for that is
// unreliable.
prefer_hw && config.category != Category::Alpha
// 3) profile is 0. As of Sep 2024, there are no AV1 hardware decoders that support
// anything other than profile 0.
prefer_hw && config.category != Category::Alpha && config.codec_config.profile() == 0;
}

fn get_codec_initializers(config: &DecoderConfig) -> Vec<CodecInitializer> {
Expand Down
6 changes: 6 additions & 0 deletions src/parser/mp4box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ impl CodecConfiguration {
Self::Av1(config) => &config.raw_data,
}
}

pub fn profile(&self) -> u8 {
match self {
Self::Av1(config) => config.seq_profile,
}
}
}

#[derive(Clone, Debug, Default)]
Expand Down

0 comments on commit c92ac86

Please sign in to comment.