修复mp4录制使用相对时间戳导致不同步的bug

This commit is contained in:
xia-chu 2023-11-25 11:27:29 +08:00
parent 46c6ff038c
commit f6a97af55c
1 changed files with 9 additions and 5 deletions

View File

@ -169,11 +169,15 @@ void MP4MuxerInterface::stampSync() {
} }
Stamp *audio = nullptr, *video = nullptr; Stamp *audio = nullptr, *video = nullptr;
for(auto &pr : _codec_to_trackid){ for (auto &pr : _codec_to_trackid) {
switch (getTrackType((CodecId) pr.first)){ auto &stamp = pr.second.stamp;
case TrackAudio : audio = &pr.second.stamp; break; // mp4录制时间戳不允许回退最大跳跃幅度500ms
case TrackVideo : video = &pr.second.stamp; break; stamp.enableRollback(false);
default : break; stamp.setMaxDelta(500);
switch (getTrackType((CodecId)pr.first)) {
case TrackAudio: audio = &stamp; break;
case TrackVideo: video = &stamp; break;
default: break;
} }
} }