mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine framework to calc the kbps
This commit is contained in:
parent
3f33dffdb3
commit
9006194cd7
21 changed files with 153 additions and 131 deletions
|
|
@ -31,7 +31,6 @@ SrsSocket::SrsSocket(st_netfd_t client_stfd)
|
|||
stfd = client_stfd;
|
||||
send_timeout = recv_timeout = ST_UTIME_NO_TIMEOUT;
|
||||
recv_bytes = send_bytes = 0;
|
||||
start_time_ms = srs_get_system_time_ms();
|
||||
}
|
||||
|
||||
SrsSocket::~SrsSocket()
|
||||
|
|
@ -73,28 +72,6 @@ int64_t SrsSocket::get_send_bytes()
|
|||
return send_bytes;
|
||||
}
|
||||
|
||||
int SrsSocket::get_recv_kbps()
|
||||
{
|
||||
int64_t diff_ms = srs_get_system_time_ms() - start_time_ms;
|
||||
|
||||
if (diff_ms <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return recv_bytes * 8 / diff_ms;
|
||||
}
|
||||
|
||||
int SrsSocket::get_send_kbps()
|
||||
{
|
||||
int64_t diff_ms = srs_get_system_time_ms() - start_time_ms;
|
||||
|
||||
if (diff_ms <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return send_bytes * 8 / diff_ms;
|
||||
}
|
||||
|
||||
int SrsSocket::read(const void* buf, size_t size, ssize_t* nread)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue