mirror of
https://github.com/google/liblc3.git
synced 2026-04-22 23:54:49 +00:00
fuzz: Update with LC3-Plus LC3-Plus HR parameters
This commit is contained in:
@@ -23,20 +23,21 @@ using namespace lc3;
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
const int dt_list[] = { 7500, 10000 };
|
||||
const int sr_list[] = { 8000, 16000, 24000, 32000, 48000 };
|
||||
const int dt_list[] = { 2500, 5000, 7500, 10000 };
|
||||
const int sr_list[] = { 8000, 16000, 24000, 32000, 48000, 96000 };
|
||||
|
||||
FuzzedDataProvider fdp(data, size);
|
||||
|
||||
int dt_us = fdp.PickValueInArray(dt_list);
|
||||
int sr_hz = fdp.PickValueInArray(sr_list);
|
||||
int nchannels =fdp.PickValueInArray({1, 2});
|
||||
bool hrmode = fdp.ConsumeBool();
|
||||
|
||||
int sr_pcm_hz = fdp.PickValueInArray(sr_list);
|
||||
if (sr_pcm_hz < sr_hz)
|
||||
sr_pcm_hz = 0;
|
||||
|
||||
Decoder dec(dt_us, sr_hz, sr_pcm_hz, nchannels);
|
||||
Decoder dec(dt_us, sr_hz, sr_pcm_hz, nchannels, hrmode);
|
||||
|
||||
int frame_size = fdp.ConsumeIntegralInRange(
|
||||
LC3_MIN_FRAME_BYTES, LC3_MAX_FRAME_BYTES);
|
||||
@@ -46,6 +47,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
PcmFormat::kS24In3Le, PcmFormat::kF32 });
|
||||
|
||||
int frame_samples = dec.GetFrameSamples();
|
||||
if (frame_samples < 0)
|
||||
return -1;
|
||||
|
||||
int sample_bytes =
|
||||
fmt == PcmFormat::kS16 ? sizeof(int16_t) :
|
||||
|
||||
Reference in New Issue
Block a user