mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-04 18:09:56 +08:00
添加 ts 切片是否通知选项, 默认为不通知
This commit is contained in:
@@ -252,6 +252,8 @@ const string kSegmentRetain = HLS_FIELD"segRetain";
|
||||
const string kFileBufSize = HLS_FIELD"fileBufSize";
|
||||
//录制文件路径
|
||||
const string kFilePath = HLS_FIELD"filePath";
|
||||
// 是否广播 ts 切片完成通知
|
||||
const string kBroadcastRecordTs = HLS_FIELD"broadcastRecordTs";
|
||||
|
||||
onceToken token([](){
|
||||
mINI::Instance()[kSegmentDuration] = 2;
|
||||
@@ -259,6 +261,7 @@ onceToken token([](){
|
||||
mINI::Instance()[kSegmentRetain] = 5;
|
||||
mINI::Instance()[kFileBufSize] = 64 * 1024;
|
||||
mINI::Instance()[kFilePath] = "./www";
|
||||
mINI::Instance()[kBroadcastRecordTs] = false;
|
||||
},nullptr);
|
||||
} //namespace Hls
|
||||
|
||||
|
||||
@@ -285,6 +285,8 @@ extern const string kSegmentRetain;
|
||||
extern const string kFileBufSize;
|
||||
//录制文件路径
|
||||
extern const string kFilePath;
|
||||
// 是否广播 ts 切片完成通知
|
||||
extern const string kBroadcastRecordTs;
|
||||
} //namespace Hls
|
||||
|
||||
////////////Rtp代理相关配置///////////
|
||||
|
||||
@@ -109,14 +109,18 @@ void HlsMakerImp::onWriteHls(const char *data, int len) {
|
||||
}
|
||||
|
||||
void HlsMakerImp::onFlushLastSegment(uint32_t duration) {
|
||||
auto info = _info;
|
||||
info.ui64TimeLen = duration;
|
||||
WorkThreadPool::Instance().getExecutor()->async([info]() {
|
||||
struct stat fileData;
|
||||
stat(info.strFilePath.data(), &fileData);
|
||||
const_cast<TsInfo&>(info).ui64FileSize = fileData.st_size;
|
||||
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastRecordTs, info);
|
||||
});
|
||||
GET_CONFIG(bool, broadcastRecordTs, Hls::kBroadcastRecordTs);
|
||||
|
||||
if (broadcastRecordTs) {
|
||||
auto info = _info;
|
||||
info.ui64TimeLen = duration;
|
||||
WorkThreadPool::Instance().getExecutor()->async([info]() {
|
||||
struct stat fileData;
|
||||
stat(info.strFilePath.data(), &fileData);
|
||||
const_cast<TsInfo&>(info).ui64FileSize = fileData.st_size;
|
||||
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastRecordTs, info);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user