hls/mp4录像/mp4点播/ts解析/ps解析初步支持G711

This commit is contained in:
xiongziliang
2020-04-23 15:19:20 +08:00
parent eb67bc8348
commit 2e3cee09bb
6 changed files with 91 additions and 7 deletions

View File

@@ -14,6 +14,7 @@
#include "Util/File.h"
#include "Extension/H265.h"
#include "Extension/AAC.h"
#include "Extension/G711.h"
namespace mediakit{
@@ -271,6 +272,27 @@ void RtpProcess::onDecode(int stream,int codecid,int flags,int64_t pts,int64_t d
_muxer->inputFrame(std::make_shared<AACFrameNoCacheAble>((char *) data, bytes, dts, 0, 7));
break;
}
case STREAM_AUDIO_G711: {
_dts = dts;
//todo 等待陈大佬更新ts/ps解析库,现在暂时固定为G711A
auto codec = CodecG711A;
if (!_codecid_audio) {
//获取到音频
_codecid_audio = codecid;
InfoL << "got audio track: G711";
//G711传统只支持 8000/1/16的规格FFmpeg貌似做了扩展但是这里不管它了
auto track = std::make_shared<G711Track>(codec, 8000, 1, 16);
_muxer->addTrack(track);
}
if (codecid != _codecid_audio) {
WarnL << "audio track change to G711 from codecid:" << getCodecName(_codecid_audio);
return;
}
_muxer->inputFrame(std::make_shared<G711FrameNoCacheAble>(codec, (char *) data, bytes, dts));
break;
}
default:
if(codecid != 0){
WarnL << "unsupported codec type:" << getCodecName(codecid);