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
|
@ -43,6 +43,7 @@ using namespace std;
|
|||
#include <srs_app_socket.hpp>
|
||||
#include <srs_app_http_hooks.hpp>
|
||||
#include <srs_app_edge.hpp>
|
||||
#include <srs_app_kbps.hpp>
|
||||
|
||||
// when stream is busy, for example, streaming is already
|
||||
// publishing, when a new client to request to publish,
|
||||
|
@ -71,6 +72,8 @@ SrsRtmpConn::SrsRtmpConn(SrsServer* srs_server, st_netfd_t client_stfd)
|
|||
refer = new SrsRefer();
|
||||
bandwidth = new SrsBandwidth();
|
||||
duration = 0;
|
||||
kbps = new SrsKbps();
|
||||
kbps->set_io(skt, skt);
|
||||
|
||||
_srs_config->subscribe(this);
|
||||
}
|
||||
|
@ -87,6 +90,7 @@ SrsRtmpConn::~SrsRtmpConn()
|
|||
srs_freep(skt);
|
||||
srs_freep(refer);
|
||||
srs_freep(bandwidth);
|
||||
srs_freep(kbps);
|
||||
}
|
||||
|
||||
// TODO: return detail message when error for client.
|
||||
|
@ -501,9 +505,8 @@ int SrsRtmpConn::playing(SrsSource* source)
|
|||
// reportable
|
||||
if (pithy_print.can_print()) {
|
||||
srs_trace("-> "SRS_LOG_ID_PLAY
|
||||
" time=%"PRId64", duration=%"PRId64", msgs=%d, obytes=%"PRId64", ibytes=%"PRId64", okbps=%d, ikbps=%d",
|
||||
pithy_print.age(), duration, count, rtmp->get_send_bytes(), rtmp->get_recv_bytes(),
|
||||
rtmp->get_send_kbps(), rtmp->get_recv_kbps());
|
||||
" time=%"PRId64", duration=%"PRId64", msgs=%d, okbps=%d, ikbps=%d",
|
||||
pithy_print.age(), duration, count, kbps->get_send_kbps(), kbps->get_recv_kbps());
|
||||
}
|
||||
|
||||
if (count <= 0) {
|
||||
|
@ -586,9 +589,8 @@ int SrsRtmpConn::fmle_publish(SrsSource* source)
|
|||
// reportable
|
||||
if (pithy_print.can_print()) {
|
||||
srs_trace("<- "SRS_LOG_ID_CLIENT_PUBLISH
|
||||
" time=%"PRId64", obytes=%"PRId64", ibytes=%"PRId64", okbps=%d, ikbps=%d",
|
||||
pithy_print.age(), rtmp->get_send_bytes(), rtmp->get_recv_bytes(),
|
||||
rtmp->get_send_kbps(), rtmp->get_recv_kbps());
|
||||
" time=%"PRId64", okbps=%d, ikbps=%d",
|
||||
pithy_print.age(), kbps->get_send_kbps(), kbps->get_recv_kbps());
|
||||
}
|
||||
|
||||
// process UnPublish event.
|
||||
|
@ -663,9 +665,8 @@ int SrsRtmpConn::flash_publish(SrsSource* source)
|
|||
// reportable
|
||||
if (pithy_print.can_print()) {
|
||||
srs_trace("<- "SRS_LOG_ID_WEB_PUBLISH
|
||||
" time=%"PRId64", obytes=%"PRId64", ibytes=%"PRId64", okbps=%d, ikbps=%d",
|
||||
pithy_print.age(), rtmp->get_send_bytes(), rtmp->get_recv_bytes(),
|
||||
rtmp->get_send_kbps(), rtmp->get_recv_kbps());
|
||||
" time=%"PRId64", okbps=%d, ikbps=%d",
|
||||
pithy_print.age(), kbps->get_send_kbps(), kbps->get_recv_kbps());
|
||||
}
|
||||
|
||||
// process UnPublish event.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue