Commit 7df09207 by xiongziliang

修复m3u8起始阶段SEQUENCE错误的bug:#288

parent 487c993b
...@@ -13,8 +13,6 @@ namespace mediakit { ...@@ -13,8 +13,6 @@ namespace mediakit {
HlsMaker::HlsMaker(float seg_duration, uint32_t seg_number) { HlsMaker::HlsMaker(float seg_duration, uint32_t seg_number) {
//最小允许设置为0,0个切片代表点播 //最小允许设置为0,0个切片代表点播
seg_number = MAX(0,seg_number);
seg_duration = MAX(1,seg_duration);
_seg_number = seg_number; _seg_number = seg_number;
_seg_duration = seg_duration; _seg_duration = seg_duration;
} }
...@@ -34,6 +32,8 @@ void HlsMaker::makeIndexFile(bool eof) { ...@@ -34,6 +32,8 @@ void HlsMaker::makeIndexFile(bool eof) {
} }
} }
auto sequence = _seg_number ? (_file_index > _seg_number ? _file_index - _seg_number : 0LL) : 0LL;
string m3u8; string m3u8;
snprintf(file_content,sizeof(file_content), snprintf(file_content,sizeof(file_content),
"#EXTM3U\n" "#EXTM3U\n"
...@@ -42,7 +42,7 @@ void HlsMaker::makeIndexFile(bool eof) { ...@@ -42,7 +42,7 @@ void HlsMaker::makeIndexFile(bool eof) {
"#EXT-X-TARGETDURATION:%u\n" "#EXT-X-TARGETDURATION:%u\n"
"#EXT-X-MEDIA-SEQUENCE:%llu\n", "#EXT-X-MEDIA-SEQUENCE:%llu\n",
(maxSegmentDuration + 999) / 1000, (maxSegmentDuration + 999) / 1000,
_seg_number ? _file_index : 0); sequence);
m3u8.assign(file_content); m3u8.assign(file_content);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论