mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Fix memory leak. Refine RTC SEND pithy print message
This commit is contained in:
parent
5e66a0d342
commit
edad6ac93d
2 changed files with 14 additions and 1 deletions
|
@ -442,6 +442,7 @@ srs_error_t SrsUdpMuxListener::cycle()
|
||||||
if ((err = handler->on_udp_packet(&skt)) != srs_success) {
|
if ((err = handler->on_udp_packet(&skt)) != srs_success) {
|
||||||
// remux udp never return
|
// remux udp never return
|
||||||
srs_warn("udp packet handler error:%s", srs_error_desc(err).c_str());
|
srs_warn("udp packet handler error:%s", srs_error_desc(err).c_str());
|
||||||
|
srs_error_reset(err);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1660,6 +1660,8 @@ srs_error_t SrsRtcServer::cycle()
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
uint64_t nn_msgs = 0;
|
uint64_t nn_msgs = 0;
|
||||||
|
uint64_t nn_msgs_last = 0;
|
||||||
|
srs_utime_t time_last = srs_get_system_time();
|
||||||
SrsStatistic* stat = SrsStatistic::instance();
|
SrsStatistic* stat = SrsStatistic::instance();
|
||||||
|
|
||||||
SrsPithyPrint* pprint = SrsPithyPrint::create_rtc_send();
|
SrsPithyPrint* pprint = SrsPithyPrint::create_rtc_send();
|
||||||
|
@ -1699,7 +1701,17 @@ srs_error_t SrsRtcServer::cycle()
|
||||||
|
|
||||||
pprint->elapse();
|
pprint->elapse();
|
||||||
if (pprint->can_print()) {
|
if (pprint->can_print()) {
|
||||||
srs_trace("-> RTC SEND %d by sendmmsg %d, total %" PRId64 " msgs", pos, max_sendmmsg, nn_msgs);
|
int pps_average = 0; int pps_last = 0;
|
||||||
|
if (true) {
|
||||||
|
if (srs_get_system_time() > srs_get_system_startup_time()) {
|
||||||
|
pps_average = (int)(nn_msgs * SRS_UTIME_SECONDS / (srs_get_system_time() - srs_get_system_startup_time()));
|
||||||
|
}
|
||||||
|
if (srs_get_system_time() > time_last) {
|
||||||
|
pps_last = (int)((nn_msgs - nn_msgs_last) * SRS_UTIME_SECONDS / (srs_get_system_time() - time_last));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
srs_trace("-> RTC SEND %d by sendmmsg %d, total %" PRId64 ", pps %d/%d", pos, max_sendmmsg, nn_msgs, pps_average, pps_last);
|
||||||
|
nn_msgs_last = nn_msgs; time_last = srs_get_system_time();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue