mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +08:00
完善代码
This commit is contained in:
parent
aedb1a8866
commit
29fcf3eb3b
@ -48,18 +48,14 @@ void MP4Muxer::inputFrame(const Frame::Ptr &frame) {
|
||||
}
|
||||
|
||||
if (!_started) {
|
||||
//还没开始
|
||||
if (!_have_video) {
|
||||
_started = true;
|
||||
} else {
|
||||
if (frame->getTrackType() != TrackVideo || !frame->keyFrame()) {
|
||||
//如果首帧是音频或者是视频但是不是i帧,那么不能开始写文件
|
||||
//该逻辑确保含有视频时,第一帧为关键帧
|
||||
if (_have_video && !frame->keyFrame()) {
|
||||
//含有视频,但是不是关键帧,那么前面的帧丢弃
|
||||
return;
|
||||
}
|
||||
//开始写文件
|
||||
_started = true;
|
||||
}
|
||||
}
|
||||
|
||||
//mp4文件时间戳需要从0开始
|
||||
auto &track_info = it->second;
|
||||
|
Loading…
Reference in New Issue
Block a user