mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +08:00
修复aac adts头大于7个字节时的兼容性问题
This commit is contained in:
parent
5144b84ee7
commit
24472ee346
@ -161,6 +161,7 @@ int dumpAacConfig(const string &config, size_t length, uint8_t *out, size_t out_
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
WarnL << "生成adts头失败:" << ret << ", aac config:" << hexdump(config.data(), config.size());
|
WarnL << "生成adts头失败:" << ret << ", aac config:" << hexdump(config.data(), config.size());
|
||||||
}
|
}
|
||||||
|
assert((int)out_size >= ret);
|
||||||
return ret;
|
return ret;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -280,6 +281,9 @@ bool AACTrack::inputFrame(const Frame::Ptr &frame) {
|
|||||||
if (frame_len < ADTS_HEADER_LEN) {
|
if (frame_len < ADTS_HEADER_LEN) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (frame_len == frame->size()) {
|
||||||
|
return inputFrame_l(frame);
|
||||||
|
}
|
||||||
auto sub_frame = std::make_shared<FrameInternal<FrameFromPtr> >(frame, (char *) ptr, frame_len, ADTS_HEADER_LEN);
|
auto sub_frame = std::make_shared<FrameInternal<FrameFromPtr> >(frame, (char *) ptr, frame_len, ADTS_HEADER_LEN);
|
||||||
ptr += frame_len;
|
ptr += frame_len;
|
||||||
if (ptr > end) {
|
if (ptr > end) {
|
||||||
|
@ -138,7 +138,7 @@ void AACRtpDecoder::flushData() {
|
|||||||
_frame->_prefix_size = ADTS_HEADER_LEN;
|
_frame->_prefix_size = ADTS_HEADER_LEN;
|
||||||
} else {
|
} else {
|
||||||
//没有adts头则插入adts头
|
//没有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));
|
auto size = dumpAacConfig(_aac_cfg, _frame->_buffer.size(), (uint8_t *) adts_header, sizeof(adts_header));
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
//插入adts头
|
//插入adts头
|
||||||
|
Loading…
Reference in New Issue
Block a user