Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Unified Diff: webrtc/test/fuzzers/audio_decoder_opus_fuzzer.cc

Issue 1499093002: Create fuzzer tests for audio decoders (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add a public_configs element to webrtc_fuzzer_main Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/test/fuzzers/audio_decoder_opus_fuzzer.cc
diff --git a/webrtc/test/fuzzers/vp8_qp_parser_fuzzer.cc b/webrtc/test/fuzzers/audio_decoder_opus_fuzzer.cc
similarity index 52%
copy from webrtc/test/fuzzers/vp8_qp_parser_fuzzer.cc
copy to webrtc/test/fuzzers/audio_decoder_opus_fuzzer.cc
index 5135f1a471ebc088e307441d2f45355d0dee6c9b..3d70ec507dfe5606120f6eb88d400e727d369ac9 100644
--- a/webrtc/test/fuzzers/vp8_qp_parser_fuzzer.cc
+++ b/webrtc/test/fuzzers/audio_decoder_opus_fuzzer.cc
@@ -7,11 +7,17 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "webrtc/modules/video_coding/utility/vp8_header_parser.h"
+
+#include "webrtc/modules/audio_coding/codecs/opus/audio_decoder_opus.h"
+#include "webrtc/test/fuzzers/audio_decoder_fuzzer.h"
namespace webrtc {
void FuzzOneInput(const uint8_t* data, size_t size) {
- int qp;
- vp8::GetQp(data, size, &qp);
+ const size_t channels = (size % 2) + 1; // 1 or 2 channels.
+ AudioDecoderOpus dec(channels);
+ const int kSampleRateHz = 48000;
+ const size_t kAllocatedOuputSizeSamples = kSampleRateHz / 10; // 100 ms.
+ int16_t output[kAllocatedOuputSizeSamples];
+ FuzzAudioDecoder(data, size, &dec, kSampleRateHz, sizeof(output), output);
}
} // namespace webrtc
« webrtc/test/fuzzers/BUILD.gn ('K') | « webrtc/test/fuzzers/audio_decoder_isacfix_fuzzer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698