mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-29 22:55:52 +08:00
优化dts生成性能
This commit is contained in:
parent
ec67900665
commit
d8dbf43490
@ -128,18 +128,19 @@ bool DtsGenerator::getDts_l(uint32_t pts, uint32_t &dts){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(pts > _last_max_pts){
|
||||
if(!_sorter_max_size && _frames_since_last_max_pts && _count_sorter_max_size++ > 0){
|
||||
_sorter_max_size = _frames_since_last_max_pts;
|
||||
_dts_pts_offset = (pts - _last_max_pts) / 2;
|
||||
if(!_sorter_max_size){
|
||||
if(pts > _last_max_pts){
|
||||
if(_frames_since_last_max_pts && _count_sorter_max_size++ > 0){
|
||||
_sorter_max_size = _frames_since_last_max_pts;
|
||||
_dts_pts_offset = (pts - _last_max_pts) / 2;
|
||||
}
|
||||
_frames_since_last_max_pts = 0;
|
||||
_last_max_pts = pts;
|
||||
}
|
||||
_frames_since_last_max_pts = 0;
|
||||
_last_max_pts = pts;
|
||||
++_frames_since_last_max_pts;
|
||||
}
|
||||
|
||||
_pts_sorter.emplace(pts);
|
||||
++_frames_since_last_max_pts;
|
||||
|
||||
if(_sorter_max_size && _pts_sorter.size() > _sorter_max_size){
|
||||
auto it = _pts_sorter.begin();
|
||||
dts = *it + _dts_pts_offset;
|
||||
|
Loading…
Reference in New Issue
Block a user