winlin

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

... ... @@ -126,16 +126,16 @@ Supported operating systems and hardware:
16. support live stream transcoding by ffmpeg.<br/>
17. support live stream transcoding by ffmpeg.<br/>
18. support ffmpeg filters(logo/overlay/crop), x264 params.<br/>
19. [plan] support network based cli and json result.<br/>
20. [plan] support http callback api hooks(for authentication).<br/>
21. [plan] support bandwidth test api and flash client.<br/>
22. [plan] support adobe flash refer/token/swf verification.<br/>
23. [plan] support adobe amf3 codec.<br/>
24. [plan] support dvr(record live to vod file)<br/>
25. [plan] support FMS edge protocol<br/>
26. [plan] support encryption: RTMPE/RTMPS, HLS DRM<br/>
27. [plan] support RTMPT, http to tranverse firewalls<br/>
28. [plan] support audio transcode only, speex to aac<br/>
19. [dev] support audio transcode only, speex/mp3 to aac<br/>
20. [plan] support network based cli and json result.<br/>
21. [plan] support http callback api hooks(for authentication).<br/>
22. [plan] support bandwidth test api and flash client.<br/>
23. [plan] support adobe flash refer/token/swf verification.<br/>
24. [plan] support adobe amf3 codec.<br/>
25. [plan] support dvr(record live to vod file)<br/>
26. [plan] support FMS edge protocol<br/>
27. [plan] support encryption: RTMPE/RTMPS, HLS DRM<br/>
28. [plan] support RTMPT, http to tranverse firewalls<br/>
29. [plan] support file source, transcoding file to live stream<br/>
### Performance
... ...
... ... @@ -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();
... ...
... ... @@ -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
... ...