Skip to content

Commit

Permalink
RTC: Support high performance timer about 25ms resolution. 4.0.72
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Feb 19, 2021
1 parent ebcba14 commit c5d2027
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ For previous versions, please read:

## V4 changes

* v4.0, 2021-02-12, RTC: Support high performance timer about 25ms resolution. 4.0.72
* v4.0, 2021-02-10, RTC: Refine performance about 700+ streams. 4.0.71
* v4.0, 2021-02-08, RTC: Print stat for pli and timer every 5s. 4.0.70
* v4.0, 2021-02-07, RTC: Parse PT fast and refine udp handler. 4.0.69
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core_version4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
#ifndef SRS_CORE_VERSION4_HPP
#define SRS_CORE_VERSION4_HPP

#define SRS_VERSION4_REVISION 71
#define SRS_VERSION4_REVISION 72

#endif

1 comment on commit c5d2027

@winlinvip
Copy link
Member Author

@winlinvip winlinvip commented on c5d2027 Feb 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For #2194

本质上timer是由于epoll导致不准确,因为任务执行时消耗了时间,需要等到所有任务都执行完成才用epoll_wait(timeout)计算定时器,这就造成了误差,详细过程分析可以看代码拜年:SRS高精度低误差定时器

  • 增加统计信息,看系统调度的间隔,也就是epoll_wait执行的间隔,也就决定了定时器的精度:e91e0ea70fb647
  • 启动一个20ms的固定timer,可以分析它的唤醒间隔,来分析timer的误差:c2332f9
  • 将定时器放到RunQ的队列头,也就是优先执行timer:d856339#diff-fd260f84706aa0cbdeaf83a8082525fc268926bf0340ce972fbf43d4b132196bR552
  • ST增加函数,支持yield,在yield时检查timer是否超时,这相当于给timer增加了运行时间提高精度:b4b9776c0fda42a049ce3
  • 直播Player的主循环,主动yield让度时间片,增加timer精度:d1bcc03
  • 直播Publisher主动yield,提高timer精度:a5a9649
  • RTC Publisher主动yield,提高timer精度:df1eca1
  • RTC Player主动yield,提高timer精度:ebcba14

Please sign in to comment.