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

Merge pull request #1612 from xialixin/develop

Fix disconnect RTSP connection has assertion, resulting in program exit
This commit is contained in:
winlin 2020-03-07 22:31:34 +08:00 committed by GitHub
commit 12a74326e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 4 deletions

View file

@ -240,6 +240,11 @@ srs_error_t SrsRtspConn::serve()
return err;
}
std::string SrsRtspConn::remote_ip()
{
return "";
}
srs_error_t SrsRtspConn::do_cycle()
{
srs_error_t err = srs_success;
@ -684,6 +689,7 @@ SrsRtspCaster::SrsRtspCaster(SrsConfDirective* c)
output = _srs_config->get_stream_caster_output(c);
local_port_min = _srs_config->get_stream_caster_rtp_port_min(c);
local_port_max = _srs_config->get_stream_caster_rtp_port_max(c);
manager = new SrsCoroutineManager();
}
SrsRtspCaster::~SrsRtspCaster()
@ -691,10 +697,20 @@ SrsRtspCaster::~SrsRtspCaster()
std::vector<SrsRtspConn*>::iterator it;
for (it = clients.begin(); it != clients.end(); ++it) {
SrsRtspConn* conn = *it;
srs_freep(conn);
manager->remove(conn);
}
clients.clear();
used_ports.clear();
srs_freep(manager);
}
srs_error_t SrsRtspCaster::initialize()
{
srs_error_t err = srs_success;
if ((err = manager->start()) != srs_success) {
return srs_error_wrap(err, "start manager");
}
}
srs_error_t SrsRtspCaster::alloc_port(int* pport)
@ -747,6 +763,6 @@ void SrsRtspCaster::remove(SrsRtspConn* conn)
}
srs_info("rtsp: remove connection from caster.");
srs_freep(conn);
manager->remove(conn);
}