Merge pull request #99
This commit is contained in:
parent
39a528cc02
commit
c6270aa1f9
|
|
@ -44,8 +44,8 @@ void HlsMaker::makeIndexFile(bool eof) {
|
||||||
int maxSegmentDuration = 0;
|
int maxSegmentDuration = 0;
|
||||||
|
|
||||||
//停止写之后将最后的片段也写进m3u8文件中
|
//停止写之后将最后的片段也写进m3u8文件中
|
||||||
if (eof && stampInc > 0) {
|
if (eof && _stampInc > 0) {
|
||||||
_seg_dur_list.push_back(std::make_tuple(stampInc, _last_file_name));
|
_seg_dur_list.push_back(std::make_tuple(_stampInc, _last_file_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &tp : _seg_dur_list) {
|
for (auto &tp : _seg_dur_list) {
|
||||||
|
|
@ -102,12 +102,12 @@ void HlsMaker::delOldFile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HlsMaker::addNewFile(uint32_t) {
|
void HlsMaker::addNewFile(uint32_t) {
|
||||||
stampInc = _ticker.elapsedTime();
|
_stampInc = _ticker.elapsedTime();
|
||||||
if (stampInc >= _seg_duration * 1000) {
|
if (_stampInc >= _seg_duration * 1000) {
|
||||||
_ticker.resetTime();
|
_ticker.resetTime();
|
||||||
auto file_name = onOpenFile(_file_index);
|
auto file_name = onOpenFile(_file_index);
|
||||||
if (_file_index++ > 0) {
|
if (_file_index++ > 0) {
|
||||||
_seg_dur_list.push_back(std::make_tuple(stampInc, _last_file_name));
|
_seg_dur_list.push_back(std::make_tuple(_stampInc, _last_file_name));
|
||||||
delOldFile();
|
delOldFile();
|
||||||
makeIndexFile();
|
makeIndexFile();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ protected:
|
||||||
protected:
|
protected:
|
||||||
uint32_t _seg_number = 0;
|
uint32_t _seg_number = 0;
|
||||||
private:
|
private:
|
||||||
int stampInc = 0;
|
int _stampInc = 0;
|
||||||
float _seg_duration = 0;
|
float _seg_duration = 0;
|
||||||
uint64_t _file_index = 0;
|
uint64_t _file_index = 0;
|
||||||
Ticker _ticker;
|
Ticker _ticker;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue