From bf92172e62b02b2c8a0c18bbd5e2e350547f5c76 Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 18 Dec 2019 20:37:49 +0800 Subject: [PATCH] Improve coverage for RAW AVC protocol. --- trunk/src/utest/srs_utest_avc.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/trunk/src/utest/srs_utest_avc.cpp b/trunk/src/utest/srs_utest_avc.cpp index b9c1d1851..26f39e8be 100644 --- a/trunk/src/utest/srs_utest_avc.cpp +++ b/trunk/src/utest/srs_utest_avc.cpp @@ -256,6 +256,20 @@ VOID TEST(SrsAVCTest, AACDemuxADTS) { srs_error_t err; + // Fail if not adts format. + if (true) { + SrsRawAacStream h; char* frame = NULL; int nb_frame = 0; SrsRawAacStreamCodec codec; + uint8_t b[] = {0xff, 0x09, 0x2c,0x40, 0,0xe0,0}; SrsBuffer buf((char*)b, sizeof(b)); + HELPER_EXPECT_FAILED(h.adts_demux(&buf, &frame, &nb_frame, codec)); + } + + // Fail if less than 7 bytes. + if (true) { + SrsRawAacStream h; char* frame = NULL; int nb_frame = 0; SrsRawAacStreamCodec codec; + uint8_t b[] = {0xff, 0xf9}; SrsBuffer buf((char*)b, sizeof(b)); + HELPER_EXPECT_FAILED(h.adts_demux(&buf, &frame, &nb_frame, codec)); + } + // For lower sampling rate, such as 5512HZ. if (true) { SrsRawAacStream h; char* frame = NULL; int nb_frame = 0; SrsRawAacStreamCodec codec;