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

fix #404, register handler then start http thread. 2.0.167.

This commit is contained in:
winlin 2015-05-24 15:19:09 +08:00
parent a45cf38d44
commit 069ee0afc3
4 changed files with 26 additions and 12 deletions

View file

@ -1854,15 +1854,18 @@ int SrsHttpServer::http_mount(SrsSource* s, SrsRequest* r)
sflvs[sid] = entry;
// start http stream cache thread
if ((ret = entry->cache->start()) != ERROR_SUCCESS) {
srs_error("http: start stream cache failed. ret=%d", ret);
// mount the http flv stream.
// we must register the handler, then start the thread,
// for the thread will cause thread switch context.
// @see https://github.com/simple-rtmp-server/srs/issues/404
if ((ret = mux.handle(mount, entry->stream)) != ERROR_SUCCESS) {
srs_error("http: mount flv stream for vhost=%s failed. ret=%d", sid.c_str(), ret);
return ret;
}
// mount the http flv stream.
if ((ret = mux.handle(mount, entry->stream)) != ERROR_SUCCESS) {
srs_error("http: mount flv stream for vhost=%s failed. ret=%d", sid.c_str(), ret);
// start http stream cache thread
if ((ret = entry->cache->start()) != ERROR_SUCCESS) {
srs_error("http: start stream cache failed. ret=%d", ret);
return ret;
}
srs_trace("http: mount flv stream for vhost=%s, mount=%s", sid.c_str(), mount.c_str());