/src/libldac_encode_fuzzer.cc
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright 2019 The Chromium Authors. All rights reserved. |
2 | | // Use of this source code is governed by a BSD-style license that can be |
3 | | // found in the LICENSE file. |
4 | | |
5 | | #include <stdint.h> |
6 | | #include <stddef.h> |
7 | | #include "ldacBT.h" |
8 | | |
9 | | #define TESTFUNC_TYPE extern "C" int |
10 | | |
11 | | TESTFUNC_TYPE |
12 | | LLVMFuzzerTestOneInput(const uint8_t *buf, size_t size) |
13 | 22 | { |
14 | 22 | if (size == 0) { |
15 | 0 | return 0; |
16 | 0 | } |
17 | 22 | HANDLE_LDAC_BT hLdacBt; |
18 | 22 | int pcm_used, stream_sz, frame_num; |
19 | 22 | unsigned char p_stream[1024]; |
20 | | |
21 | 22 | hLdacBt = ldacBT_get_handle(); |
22 | | |
23 | 22 | ldacBT_init_handle_encode( |
24 | 22 | hLdacBt, |
25 | 22 | 679, |
26 | 22 | LDACBT_EQMID_SQ, |
27 | 22 | LDACBT_CHANNEL_MODE_DUAL_CHANNEL, |
28 | 22 | LDACBT_SMPL_FMT_S16, |
29 | 22 | 48000); |
30 | | |
31 | 22 | ldacBT_encode( |
32 | 22 | hLdacBt, |
33 | 22 | (void *)(&buf + 44), |
34 | 22 | &pcm_used, |
35 | 22 | p_stream, |
36 | 22 | &stream_sz, |
37 | 22 | &frame_num); |
38 | | |
39 | 22 | ldacBT_get_sampling_freq(hLdacBt); |
40 | 22 | ldacBT_get_bitrate(hLdacBt); |
41 | 22 | ldacBT_get_version(); |
42 | | |
43 | 22 | ldacBT_close_handle(hLdacBt); |
44 | 22 | ldacBT_free_handle(hLdacBt); |
45 | | |
46 | 22 | return 0; |
47 | 22 | } |