新增支持hls-fmp4直播(#2603 #977 #1965)

同时主要优化点包括:
1、编译宏特性开关优化。
2、转协议复用器相关创建代码移动至Recorder类。
3、转协议复用器onAllTrackReady函数修改为addTrackCompleted。
4、startRecord/stopRecord/isRecording接口新增支持ts/fmp4/hls-fmp4协议。

Co-authored-by: xia-chu <771730766@qq.com>
Co-authored-by: linxiaoyan87 <linxiaoyan87@foxmail.com>
This commit is contained in:
XiaoYan Lin
2023-07-02 12:02:33 +08:00
committed by GitHub
parent 6aa4b741a3
commit cb0579a16d
27 changed files with 413 additions and 224 deletions

View File

@@ -8,7 +8,7 @@
* may be found in the AUTHORS file in the root of the source tree.
*/
#ifdef ENABLE_MP4
#if defined(ENABLE_MP4) || defined(ENABLE_HLS_FMP4)
#include "MP4Muxer.h"
#include "Extension/AAC.h"
@@ -377,24 +377,24 @@ bool MP4MuxerMemory::inputFrame(const Frame::Ptr &frame) {
return false;
}
bool key_frame = frame->keyFrame();
//flush切片
// flush切片
saveSegment();
auto data = _memory_file->getAndClearMemory();
if (!data.empty()) {
//输出切片数据
onSegmentData(std::move(data), frame->dts(), _key_frame);
// 输出切片数据
onSegmentData(std::move(data), _last_dst, _key_frame);
_key_frame = false;
}
if (key_frame) {
if (frame->keyFrame()) {
_key_frame = true;
}
if (frame->getTrackType() == TrackVideo || !haveVideo()) {
_last_dst = frame->dts();
}
return MP4MuxerInterface::inputFrame(frame);
}
}//namespace mediakit
#endif//#ifdef ENABLE_MP4
#endif //defined(ENABLE_MP4) || defined(ENABLE_HLS_FMP4)