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

refine code

This commit is contained in:
winlin 2015-05-28 07:03:38 +08:00
parent 60775485c4
commit e5461d2df9
8 changed files with 13 additions and 9 deletions

View file

@ -43,10 +43,13 @@ SrsThreadContext::~SrsThreadContext()
{ {
} }
void SrsThreadContext::generate_id() int SrsThreadContext::generate_id()
{ {
static int id = 100; static int id = 100;
cache[st_thread_self()] = id++;
int gid = id++;
cache[st_thread_self()] = gid;
return gid;
} }
int SrsThreadContext::get_id() int SrsThreadContext::get_id()

View file

@ -51,7 +51,7 @@ public:
SrsThreadContext(); SrsThreadContext();
virtual ~SrsThreadContext(); virtual ~SrsThreadContext();
public: public:
virtual void generate_id(); virtual int generate_id();
virtual int get_id(); virtual int get_id();
}; };

View file

@ -607,7 +607,7 @@ int SrsServer::initialize_st()
int ret = ERROR_SUCCESS; int ret = ERROR_SUCCESS;
// init st // init st
if ((ret = srs_init_st()) != ERROR_SUCCESS) { if ((ret = srs_st_init()) != ERROR_SUCCESS) {
srs_error("init st failed. ret=%d", ret); srs_error("init st failed. ret=%d", ret);
return ret; return ret;
} }

View file

@ -42,7 +42,7 @@ bool srs_st_epoll_is_supported(void)
} }
#endif #endif
int srs_init_st() int srs_st_init()
{ {
int ret = ERROR_SUCCESS; int ret = ERROR_SUCCESS;

View file

@ -33,7 +33,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <st.h> #include <st.h>
// initialize st, requires epoll. // initialize st, requires epoll.
extern int srs_init_st(); extern int srs_st_init();
// close the netfd, and close the underlayer fd. // close the netfd, and close the underlayer fd.
extern void srs_close_stfd(st_netfd_t& stfd); extern void srs_close_stfd(st_netfd_t& stfd);

View file

@ -66,8 +66,9 @@ ISrsThreadContext::~ISrsThreadContext()
{ {
} }
void ISrsThreadContext::generate_id() int ISrsThreadContext::generate_id()
{ {
return 0;
} }
int ISrsThreadContext::get_id() int ISrsThreadContext::get_id()

View file

@ -102,7 +102,7 @@ public:
ISrsThreadContext(); ISrsThreadContext();
virtual ~ISrsThreadContext(); virtual ~ISrsThreadContext();
public: public:
virtual void generate_id(); virtual int generate_id();
virtual int get_id(); virtual int get_id();
}; };

View file

@ -1378,7 +1378,7 @@ int proxy_hls2rtmp(string hls, string rtmp)
int ret = ERROR_SUCCESS; int ret = ERROR_SUCCESS;
// init st. // init st.
if ((ret = srs_init_st()) != ERROR_SUCCESS) { if ((ret = srs_st_init()) != ERROR_SUCCESS) {
srs_error("init st failed. ret=%d", ret); srs_error("init st failed. ret=%d", ret);
return ret; return ret;
} }