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

fix #588, kbps interface error. 2.0.228

This commit is contained in:
winlin 2017-01-11 11:22:16 +08:00
parent e3aa34ec5f
commit c58dbe4d14
4 changed files with 40 additions and 11 deletions

View file

@ -95,13 +95,9 @@ public:
SrsKbpsSlice();
virtual ~SrsKbpsSlice();
public:
/**
* get current total bytes.
*/
// Get current total bytes, not depend on sample().
virtual int64_t get_total_bytes();
/**
* resample all samples.
*/
// Resample the slice to calculate the kbps.
virtual void sample();
};
@ -162,6 +158,13 @@ public:
* 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.
* 4. kbps used as ISrsProtocolStatistic, to provides raw bytes:
* SrsKbps* kbps = ...;
* kbps->set_io(in, out);
* // both kbps->get_recv_bytes() and kbps->get_send_bytes() are available.
* // we can use the kbps as the data source of another kbps:
* SrsKbps* user = ...;
* user->set_io(kbps, kbps);
*/
class SrsKbps : public virtual ISrsProtocolStatistic, public virtual IKbpsDelta
{