mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-12-02 00:12:33 +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 (!_started) {
|
||||||
//还没开始
|
//该逻辑确保含有视频时,第一帧为关键帧
|
||||||
if (!_have_video) {
|
if (_have_video && !frame->keyFrame()) {
|
||||||
_started = true;
|
//含有视频,但是不是关键帧,那么前面的帧丢弃
|
||||||
} else {
|
|
||||||
if (frame->getTrackType() != TrackVideo || !frame->keyFrame()) {
|
|
||||||
//如果首帧是音频或者是视频但是不是i帧,那么不能开始写文件
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//开始写文件
|
//开始写文件
|
||||||
_started = true;
|
_started = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//mp4文件时间戳需要从0开始
|
//mp4文件时间戳需要从0开始
|
||||||
auto &track_info = it->second;
|
auto &track_info = it->second;
|
||||||
|
Loading…
Reference in New Issue
Block a user