winlin

default hls_on_error to continue. 2.0.201

@@ -337,6 +337,7 @@ Remark: @@ -337,6 +337,7 @@ Remark:
337 337
338 ## History 338 ## History
339 339
  340 +* v2.0, 2015-12-15, default hls_on_error to continue. 2.0.201
340 * v2.0, 2015-11-16, for [#518][bug #518] fix fd leak bug when fork. 2.0.200 341 * v2.0, 2015-11-16, for [#518][bug #518] fix fd leak bug when fork. 2.0.200
341 * v2.0, 2015-11-05, for [#511][bug #511] fix bug for restart thread. 2.0.199 342 * v2.0, 2015-11-05, for [#511][bug #511] fix bug for restart thread. 2.0.199
342 * v2.0, 2015-11-02, for [#515][bug #515] use srs_freepa and SrsAutoFreeA for array. 2.0.198 343 * v2.0, 2015-11-02, for [#515][bug #515] use srs_freepa and SrsAutoFreeA for array. 2.0.198
@@ -539,12 +539,12 @@ vhost with-hls.srs.com { @@ -539,12 +539,12 @@ vhost with-hls.srs.com {
539 # default: 60 539 # default: 60
540 hls_window 60; 540 hls_window 60;
541 # the error strategy. canbe: 541 # the error strategy. canbe:
542 - # ignore, when error ignore and disable hls.  
543 - # disconnect, when error disconnect the publish connection.  
544 - # continue, when error ignore and continue output hls. 542 + # ignore, disable the hls.
  543 + # disconnect, require encoder republish.
  544 + # continue, ignore failed try to continue output hls.
545 # @see https://github.com/ossrs/srs/issues/264 545 # @see https://github.com/ossrs/srs/issues/264
546 - # default: ignore  
547 - hls_on_error ignore; 546 + # default: continue
  547 + hls_on_error continue;
548 # the hls storage: disk, ram or both. 548 # the hls storage: disk, ram or both.
549 # disk, to write hls m3u8/ts to disk. 549 # disk, to write hls m3u8/ts to disk.
550 # ram, serve m3u8/ts in memory, which use embeded http server to delivery. 550 # ram, serve m3u8/ts in memory, which use embeded http server to delivery.
@@ -75,7 +75,7 @@ using namespace _srs_internal; @@ -75,7 +75,7 @@ using namespace _srs_internal;
75 #define SRS_CONF_DEFAULT_HLS_TD_RATIO 1.5 75 #define SRS_CONF_DEFAULT_HLS_TD_RATIO 1.5
76 #define SRS_CONF_DEFAULT_HLS_AOF_RATIO 2.0 76 #define SRS_CONF_DEFAULT_HLS_AOF_RATIO 2.0
77 #define SRS_CONF_DEFAULT_HLS_WINDOW 60 77 #define SRS_CONF_DEFAULT_HLS_WINDOW 60
78 -#define SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE "ignore" 78 +#define SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE "continue"
79 #define SRS_CONF_DEFAULT_HLS_ON_ERROR_DISCONNECT "disconnect" 79 #define SRS_CONF_DEFAULT_HLS_ON_ERROR_DISCONNECT "disconnect"
80 #define SRS_CONF_DEFAULT_HLS_ON_ERROR_CONTINUE "continue" 80 #define SRS_CONF_DEFAULT_HLS_ON_ERROR_CONTINUE "continue"
81 #define SRS_CONF_DEFAULT_HLS_ON_ERROR SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE 81 #define SRS_CONF_DEFAULT_HLS_ON_ERROR SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE
@@ -1763,6 +1763,23 @@ int SrsSource::on_video(SrsCommonMessage* shared_video) @@ -1763,6 +1763,23 @@ int SrsSource::on_video(SrsCommonMessage* shared_video)
1763 return ret; 1763 return ret;
1764 } 1764 }
1765 1765
  1766 +bool srs_hls_can_continue(int ret, SrsSharedPtrMessage* sh, SrsSharedPtrMessage* video)
  1767 +{
  1768 + // only continue for decode error.
  1769 + if (ret != ERROR_HLS_DECODE_ERROR) {
  1770 + return false;
  1771 + }
  1772 +
  1773 + // when video size equals to sequence header,
  1774 + // the video actually maybe a sequence header,
  1775 + // continue to make ffmpeg happy.
  1776 + if (sh && sh->size == video->size) {
  1777 + return true;
  1778 + }
  1779 +
  1780 + return false;
  1781 +}
  1782 +
1766 int SrsSource::on_video_imp(SrsSharedPtrMessage* msg) 1783 int SrsSource::on_video_imp(SrsSharedPtrMessage* msg)
1767 { 1784 {
1768 int ret = ERROR_SUCCESS; 1785 int ret = ERROR_SUCCESS;
@@ -1827,7 +1844,7 @@ int SrsSource::on_video_imp(SrsSharedPtrMessage* msg) @@ -1827,7 +1844,7 @@ int SrsSource::on_video_imp(SrsSharedPtrMessage* msg)
1827 ret = ERROR_SUCCESS; 1844 ret = ERROR_SUCCESS;
1828 } else if (srs_config_hls_is_on_error_continue(hls_error_strategy)) { 1845 } else if (srs_config_hls_is_on_error_continue(hls_error_strategy)) {
1829 // compare the sequence header with video, continue when it's actually an sequence header. 1846 // compare the sequence header with video, continue when it's actually an sequence header.
1830 - if (ret == ERROR_HLS_DECODE_ERROR && cache_sh_video && cache_sh_video->size == msg->size) { 1847 + if (srs_hls_can_continue(ret, cache_sh_video, msg)) {
1831 srs_warn("the video is actually a sequence header, ignore this packet."); 1848 srs_warn("the video is actually a sequence header, ignore this packet.");
1832 ret = ERROR_SUCCESS; 1849 ret = ERROR_SUCCESS;
1833 } else { 1850 } else {
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR 2 32 #define VERSION_MAJOR 2
33 #define VERSION_MINOR 0 33 #define VERSION_MINOR 0
34 -#define VERSION_REVISION 200 34 +#define VERSION_REVISION 201
35 35
36 // server info. 36 // server info.
37 #define RTMP_SIG_SRS_KEY "SRS" 37 #define RTMP_SIG_SRS_KEY "SRS"