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

fix bug #217, add reuse conn to play different player.

This commit is contained in:
winlin 2014-11-22 19:15:40 +08:00
parent 3e81e6e0f1
commit 3d97048c3a
9 changed files with 209 additions and 1 deletions

View file

@ -54,6 +54,11 @@ bool SrsRecvThread::empty()
return queue.empty();
}
int SrsRecvThread::size()
{
return (int)queue.size();
}
SrsMessage* SrsRecvThread::pump()
{
srs_assert(!queue.empty());
@ -79,6 +84,15 @@ int SrsRecvThread::cycle()
{
int ret = ERROR_SUCCESS;
// we only recv one message and then process it,
// for the message may cause the thread to stop,
// when stop, the thread is freed, so the messages
// are dropped.
if (!queue.empty()) {
st_usleep(SRS_CONSTS_RTMP_PULSE_TIMEOUT_US);
return ret;
}
SrsMessage* msg = NULL;
if ((ret = rtmp->recv_message(&msg)) != ERROR_SUCCESS) {
@ -93,6 +107,10 @@ int SrsRecvThread::cycle()
}
srs_verbose("play loop recv message. ret=%d", ret);
// put into queue, the send thread will get and process it,
// @see SrsRtmpConn::process_play_control_msg
queue.push_back(msg);
return ret;
}