mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-16 04:55:58 +08:00
完善Rtmp复用器,可以灵活设置sps pps等信息
This commit is contained in:
@@ -75,12 +75,23 @@ void AACRtmpDecoder::onGetAAC(const char* pcData, int iLen, uint32_t ui32TimeSta
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
AACRtmpEncoder::AACRtmpEncoder(const Track::Ptr &track) {
|
||||
_track = dynamic_pointer_cast<AACTrack>(track);
|
||||
}
|
||||
|
||||
void AACRtmpEncoder::inputFrame(const Frame::Ptr &frame) {
|
||||
RtmpCodec::inputFrame(frame);
|
||||
if(frame->prefixSize() >= 7 && _aac_cfg.empty()){
|
||||
//包含adts头
|
||||
_aac_cfg = makeAdtsConfig(reinterpret_cast<const uint8_t *>(frame->data()));
|
||||
makeAudioConfigPkt();
|
||||
|
||||
if(_aac_cfg.empty()){
|
||||
if(frame->prefixSize() >= 7){
|
||||
//包含adts头,从adts头获取aac配置信息
|
||||
_aac_cfg = makeAdtsConfig(reinterpret_cast<const uint8_t *>(frame->data()));
|
||||
makeAudioConfigPkt();
|
||||
} else if(_track && _track->ready()){
|
||||
//从track中和获取aac配置信息
|
||||
_aac_cfg = _track->getAacCfg();
|
||||
makeAudioConfigPkt();
|
||||
}
|
||||
}
|
||||
|
||||
if(!_aac_cfg.empty()){
|
||||
@@ -149,6 +160,4 @@ void AACRtmpEncoder::makeAudioConfigPkt() {
|
||||
inputRtmp(rtmpPkt, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}//namespace mediakit
|
||||
Reference in New Issue
Block a user