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

for bug #241, support mr(merged-read) config and reload. 2.0.52.

This commit is contained in:
winlin 2014-12-04 18:21:04 +08:00
parent 57f844b636
commit 5589b13d2e
18 changed files with 293 additions and 48 deletions

View file

@ -35,11 +35,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_thread.hpp>
#include <srs_protocol_buffer.hpp>
#include <srs_core_performance.hpp>
#include <srs_app_reload.hpp>
class SrsRtmpServer;
class SrsMessage;
class SrsRtmpConn;
class SrsSource;
class SrsRequest;
/**
* for the recv thread to handle the message.
@ -138,15 +140,19 @@ class SrsPublishRecvThread : virtual public ISrsMessageHandler
#ifdef SRS_PERF_MERGED_READ
, virtual public IMergeReadHandler
#endif
, virtual public ISrsReloadHandler
{
private:
SrsRecvThread trd;
SrsRtmpServer* rtmp;
SrsRequest* req;
// the msgs already got.
int64_t _nb_msgs;
// for mr(merged read),
// @see https://github.com/winlinvip/simple-rtmp-server/issues/241
bool mr;
int mr_fd;
int mr_sleep;
// the recv thread error code.
int recv_error_code;
SrsRtmpConn* _conn;
@ -158,7 +164,8 @@ private:
// @see https://github.com/winlinvip/simple-rtmp-server/issues/244
st_cond_t error;
public:
SrsPublishRecvThread(SrsRtmpServer* rtmp_sdk, int fd, int timeout_ms,
SrsPublishRecvThread(SrsRtmpServer* rtmp_sdk,
SrsRequest* _req, int mr_sock_fd, int timeout_ms,
SrsRtmpConn* conn, SrsSource* source, bool is_fmle, bool is_edge);
virtual ~SrsPublishRecvThread();
public:
@ -183,6 +190,11 @@ public:
#ifdef SRS_PERF_MERGED_READ
virtual void on_read(ssize_t nread);
#endif
// interface ISrsReloadHandler
public:
virtual int on_reload_vhost_mr(std::string vhost);
private:
virtual void update_buffer(bool mr_enabled, int sleep_ms);
};
#endif