mp4切片逻辑提高对音视频交织性差的流的兼容性能

This commit is contained in:
xiongziliang 2022-03-20 14:52:15 +08:00
parent 19c7d1c406
commit a16b6cbc59

View File

@ -96,6 +96,8 @@ void MP4Recorder::closeFile() {
}
bool MP4Recorder::inputFrame(const Frame::Ptr &frame) {
if (!(_have_video && frame->getTrackType() == TrackAudio)) {
//如果有视频且输入的是音频,那么应该忽略切片逻辑
if (_last_dts == 0 || _last_dts > frame->dts()) {
//极少情况下dts时间戳可能回退
_last_dts = frame->dts();
@ -110,6 +112,7 @@ bool MP4Recorder::inputFrame(const Frame::Ptr &frame) {
_last_dts = 0;
createFile();
}
}
if (_muxer) {
//生成mp4文件