From 24472ee346b54f9f5cb81f2c97190d7f2e1bcdd2 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sat, 16 Apr 2022 14:13:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Daac=20adts=E5=A4=B4=E5=A4=A7?= =?UTF-8?q?=E4=BA=8E7=E4=B8=AA=E5=AD=97=E8=8A=82=E6=97=B6=E7=9A=84?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=80=A7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Extension/AAC.cpp | 4 ++++ src/Extension/AACRtp.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Extension/AAC.cpp b/src/Extension/AAC.cpp index f06ae715..33f28dce 100644 --- a/src/Extension/AAC.cpp +++ b/src/Extension/AAC.cpp @@ -161,6 +161,7 @@ int dumpAacConfig(const string &config, size_t length, uint8_t *out, size_t out_ if (ret < 0) { WarnL << "生成adts头失败:" << ret << ", aac config:" << hexdump(config.data(), config.size()); } + assert((int)out_size >= ret); return ret; #endif } @@ -280,6 +281,9 @@ bool AACTrack::inputFrame(const Frame::Ptr &frame) { if (frame_len < ADTS_HEADER_LEN) { break; } + if (frame_len == frame->size()) { + return inputFrame_l(frame); + } auto sub_frame = std::make_shared >(frame, (char *) ptr, frame_len, ADTS_HEADER_LEN); ptr += frame_len; if (ptr > end) { diff --git a/src/Extension/AACRtp.cpp b/src/Extension/AACRtp.cpp index c9293fc1..f6677833 100644 --- a/src/Extension/AACRtp.cpp +++ b/src/Extension/AACRtp.cpp @@ -138,7 +138,7 @@ void AACRtpDecoder::flushData() { _frame->_prefix_size = ADTS_HEADER_LEN; } else { //没有adts头则插入adts头 - char adts_header[32] = {0}; + char adts_header[128] = {0}; auto size = dumpAacConfig(_aac_cfg, _frame->_buffer.size(), (uint8_t *) adts_header, sizeof(adts_header)); if (size > 0) { //插入adts头