1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

refine the kbps comments, add one usage.

This commit is contained in:
winlin 2015-05-22 20:31:07 +08:00
parent 6ca46e84bc
commit d645411392
2 changed files with 29 additions and 21 deletions

View file

@ -137,7 +137,7 @@ public:
/** /**
* to statistic the kbps of io. * to statistic the kbps of io.
* itself can be a statistic source, for example, used for SRS bytes stat. * itself can be a statistic source, for example, used for SRS bytes stat.
* there are two usage scenarios: * there are some usage scenarios:
* 1. connections to calc kbps by sample(): * 1. connections to calc kbps by sample():
* SrsKbps* kbps = ...; * SrsKbps* kbps = ...;
* kbps->set_io(in, out) * kbps->set_io(in, out)
@ -154,6 +154,13 @@ public:
* delta->cleanup() * delta->cleanup()
* kbps->sample() * kbps->sample()
* kbps->get_xxx_kbps(). * kbps->get_xxx_kbps().
* 3. kbps used as IKbpsDelta, to provides delta bytes:
* SrsKbps* kbps = ...;
* kbps->set_io(in, out);
* IKbpsDelta* delta = (IKbpsDelta*)kbps;
* delta->resample();
* printf("delta is %d/%d", delta->get_send_bytes_delta(), delta->get_recv_bytes_delta());
* delta->cleanup();
* the server never know how many bytes already send/recv, for the connection maybe closed. * the server never know how many bytes already send/recv, for the connection maybe closed.
*/ */
class SrsKbps : public virtual ISrsProtocolStatistic, public virtual IKbpsDelta class SrsKbps : public virtual ISrsProtocolStatistic, public virtual IKbpsDelta

View file

@ -167,6 +167,7 @@ public:
* sample the kbps, add delta bytes of conn. * sample the kbps, add delta bytes of conn.
* use kbps_sample() to get all result of kbps stat. * use kbps_sample() to get all result of kbps stat.
*/ */
// TODO: FIXME: the add delta must use IKbpsDelta interface instead.
virtual void kbps_add_delta(SrsConnection* conn); virtual void kbps_add_delta(SrsConnection* conn);
/** /**
* calc the result for all kbps. * calc the result for all kbps.