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:
parent
679e851f07
commit
cab88dfe70
3 changed files with 34 additions and 14 deletions
20
README.md
20
README.md
|
@ -126,16 +126,16 @@ Supported operating systems and hardware:
|
||||||
16. support live stream transcoding by ffmpeg.<br/>
|
16. support live stream transcoding by ffmpeg.<br/>
|
||||||
17. 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/>
|
18. support ffmpeg filters(logo/overlay/crop), x264 params.<br/>
|
||||||
19. [plan] support network based cli and json result.<br/>
|
19. [dev] support audio transcode only, speex/mp3 to aac<br/>
|
||||||
20. [plan] support http callback api hooks(for authentication).<br/>
|
20. [plan] support network based cli and json result.<br/>
|
||||||
21. [plan] support bandwidth test api and flash client.<br/>
|
21. [plan] support http callback api hooks(for authentication).<br/>
|
||||||
22. [plan] support adobe flash refer/token/swf verification.<br/>
|
22. [plan] support bandwidth test api and flash client.<br/>
|
||||||
23. [plan] support adobe amf3 codec.<br/>
|
23. [plan] support adobe flash refer/token/swf verification.<br/>
|
||||||
24. [plan] support dvr(record live to vod file)<br/>
|
24. [plan] support adobe amf3 codec.<br/>
|
||||||
25. [plan] support FMS edge protocol<br/>
|
25. [plan] support dvr(record live to vod file)<br/>
|
||||||
26. [plan] support encryption: RTMPE/RTMPS, HLS DRM<br/>
|
26. [plan] support FMS edge protocol<br/>
|
||||||
27. [plan] support RTMPT, http to tranverse firewalls<br/>
|
27. [plan] support encryption: RTMPE/RTMPS, HLS DRM<br/>
|
||||||
28. [plan] support audio transcode only, speex to aac<br/>
|
28. [plan] support RTMPT, http to tranverse firewalls<br/>
|
||||||
29. [plan] support file source, transcoding file to live stream<br/>
|
29. [plan] support file source, transcoding file to live stream<br/>
|
||||||
|
|
||||||
### Performance
|
### Performance
|
||||||
|
|
|
@ -1139,6 +1139,11 @@ int SrsHls::on_publish(SrsRequest* req)
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
|
// support multiple publish.
|
||||||
|
if (hls_enabled) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
std::string vhost = req->vhost;
|
std::string vhost = req->vhost;
|
||||||
std::string stream = req->stream;
|
std::string stream = req->stream;
|
||||||
std::string app = req->app;
|
std::string app = req->app;
|
||||||
|
@ -1194,6 +1199,11 @@ void SrsHls::on_unpublish()
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
|
// support multiple unpublish.
|
||||||
|
if (!hls_enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// close muxer when unpublish.
|
// close muxer when unpublish.
|
||||||
ret = ts_cache->flush_audio(muxer);
|
ret = ts_cache->flush_audio(muxer);
|
||||||
ret += muxer->segment_close();
|
ret += muxer->segment_close();
|
||||||
|
|
|
@ -508,8 +508,13 @@ int SrsSource::on_audio(SrsCommonMessage* audio)
|
||||||
|
|
||||||
#ifdef SRS_HLS
|
#ifdef SRS_HLS
|
||||||
if ((ret = hls->on_audio(msg->copy())) != ERROR_SUCCESS) {
|
if ((ret = hls->on_audio(msg->copy())) != ERROR_SUCCESS) {
|
||||||
srs_error("hls process audio message failed. ret=%d", ret);
|
srs_warn("hls process audio message failed, ignore and disable hls. ret=%d", ret);
|
||||||
return ret;
|
|
||||||
|
// unpublish, ignore ret.
|
||||||
|
hls->on_unpublish();
|
||||||
|
|
||||||
|
// ignore.
|
||||||
|
ret = ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -570,8 +575,13 @@ int SrsSource::on_video(SrsCommonMessage* video)
|
||||||
|
|
||||||
#ifdef SRS_HLS
|
#ifdef SRS_HLS
|
||||||
if ((ret = hls->on_video(msg->copy())) != ERROR_SUCCESS) {
|
if ((ret = hls->on_video(msg->copy())) != ERROR_SUCCESS) {
|
||||||
srs_error("hls process video message failed. ret=%d", ret);
|
srs_warn("hls process video message failed, ignore and disable hls. ret=%d", ret);
|
||||||
return ret;
|
|
||||||
|
// unpublish, ignore ret.
|
||||||
|
hls->on_unpublish();
|
||||||
|
|
||||||
|
// ignore.
|
||||||
|
ret = ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue