修复时间戳回退导致超大mp4切片问题 (#3991)
Some checks are pending
Android / build (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
Docker / build (push) Waiting to run
Linux / build (push) Waiting to run
macOS / build (push) Waiting to run
Windows / build (push) Waiting to run

当出现dts回退时,应该取frame->dts(), 即MIN, 非MAX
This commit is contained in:
wuxingzhong 2024-10-31 20:11:34 +08:00 committed by GitHub
parent cc590254a6
commit 6729257eab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -126,7 +126,7 @@ bool MP4Recorder::inputFrame(const Frame::Ptr &frame) {
if (_last_dts == 0 || _last_dts > frame->dts()) {
// b帧情况下dts时间戳可能回退 [AUTO-TRANSLATED:1de38f77]
// In the case of b-frames, the dts timestamp may regress
_last_dts = MAX(frame->dts(), _last_dts);
_last_dts = MIN(frame->dts(), _last_dts);
}
auto duration = 5u; // 默认至少一帧5ms
if (frame->dts() > 0 && frame->dts() > _last_dts) {