mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-23 03:10:04 +08:00
兼容不规范的aac rtsp推流
This commit is contained in:
parent
434d6a73a1
commit
b438ecb88c
@ -132,13 +132,19 @@ bool AACRtpDecoder::inputRtp(const RtpPacket::Ptr &rtp, bool key_pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AACRtpDecoder::flushData() {
|
void AACRtpDecoder::flushData() {
|
||||||
//插入adts头
|
auto ptr = reinterpret_cast<const uint8_t *>(_frame->_buffer.data());
|
||||||
char adts_header[32] = {0};
|
if ((ptr[0] == 0xFF && (ptr[1] & 0xF0) == 0xF0)) {
|
||||||
auto size = dumpAacConfig(_aac_cfg, _frame->_buffer.size(), (uint8_t *) adts_header, sizeof(adts_header));
|
//adts头打入了rtp包,不符合规范,兼容EasyPusher的bug
|
||||||
if (size > 0) {
|
_frame->_prefix_size = ADTS_HEADER_LEN;
|
||||||
//插入adts头
|
} else {
|
||||||
_frame->_buffer.insert(0, adts_header, size);
|
//没有adts头则插入adts头
|
||||||
_frame->_prefix_size = size;
|
char adts_header[32] = {0};
|
||||||
|
auto size = dumpAacConfig(_aac_cfg, _frame->_buffer.size(), (uint8_t *) adts_header, sizeof(adts_header));
|
||||||
|
if (size > 0) {
|
||||||
|
//插入adts头
|
||||||
|
_frame->_buffer.insert(0, adts_header, size);
|
||||||
|
_frame->_prefix_size = size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
RtpCodec::inputFrame(_frame);
|
RtpCodec::inputFrame(_frame);
|
||||||
obtainFrame();
|
obtainFrame();
|
||||||
|
Loading…
Reference in New Issue
Block a user