mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
FMP4: http-fmp4直播提升流畅度
This commit is contained in:
parent
f4b6a6bd40
commit
4291c31493
@ -319,14 +319,13 @@ bool MP4MuxerMemory::inputFrame(const Frame::Ptr &frame){
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool key_frame = frame->keyFrame();
|
auto key_frame = frame->keyFrame();
|
||||||
if (_ticker.elapsedTime() > 50 || key_frame) {
|
auto data = _memory_file->getAndClearMemory();
|
||||||
//遇到关键帧或者超过50ms则切片
|
if (!data.empty()) {
|
||||||
_ticker.resetTime();
|
|
||||||
//flush切片
|
//flush切片
|
||||||
saveSegment();
|
saveSegment();
|
||||||
//输出切片数据
|
//输出切片数据
|
||||||
onSegmentData(_memory_file->getAndClearMemory(), frame->dts(), _key_frame);
|
onSegmentData(data, frame->dts(), _key_frame);
|
||||||
_key_frame = false;
|
_key_frame = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,6 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool _key_frame = false;
|
bool _key_frame = false;
|
||||||
Ticker _ticker;
|
|
||||||
string _init_segment;
|
string _init_segment;
|
||||||
MP4FileMemory::Ptr _memory_file;
|
MP4FileMemory::Ptr _memory_file;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user