hls support multiple publish/unpublish. disable hls when not support
正在显示
3 个修改的文件
包含
34 行增加
和
14 行删除
@@ -126,16 +126,16 @@ Supported operating systems and hardware: | @@ -126,16 +126,16 @@ Supported operating systems and hardware: | ||
126 | 16. support live stream transcoding by ffmpeg.<br/> | 126 | 16. support live stream transcoding by ffmpeg.<br/> |
127 | 17. support live stream transcoding by ffmpeg.<br/> | 127 | 17. support live stream transcoding by ffmpeg.<br/> |
128 | 18. support ffmpeg filters(logo/overlay/crop), x264 params.<br/> | 128 | 18. support ffmpeg filters(logo/overlay/crop), x264 params.<br/> |
129 | -19. [plan] support network based cli and json result.<br/> | ||
130 | -20. [plan] support http callback api hooks(for authentication).<br/> | ||
131 | -21. [plan] support bandwidth test api and flash client.<br/> | ||
132 | -22. [plan] support adobe flash refer/token/swf verification.<br/> | ||
133 | -23. [plan] support adobe amf3 codec.<br/> | ||
134 | -24. [plan] support dvr(record live to vod file)<br/> | ||
135 | -25. [plan] support FMS edge protocol<br/> | ||
136 | -26. [plan] support encryption: RTMPE/RTMPS, HLS DRM<br/> | ||
137 | -27. [plan] support RTMPT, http to tranverse firewalls<br/> | ||
138 | -28. [plan] support audio transcode only, speex to aac<br/> | 129 | +19. [dev] support audio transcode only, speex/mp3 to aac<br/> |
130 | +20. [plan] support network based cli and json result.<br/> | ||
131 | +21. [plan] support http callback api hooks(for authentication).<br/> | ||
132 | +22. [plan] support bandwidth test api and flash client.<br/> | ||
133 | +23. [plan] support adobe flash refer/token/swf verification.<br/> | ||
134 | +24. [plan] support adobe amf3 codec.<br/> | ||
135 | +25. [plan] support dvr(record live to vod file)<br/> | ||
136 | +26. [plan] support FMS edge protocol<br/> | ||
137 | +27. [plan] support encryption: RTMPE/RTMPS, HLS DRM<br/> | ||
138 | +28. [plan] support RTMPT, http to tranverse firewalls<br/> | ||
139 | 29. [plan] support file source, transcoding file to live stream<br/> | 139 | 29. [plan] support file source, transcoding file to live stream<br/> |
140 | 140 | ||
141 | ### Performance | 141 | ### Performance |
@@ -1138,6 +1138,11 @@ SrsHls::~SrsHls() | @@ -1138,6 +1138,11 @@ SrsHls::~SrsHls() | ||
1138 | int SrsHls::on_publish(SrsRequest* req) | 1138 | int SrsHls::on_publish(SrsRequest* req) |
1139 | { | 1139 | { |
1140 | int ret = ERROR_SUCCESS; | 1140 | int ret = ERROR_SUCCESS; |
1141 | + | ||
1142 | + // support multiple publish. | ||
1143 | + if (hls_enabled) { | ||
1144 | + return ret; | ||
1145 | + } | ||
1141 | 1146 | ||
1142 | std::string vhost = req->vhost; | 1147 | std::string vhost = req->vhost; |
1143 | std::string stream = req->stream; | 1148 | std::string stream = req->stream; |
@@ -1194,6 +1199,11 @@ void SrsHls::on_unpublish() | @@ -1194,6 +1199,11 @@ void SrsHls::on_unpublish() | ||
1194 | { | 1199 | { |
1195 | int ret = ERROR_SUCCESS; | 1200 | int ret = ERROR_SUCCESS; |
1196 | 1201 | ||
1202 | + // support multiple unpublish. | ||
1203 | + if (!hls_enabled) { | ||
1204 | + return; | ||
1205 | + } | ||
1206 | + | ||
1197 | // close muxer when unpublish. | 1207 | // close muxer when unpublish. |
1198 | ret = ts_cache->flush_audio(muxer); | 1208 | ret = ts_cache->flush_audio(muxer); |
1199 | ret += muxer->segment_close(); | 1209 | ret += muxer->segment_close(); |
@@ -508,8 +508,13 @@ int SrsSource::on_audio(SrsCommonMessage* audio) | @@ -508,8 +508,13 @@ int SrsSource::on_audio(SrsCommonMessage* audio) | ||
508 | 508 | ||
509 | #ifdef SRS_HLS | 509 | #ifdef SRS_HLS |
510 | if ((ret = hls->on_audio(msg->copy())) != ERROR_SUCCESS) { | 510 | if ((ret = hls->on_audio(msg->copy())) != ERROR_SUCCESS) { |
511 | - srs_error("hls process audio message failed. ret=%d", ret); | ||
512 | - return ret; | 511 | + srs_warn("hls process audio message failed, ignore and disable hls. ret=%d", ret); |
512 | + | ||
513 | + // unpublish, ignore ret. | ||
514 | + hls->on_unpublish(); | ||
515 | + | ||
516 | + // ignore. | ||
517 | + ret = ERROR_SUCCESS; | ||
513 | } | 518 | } |
514 | #endif | 519 | #endif |
515 | 520 | ||
@@ -570,8 +575,13 @@ int SrsSource::on_video(SrsCommonMessage* video) | @@ -570,8 +575,13 @@ int SrsSource::on_video(SrsCommonMessage* video) | ||
570 | 575 | ||
571 | #ifdef SRS_HLS | 576 | #ifdef SRS_HLS |
572 | if ((ret = hls->on_video(msg->copy())) != ERROR_SUCCESS) { | 577 | if ((ret = hls->on_video(msg->copy())) != ERROR_SUCCESS) { |
573 | - srs_error("hls process video message failed. ret=%d", ret); | ||
574 | - return ret; | 578 | + srs_warn("hls process video message failed, ignore and disable hls. ret=%d", ret); |
579 | + | ||
580 | + // unpublish, ignore ret. | ||
581 | + hls->on_unpublish(); | ||
582 | + | ||
583 | + // ignore. | ||
584 | + ret = ERROR_SUCCESS; | ||
575 | } | 585 | } |
576 | #endif | 586 | #endif |
577 | 587 |
-
请 注册 或 登录 后发表评论