完善Rtmp复用器,可以灵活设置sps pps等信息

This commit is contained in:
xiongziliang
2018-10-25 14:16:40 +08:00
parent 413b18521d
commit 186f4e4683
7 changed files with 64 additions and 22 deletions

View File

@@ -196,18 +196,19 @@ RtpCodec::Ptr Factory::getRtpDecoderById(CodecId codecId, uint32_t ui32SampleRat
}
}
RtmpCodec::Ptr Factory::getRtmpCodecById(CodecId codecId) {
switch (codecId){
RtmpCodec::Ptr Factory::getRtmpCodecByTrack(const Track::Ptr &track) {
switch (track->getCodecId()){
case CodecH264:
return std::make_shared<H264RtmpEncoder>();
return std::make_shared<H264RtmpEncoder>(track);
case CodecAAC:
return std::make_shared<AACRtmpEncoder>();
return std::make_shared<AACRtmpEncoder>(track);
default:
WarnL << "暂不支持该CodecId:" << codecId;
WarnL << "暂不支持该CodecId:" << track->getCodecId();
return nullptr;
}
}
}//namespace mediakit

View File

@@ -106,11 +106,11 @@ public:
static CodecId getCodecIdByAmf(const AMFValue &val);
/**
* 根据CodecId获取Rtmp的编解码器
* @param codecId CodecId
* 根据Track获取Rtmp的编解码器
* @param track 媒体描述对象
* @return
*/
static RtmpCodec::Ptr getRtmpCodecById(CodecId codecId);
static RtmpCodec::Ptr getRtmpCodecByTrack(const Track::Ptr &track);
};