mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
When for traverses the device list, send invite and sleep to other threads to update the list, and the conflicting program exits
This commit is contained in:
parent
d02b560217
commit
82f1569f2a
1 changed files with 12 additions and 4 deletions
|
@ -163,6 +163,7 @@ srs_error_t SrsGb28181SipSession::do_cycle()
|
|||
if (_register_status == SrsGb28181SipSessionRegisterOk &&
|
||||
_alive_status == SrsGb28181SipSessionAliveOk)
|
||||
{
|
||||
std::list<std::string> auto_play_list;
|
||||
|
||||
std::map<std::string, SrsGb28181Device*>::iterator it;
|
||||
for (it = _device_list.begin(); it != _device_list.end(); it++) {
|
||||
|
@ -192,6 +193,13 @@ srs_error_t SrsGb28181SipSession::do_cycle()
|
|||
if (device->device_status != "ON" ||
|
||||
device->invite_status != SrsGb28181SipSessionUnkonw) continue;
|
||||
|
||||
auto_play_list.push_back(chid);
|
||||
}//end for (it)
|
||||
|
||||
//auto send sip invite and create stream chennal
|
||||
while(auto_play_list.size() > 0){
|
||||
std::string chid = auto_play_list.front();
|
||||
auto_play_list.pop_front();
|
||||
|
||||
SrsGb28181StreamChannel ch;
|
||||
|
||||
|
@ -226,7 +234,7 @@ srs_error_t SrsGb28181SipSession::do_cycle()
|
|||
|
||||
srs_trace("gb28181: %s clients device=%s send invite code=%d",
|
||||
_session_id.c_str(), chid.c_str(), code);
|
||||
}//end for (it)
|
||||
}//end while (auto_play_list.size())
|
||||
}//end if (config)
|
||||
|
||||
if (_register_status == SrsGb28181SipSessionRegisterOk &&
|
||||
|
@ -911,7 +919,7 @@ srs_error_t SrsGb28181SipService::fetch_or_create_sip_session(SrsSipRequest *req
|
|||
if ((sess = fetch(req->sip_auth_id)) != NULL) {
|
||||
*sip_session = sess;
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
sess = new SrsGb28181SipSession(this, req);;
|
||||
if ((err = sess->serve()) != srs_success) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue