mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-23 03:10:04 +08:00
修复dts计算可能导致不同步的问题:#369
This commit is contained in:
parent
f67e9fce9a
commit
fd77398291
@ -176,6 +176,8 @@ bool DtsGenerator::getDts_l(uint32_t pts, uint32_t &dts){
|
|||||||
_sorter_max_size = _frames_since_last_max_pts;
|
_sorter_max_size = _frames_since_last_max_pts;
|
||||||
//我们记录P帧间时间间隔(也就是多个B帧时间戳增量累计)
|
//我们记录P帧间时间间隔(也就是多个B帧时间戳增量累计)
|
||||||
_dts_pts_offset = (pts - _last_max_pts);
|
_dts_pts_offset = (pts - _last_max_pts);
|
||||||
|
//除以2,防止dts大于pts
|
||||||
|
_dts_pts_offset /= 2;
|
||||||
}
|
}
|
||||||
//遇到P帧或关键帧,连续B帧计数清零
|
//遇到P帧或关键帧,连续B帧计数清零
|
||||||
_frames_since_last_max_pts = 0;
|
_frames_since_last_max_pts = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user