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

hls support multiple publish/unpublish. disable hls when not support

This commit is contained in:
winlin 2013-12-06 14:02:10 +08:00
parent 679e851f07
commit cab88dfe70
3 changed files with 34 additions and 14 deletions

View file

@ -1138,6 +1138,11 @@ SrsHls::~SrsHls()
int SrsHls::on_publish(SrsRequest* req)
{
int ret = ERROR_SUCCESS;
// support multiple publish.
if (hls_enabled) {
return ret;
}
std::string vhost = req->vhost;
std::string stream = req->stream;
@ -1194,6 +1199,11 @@ void SrsHls::on_unpublish()
{
int ret = ERROR_SUCCESS;
// support multiple unpublish.
if (!hls_enabled) {
return;
}
// close muxer when unpublish.
ret = ts_cache->flush_audio(muxer);
ret += muxer->segment_close();

View file

@ -508,8 +508,13 @@ int SrsSource::on_audio(SrsCommonMessage* audio)
#ifdef SRS_HLS
if ((ret = hls->on_audio(msg->copy())) != ERROR_SUCCESS) {
srs_error("hls process audio message failed. ret=%d", ret);
return ret;
srs_warn("hls process audio message failed, ignore and disable hls. ret=%d", ret);
// unpublish, ignore ret.
hls->on_unpublish();
// ignore.
ret = ERROR_SUCCESS;
}
#endif
@ -570,8 +575,13 @@ int SrsSource::on_video(SrsCommonMessage* video)
#ifdef SRS_HLS
if ((ret = hls->on_video(msg->copy())) != ERROR_SUCCESS) {
srs_error("hls process video message failed. ret=%d", ret);
return ret;
srs_warn("hls process video message failed, ignore and disable hls. ret=%d", ret);
// unpublish, ignore ret.
hls->on_unpublish();
// ignore.
ret = ERROR_SUCCESS;
}
#endif