forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits

decode_blocks.rs28 lines, 846 bytesHistoryRawDownload
1#![no_main]
2
3use ec_core::frame::ChannelLayout;
4use ec_core::registry::{AudioParameters, CodecId, CodecParameters, MediaParameters};
5use libfuzzer_sys::fuzz_target;
6
7fuzz_target!(|data: &[u8]| {
8 let Some((&sel, rest)) = data.split_first() else {
9 return;
10 };
11 let codec = [
12 CodecId::ImaAdpcmWav,
13 CodecId::MsAdpcm,
14 CodecId::ImaAdpcmQt,
15 CodecId::PcmAlaw,
16 CodecId::PcmMulaw,
17 ][usize::from(sel) % 5];
18 let channels = 1 + usize::from(sel >> 3) % 2;
19 let mut p = CodecParameters::new(codec);
20 p.media = MediaParameters::Audio(AudioParameters {
21 sample_rate: 8000,
22 layout: ChannelLayout::from_count(channels),
23 ..AudioParameters::default()
24 });
25 if let Ok(mut d) = ec_pcm_ext::PcmExtDecoder::from_parameters(p) {
26 let _ = d.decode(rest);
27 }
28});