diff --git a/trunk/configure b/trunk/configure index 516e20ed4..c0eb2e103 100755 --- a/trunk/configure +++ b/trunk/configure @@ -464,11 +464,11 @@ MODULE_ID="APP" MODULE_DEPENDS=("CORE" "KERNEL" "RTMP") ModuleLibIncs=(${LibSTRoot} ${LibHttpParserRoot} ${SRS_OBJS}) MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_socket" "srs_app_source" - "srs_app_codec" "srs_app_refer" "srs_app_hls" "srs_app_forward" "srs_app_encoder" - "srs_app_http" "srs_app_thread" "srs_app_bandwidth" "srs_app_st" "srs_app_log" - "srs_app_config" "srs_app_pithy_print" "srs_app_reload" "srs_app_http_api" - "srs_app_http_conn" "srs_app_http_hooks" "srs_app_json" "srs_app_ingest" - "srs_app_ffmpeg" "srs_app_utility" "srs_app_dvr" "srs_app_edge") + "srs_app_codec" "srs_app_refer" "srs_app_hls" "srs_app_forward" "srs_app_encoder" "srs_app_http" + "srs_app_thread" "srs_app_bandwidth" "srs_app_st" "srs_app_log" "srs_app_config" + "srs_app_pithy_print" "srs_app_reload" "srs_app_http_api" "srs_app_http_conn" "srs_app_http_hooks" + "srs_app_json" "srs_app_ingest" "srs_app_ffmpeg" "srs_app_utility" "srs_app_dvr" "srs_app_edge" + "srs_app_kbps") APP_INCS="src/app"; MODULE_DIR=${APP_INCS} . auto/modules.sh APP_OBJS="${MODULE_OBJS[@]}" # diff --git a/trunk/src/app/srs_app_edge.cpp b/trunk/src/app/srs_app_edge.cpp index 42303bbc7..c4e15eebb 100644 --- a/trunk/src/app/srs_app_edge.cpp +++ b/trunk/src/app/srs_app_edge.cpp @@ -42,6 +42,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include +#include // when error, edge ingester sleep for a while and retry. #define SRS_EDGE_INGESTER_SLEEP_US (int64_t)(1*1000*1000LL) @@ -61,6 +62,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SrsEdgeIngester::SrsEdgeIngester() { io = NULL; + kbps = new SrsKbps(); client = NULL; _edge = NULL; _req = NULL; @@ -75,6 +77,7 @@ SrsEdgeIngester::~SrsEdgeIngester() stop(); srs_freep(pthread); + srs_freep(kbps); } int SrsEdgeIngester::initialize(SrsSource* source, SrsPlayEdge* edge, SrsRequest* req) @@ -101,6 +104,7 @@ void SrsEdgeIngester::stop() srs_freep(client); srs_freep(io); + kbps->set_io(NULL, NULL); } int SrsEdgeIngester::cycle() @@ -169,9 +173,8 @@ int SrsEdgeIngester::ingest() // pithy print if (pithy_print.can_print()) { srs_trace("<- "SRS_LOG_ID_EDGE_PLAY - " time=%"PRId64", obytes=%"PRId64", ibytes=%"PRId64", okbps=%d, ikbps=%d", - pithy_print.age(), client->get_send_bytes(), client->get_recv_bytes(), - client->get_send_kbps(), client->get_recv_kbps()); + " time=%"PRId64", okbps=%d, ikbps=%d", + pithy_print.age(), kbps->get_send_kbps(), kbps->get_recv_kbps()); } // read from client. @@ -303,6 +306,7 @@ int SrsEdgeIngester::connect_server() io = new SrsSocket(stfd); client = new SrsRtmpClient(io); + kbps->set_io(io, io); // connect to server. std::string ip = srs_dns_resolve(server); @@ -330,6 +334,7 @@ int SrsEdgeIngester::connect_server() SrsEdgeForwarder::SrsEdgeForwarder() { io = NULL; + kbps = NULL; client = NULL; _edge = NULL; _req = NULL; @@ -347,6 +352,7 @@ SrsEdgeForwarder::~SrsEdgeForwarder() srs_freep(pthread); srs_freep(queue); + srs_freep(kbps); } void SrsEdgeForwarder::set_queue_size(double queue_size) @@ -411,6 +417,7 @@ void SrsEdgeForwarder::stop() srs_freep(client); srs_freep(io); + kbps->set_io(NULL, NULL); } int SrsEdgeForwarder::cycle() @@ -458,9 +465,8 @@ int SrsEdgeForwarder::cycle() // pithy print if (pithy_print.can_print()) { srs_trace("-> "SRS_LOG_ID_EDGE_PUBLISH - " time=%"PRId64", msgs=%d, obytes=%"PRId64", ibytes=%"PRId64", okbps=%d, ikbps=%d", - pithy_print.age(), count, client->get_send_bytes(), client->get_recv_bytes(), - client->get_send_kbps(), client->get_recv_kbps()); + " time=%"PRId64", msgs=%d, okbps=%d, ikbps=%d", + pithy_print.age(), count, kbps->get_send_kbps(), kbps->get_recv_kbps()); } // ignore when no messages. @@ -576,6 +582,7 @@ int SrsEdgeForwarder::connect_server() io = new SrsSocket(stfd); client = new SrsRtmpClient(io); + kbps->set_io(io, io); // connect to server. std::string ip = srs_dns_resolve(server); diff --git a/trunk/src/app/srs_app_edge.hpp b/trunk/src/app/srs_app_edge.hpp index a5e78ff1b..acaf346fa 100644 --- a/trunk/src/app/srs_app_edge.hpp +++ b/trunk/src/app/srs_app_edge.hpp @@ -43,6 +43,7 @@ class SrsRtmpClient; class SrsMessage; class SrsMessageQueue; class ISrsProtocolReaderWriter; +class SrsKbps; /** * the state of edge, auto machine @@ -83,6 +84,7 @@ private: SrsThread* pthread; st_netfd_t stfd; ISrsProtocolReaderWriter* io; + SrsKbps* kbps; SrsRtmpClient* client; int origin_index; public: @@ -116,6 +118,7 @@ private: SrsThread* pthread; st_netfd_t stfd; ISrsProtocolReaderWriter* io; + SrsKbps* kbps; SrsRtmpClient* client; int origin_index; /** diff --git a/trunk/src/app/srs_app_forward.cpp b/trunk/src/app/srs_app_forward.cpp index bc3fb5da4..b70c3199b 100644 --- a/trunk/src/app/srs_app_forward.cpp +++ b/trunk/src/app/srs_app_forward.cpp @@ -39,6 +39,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include +#include // when error, forwarder sleep for a while and retry. #define SRS_FORWARDER_SLEEP_US (int64_t)(3*1000*1000LL) @@ -50,6 +51,7 @@ SrsForwarder::SrsForwarder(SrsSource* _source) io = NULL; client = NULL; stfd = NULL; + kbps = new SrsKbps(); stream_id = 0; pthread = new SrsThread(this, SRS_FORWARDER_SLEEP_US); @@ -64,6 +66,7 @@ SrsForwarder::~SrsForwarder() srs_freep(pthread); srs_freep(queue); srs_freep(jitter); + srs_freep(kbps); } void SrsForwarder::set_queue_size(double queue_size) @@ -146,6 +149,7 @@ void SrsForwarder::on_unpublish() srs_freep(client); srs_freep(io); + kbps->set_io(NULL, NULL); } int SrsForwarder::on_meta_data(SrsSharedPtrMessage* metadata) @@ -275,6 +279,7 @@ int SrsForwarder::connect_server() io = new SrsSocket(stfd); client = new SrsRtmpClient(io); + kbps->set_io(io, io); // connect to server. std::string ip = srs_dns_resolve(server); @@ -338,9 +343,8 @@ int SrsForwarder::forward() // pithy print if (pithy_print.can_print()) { srs_trace("-> "SRS_LOG_ID_FOWARDER - " time=%"PRId64", msgs=%d, obytes=%"PRId64", ibytes=%"PRId64", okbps=%d, ikbps=%d", - pithy_print.age(), count, client->get_send_bytes(), client->get_recv_bytes(), - client->get_send_kbps(), client->get_recv_kbps()); + " time=%"PRId64", msgs=%d, okbps=%d, ikbps=%d", + pithy_print.age(), count, kbps->get_send_kbps(), kbps->get_recv_kbps()); } // ignore when no messages. diff --git a/trunk/src/app/srs_app_forward.hpp b/trunk/src/app/srs_app_forward.hpp index 6907022cd..84de16460 100644 --- a/trunk/src/app/srs_app_forward.hpp +++ b/trunk/src/app/srs_app_forward.hpp @@ -42,6 +42,7 @@ class SrsRtmpJitter; class SrsRtmpClient; class SrsRequest; class SrsSource; +class SrsKbps; /** * forward the stream to other servers. @@ -61,6 +62,7 @@ private: private: SrsSource* source; ISrsProtocolReaderWriter* io; + SrsKbps* kbps; SrsRtmpClient* client; SrsRtmpJitter* jitter; SrsMessageQueue* queue; diff --git a/trunk/src/app/srs_app_kbps.cpp b/trunk/src/app/srs_app_kbps.cpp new file mode 100644 index 000000000..07c062407 --- /dev/null +++ b/trunk/src/app/srs_app_kbps.cpp @@ -0,0 +1,55 @@ +/* +The MIT License (MIT) + +Copyright (c) 2013-2014 winlin + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include +#include + +SrsKbps::SrsKbps() +{ + _in = NULL; + _out = NULL; +} + +SrsKbps::~SrsKbps() +{ +} + +void SrsKbps::set_io(ISrsProtocolReader* in, ISrsProtocolWriter* out) +{ + _in = in; + _out = out; +} + +int SrsKbps::get_send_kbps() +{ + return 0; +} + +int SrsKbps::get_recv_kbps() +{ + return 0; +} + diff --git a/trunk/src/app/srs_app_kbps.hpp b/trunk/src/app/srs_app_kbps.hpp new file mode 100644 index 000000000..c1c1b2b61 --- /dev/null +++ b/trunk/src/app/srs_app_kbps.hpp @@ -0,0 +1,54 @@ +/* +The MIT License (MIT) + +Copyright (c) 2013-2014 winlin + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef SRS_APP_KBPS_HPP +#define SRS_APP_KBPS_HPP + +/* +#include +*/ + +#include + +class ISrsProtocolReader; +class ISrsProtocolWriter; + +/** +* to statistic the kbps of io. +*/ +class SrsKbps +{ +private: + ISrsProtocolReader* _in; + ISrsProtocolWriter* _out; +public: + SrsKbps(); + virtual ~SrsKbps(); +public: + virtual void set_io(ISrsProtocolReader* in, ISrsProtocolWriter* out); +public: + virtual int get_send_kbps(); + virtual int get_recv_kbps(); +}; + +#endif \ No newline at end of file diff --git a/trunk/src/app/srs_app_rtmp_conn.cpp b/trunk/src/app/srs_app_rtmp_conn.cpp index 1059eae06..47d1c63ce 100644 --- a/trunk/src/app/srs_app_rtmp_conn.cpp +++ b/trunk/src/app/srs_app_rtmp_conn.cpp @@ -43,6 +43,7 @@ using namespace std; #include #include #include +#include // 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. diff --git a/trunk/src/app/srs_app_rtmp_conn.hpp b/trunk/src/app/srs_app_rtmp_conn.hpp index 2548823c2..d2e47a14a 100644 --- a/trunk/src/app/srs_app_rtmp_conn.hpp +++ b/trunk/src/app/srs_app_rtmp_conn.hpp @@ -46,6 +46,7 @@ class SrsSocket; class SrsHttpHooks; #endif class SrsBandwidth; +class SrsKbps; /** * the client provides the main logic control for RTMP clients. @@ -63,6 +64,7 @@ private: // for live play duration, for instance, rtmpdump to record. // @see https://github.com/winlinvip/simple-rtmp-server/issues/47 int64_t duration; + SrsKbps* kbps; public: SrsRtmpConn(SrsServer* srs_server, st_netfd_t client_stfd); virtual ~SrsRtmpConn(); diff --git a/trunk/src/app/srs_app_socket.cpp b/trunk/src/app/srs_app_socket.cpp index 0ca479715..139ef10a9 100644 --- a/trunk/src/app/srs_app_socket.cpp +++ b/trunk/src/app/srs_app_socket.cpp @@ -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; diff --git a/trunk/src/app/srs_app_socket.hpp b/trunk/src/app/srs_app_socket.hpp index 1bf65e237..a293b12ed 100644 --- a/trunk/src/app/srs_app_socket.hpp +++ b/trunk/src/app/srs_app_socket.hpp @@ -44,7 +44,6 @@ private: int64_t send_timeout; int64_t recv_bytes; int64_t send_bytes; - int64_t start_time_ms; st_netfd_t stfd; public: SrsSocket(st_netfd_t client_stfd); @@ -57,8 +56,6 @@ public: virtual int64_t get_send_timeout(); virtual int64_t get_recv_bytes(); virtual int64_t get_send_bytes(); - virtual int get_recv_kbps(); - virtual int get_send_kbps(); public: /** * @param nread, the actual read bytes, ignore if NULL. diff --git a/trunk/src/libs/srs_lib_simple_socket.cpp b/trunk/src/libs/srs_lib_simple_socket.cpp index 3a4e9bd3d..af75371e3 100644 --- a/trunk/src/libs/srs_lib_simple_socket.cpp +++ b/trunk/src/libs/srs_lib_simple_socket.cpp @@ -44,9 +44,6 @@ SimpleSocketStream::SimpleSocketStream() fd = -1; send_timeout = recv_timeout = ST_UTIME_NO_TIMEOUT; recv_bytes = send_bytes = 0; - - srs_update_system_time_ms(); - start_time_ms = srs_get_system_time_ms(); } SimpleSocketStream::~SimpleSocketStream() @@ -122,18 +119,6 @@ int64_t SimpleSocketStream::get_recv_bytes() return recv_bytes; } -int SimpleSocketStream::get_recv_kbps() -{ - srs_update_system_time_ms(); - int64_t diff_ms = srs_get_system_time_ms() - start_time_ms; - - if (diff_ms <= 0) { - return 0; - } - - return recv_bytes * 8 / diff_ms; -} - // ISrsProtocolWriter void SimpleSocketStream::set_send_timeout(int64_t timeout_us) { @@ -150,18 +135,6 @@ int64_t SimpleSocketStream::get_send_bytes() return send_bytes; } -int SimpleSocketStream::get_send_kbps() -{ - srs_update_system_time_ms(); - 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 SimpleSocketStream::writev(const iovec *iov, int iov_size, ssize_t* nwrite) { int ret = ERROR_SUCCESS; diff --git a/trunk/src/libs/srs_lib_simple_socket.hpp b/trunk/src/libs/srs_lib_simple_socket.hpp index 58d4a4fab..835964b37 100644 --- a/trunk/src/libs/srs_lib_simple_socket.hpp +++ b/trunk/src/libs/srs_lib_simple_socket.hpp @@ -39,7 +39,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. class SimpleSocketStream : public ISrsProtocolReaderWriter { private: - int64_t start_time_ms; int64_t recv_timeout; int64_t send_timeout; int64_t recv_bytes; @@ -59,13 +58,11 @@ public: virtual void set_recv_timeout(int64_t timeout_us); virtual int64_t get_recv_timeout(); virtual int64_t get_recv_bytes(); - virtual int get_recv_kbps(); // ISrsProtocolWriter public: virtual void set_send_timeout(int64_t timeout_us); virtual int64_t get_send_timeout(); virtual int64_t get_send_bytes(); - virtual int get_send_kbps(); virtual int writev(const iovec *iov, int iov_size, ssize_t* nwrite); // ISrsProtocolReaderWriter public: diff --git a/trunk/src/rtmp/srs_protocol_io.hpp b/trunk/src/rtmp/srs_protocol_io.hpp index 85d265e07..9020655b3 100644 --- a/trunk/src/rtmp/srs_protocol_io.hpp +++ b/trunk/src/rtmp/srs_protocol_io.hpp @@ -47,8 +47,6 @@ public: virtual void set_recv_timeout(int64_t timeout_us) = 0; virtual int64_t get_recv_timeout() = 0; virtual int64_t get_recv_bytes() = 0; - // TODO: FIXME: remove this interface. - virtual int get_recv_kbps() = 0; }; /** @@ -64,8 +62,6 @@ public: virtual void set_send_timeout(int64_t timeout_us) = 0; virtual int64_t get_send_timeout() = 0; virtual int64_t get_send_bytes() = 0; - // TODO: FIXME: remove this interface. - virtual int get_send_kbps() = 0; virtual int writev(const iovec *iov, int iov_size, ssize_t* nwrite) = 0; }; diff --git a/trunk/src/rtmp/srs_protocol_rtmp.cpp b/trunk/src/rtmp/srs_protocol_rtmp.cpp index 03add4f12..0b82e759a 100644 --- a/trunk/src/rtmp/srs_protocol_rtmp.cpp +++ b/trunk/src/rtmp/srs_protocol_rtmp.cpp @@ -375,16 +375,6 @@ int64_t SrsRtmpClient::get_send_bytes() return protocol->get_send_bytes(); } -int SrsRtmpClient::get_recv_kbps() -{ - return protocol->get_recv_kbps(); -} - -int SrsRtmpClient::get_send_kbps() -{ - return protocol->get_send_kbps(); -} - int SrsRtmpClient::recv_message(SrsMessage** pmsg) { return protocol->recv_message(pmsg); @@ -730,16 +720,6 @@ int64_t SrsRtmpServer::get_send_bytes() return protocol->get_send_bytes(); } -int SrsRtmpServer::get_recv_kbps() -{ - return protocol->get_recv_kbps(); -} - -int SrsRtmpServer::get_send_kbps() -{ - return protocol->get_send_kbps(); -} - int SrsRtmpServer::recv_message(SrsMessage** pmsg) { return protocol->recv_message(pmsg); diff --git a/trunk/src/rtmp/srs_protocol_rtmp.hpp b/trunk/src/rtmp/srs_protocol_rtmp.hpp index da3808bf5..80c5d2edf 100644 --- a/trunk/src/rtmp/srs_protocol_rtmp.hpp +++ b/trunk/src/rtmp/srs_protocol_rtmp.hpp @@ -161,8 +161,6 @@ public: virtual void set_send_timeout(int64_t timeout_us); virtual int64_t get_recv_bytes(); virtual int64_t get_send_bytes(); - virtual int get_recv_kbps(); - virtual int get_send_kbps(); virtual int recv_message(SrsMessage** pmsg); virtual int decode_message(SrsMessage* msg, SrsPacket** ppacket); virtual int send_and_free_message(SrsMessage* msg); @@ -208,8 +206,6 @@ public: virtual int64_t get_send_timeout(); virtual int64_t get_recv_bytes(); virtual int64_t get_send_bytes(); - virtual int get_recv_kbps(); - virtual int get_send_kbps(); virtual int recv_message(SrsMessage** pmsg); virtual int decode_message(SrsMessage* msg, SrsPacket** ppacket); virtual int send_and_free_message(SrsMessage* msg); diff --git a/trunk/src/rtmp/srs_protocol_rtmp_stack.cpp b/trunk/src/rtmp/srs_protocol_rtmp_stack.cpp index 4ed78a435..0c81f3273 100644 --- a/trunk/src/rtmp/srs_protocol_rtmp_stack.cpp +++ b/trunk/src/rtmp/srs_protocol_rtmp_stack.cpp @@ -359,16 +359,6 @@ int64_t SrsProtocol::get_send_bytes() return skt->get_send_bytes(); } -int SrsProtocol::get_recv_kbps() -{ - return skt->get_recv_kbps(); -} - -int SrsProtocol::get_send_kbps() -{ - return skt->get_send_kbps(); -} - int SrsProtocol::recv_message(SrsMessage** pmsg) { *pmsg = NULL; diff --git a/trunk/src/rtmp/srs_protocol_rtmp_stack.hpp b/trunk/src/rtmp/srs_protocol_rtmp_stack.hpp index 8f688faa7..84a16f53c 100644 --- a/trunk/src/rtmp/srs_protocol_rtmp_stack.hpp +++ b/trunk/src/rtmp/srs_protocol_rtmp_stack.hpp @@ -138,8 +138,6 @@ public: virtual int64_t get_send_timeout(); virtual int64_t get_recv_bytes(); virtual int64_t get_send_bytes(); - virtual int get_recv_kbps(); - virtual int get_send_kbps(); public: /** * recv a RTMP message, which is bytes oriented. diff --git a/trunk/src/srs/srs.upp b/trunk/src/srs/srs.upp index c895da723..ad4f57392 100755 --- a/trunk/src/srs/srs.upp +++ b/trunk/src/srs/srs.upp @@ -71,6 +71,8 @@ file ..\app\srs_app_ingest.cpp, ..\app\srs_app_json.hpp, ..\app\srs_app_json.cpp, + ..\app\srs_app_kbps.hpp, + ..\app\srs_app_kbps.cpp, ..\app\srs_app_log.hpp, ..\app\srs_app_log.cpp, ..\app\srs_app_refer.hpp, diff --git a/trunk/src/utest/srs_utest.cpp b/trunk/src/utest/srs_utest.cpp index 6171a1bd5..df4683dd5 100644 --- a/trunk/src/utest/srs_utest.cpp +++ b/trunk/src/utest/srs_utest.cpp @@ -73,11 +73,6 @@ int64_t MockEmptyIO::get_recv_bytes() return -1; } -int MockEmptyIO::get_recv_kbps() -{ - return 0; -} - void MockEmptyIO::set_send_timeout(int64_t /*timeout_us*/) { } @@ -92,11 +87,6 @@ int64_t MockEmptyIO::get_send_bytes() return 0; } -int MockEmptyIO::get_send_kbps() -{ - return 0; -} - int MockEmptyIO::writev(const iovec */*iov*/, int /*iov_size*/, ssize_t* /*nwrite*/) { return ERROR_SUCCESS; diff --git a/trunk/src/utest/srs_utest.hpp b/trunk/src/utest/srs_utest.hpp index 6b1ccf87d..54e4ac899 100644 --- a/trunk/src/utest/srs_utest.hpp +++ b/trunk/src/utest/srs_utest.hpp @@ -53,13 +53,11 @@ public: virtual void set_recv_timeout(int64_t timeout_us); virtual int64_t get_recv_timeout(); virtual int64_t get_recv_bytes(); - virtual int get_recv_kbps(); // for protocol public: virtual void set_send_timeout(int64_t timeout_us); virtual int64_t get_send_timeout(); virtual int64_t get_send_bytes(); - virtual int get_send_kbps(); virtual int writev(const iovec *iov, int iov_size, ssize_t* nwrite); // for protocol/amf0/msg-codec public: