再优化dts获取

This commit is contained in:
xiongziliang 2020-04-29 18:19:51 +08:00
parent 9d9f6e304e
commit 1067c5a2d3

View File

@ -91,7 +91,6 @@ int64_t Stamp::getRelativeStamp() const {
return _relativeStamp;
}
bool DtsGenerator::getDts(uint32_t pts, uint32_t &dts){
bool ret = false;
if (pts == _last_pts) {
@ -100,18 +99,21 @@ bool DtsGenerator::getDts(uint32_t pts, uint32_t &dts){
dts = _last_dts;
ret = true;
}
return ret;
}
} else {
//pts变了尝试计算dts
ret = getDts_l(pts, dts);
if (ret) {
//获取到了dts保存本次结果
_last_dts = dts;
}else{
}
}
if (!ret) {
//pts排序列队长度还不知道也就是不知道有没有B帧
//那么先强制dts == pts这样可能导致有B帧的情况下起始画面有几帧回退
dts = pts;
}
//记录上次pts
_last_pts = pts;
return ret;