winlin

merge from 1.0release for #264, ignore the video NALU which is actually a sequen…

…ce header to make HLS happy. 2.0.75
@@ -332,6 +332,7 @@ vhost with-hls.srs.com { @@ -332,6 +332,7 @@ vhost with-hls.srs.com {
332 # the error strategy. canbe: 332 # the error strategy. canbe:
333 # ignore, when error ignore and disable hls. 333 # ignore, when error ignore and disable hls.
334 # disconnect, when error disconnect the publish connection. 334 # disconnect, when error disconnect the publish connection.
  335 + # continue, when error ignore and continue output hls.
335 # @see https://github.com/winlinvip/simple-rtmp-server/issues/264 336 # @see https://github.com/winlinvip/simple-rtmp-server/issues/264
336 # default: ignore 337 # default: ignore
337 hls_on_error ignore; 338 hls_on_error ignore;
@@ -50,6 +50,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -50,6 +50,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
50 #define SRS_CONF_DEFAULT_HLS_WINDOW 60 50 #define SRS_CONF_DEFAULT_HLS_WINDOW 60
51 #define SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE "ignore" 51 #define SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE "ignore"
52 #define SRS_CONF_DEFAULT_HLS_ON_ERROR_DISCONNECT "disconnect" 52 #define SRS_CONF_DEFAULT_HLS_ON_ERROR_DISCONNECT "disconnect"
  53 +#define SRS_CONF_DEFAULT_HLS_ON_ERROR_CONTINUE "continue"
53 #define SRS_CONF_DEFAULT_HLS_ON_ERROR SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE 54 #define SRS_CONF_DEFAULT_HLS_ON_ERROR SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE
54 #define SRS_CONF_DEFAULT_DVR_PATH "./objs/nginx/html" 55 #define SRS_CONF_DEFAULT_DVR_PATH "./objs/nginx/html"
55 #define SRS_CONF_DEFAULT_DVR_PLAN_SESSION "session" 56 #define SRS_CONF_DEFAULT_DVR_PLAN_SESSION "session"
@@ -1251,6 +1251,15 @@ int SrsSource::on_audio(SrsCommonMessage* __audio) @@ -1251,6 +1251,15 @@ int SrsSource::on_audio(SrsCommonMessage* __audio)
1251 1251
1252 // ignore. 1252 // ignore.
1253 ret = ERROR_SUCCESS; 1253 ret = ERROR_SUCCESS;
  1254 + } else if (hls_error_strategy == SRS_CONF_DEFAULT_HLS_ON_ERROR_CONTINUE) {
  1255 + // compare the sequence header with audio, continue when it's actually an sequence header.
  1256 + if (ret == ERROR_HLS_DECODE_ERROR && cache_sh_audio && cache_sh_audio->size == msg.size) {
  1257 + srs_warn("the audio is actually a sequence header, ignore this packet.");
  1258 + ret = ERROR_SUCCESS;
  1259 + } else {
  1260 + srs_warn("hls continue audio failed. ret=%d", ret);
  1261 + return ret;
  1262 + }
1254 } else { 1263 } else {
1255 srs_warn("hls disconnect publisher for audio error. ret=%d", ret); 1264 srs_warn("hls disconnect publisher for audio error. ret=%d", ret);
1256 return ret; 1265 return ret;
@@ -1369,6 +1378,15 @@ int SrsSource::on_video(SrsCommonMessage* __video) @@ -1369,6 +1378,15 @@ int SrsSource::on_video(SrsCommonMessage* __video)
1369 1378
1370 // ignore. 1379 // ignore.
1371 ret = ERROR_SUCCESS; 1380 ret = ERROR_SUCCESS;
  1381 + } else if (hls_error_strategy == SRS_CONF_DEFAULT_HLS_ON_ERROR_CONTINUE) {
  1382 + // compare the sequence header with video, continue when it's actually an sequence header.
  1383 + if (ret == ERROR_HLS_DECODE_ERROR && cache_sh_video && cache_sh_video->size == msg.size) {
  1384 + srs_warn("the video is actually a sequence header, ignore this packet.");
  1385 + ret = ERROR_SUCCESS;
  1386 + } else {
  1387 + srs_warn("hls continue video failed. ret=%d", ret);
  1388 + return ret;
  1389 + }
1372 } else { 1390 } else {
1373 srs_warn("hls disconnect publisher for video error. ret=%d", ret); 1391 srs_warn("hls disconnect publisher for video error. ret=%d", ret);
1374 return ret; 1392 return ret;
@@ -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 74 34 +#define VERSION_REVISION 75
35 // server info. 35 // server info.
36 #define RTMP_SIG_SRS_KEY "SRS" 36 #define RTMP_SIG_SRS_KEY "SRS"
37 #define RTMP_SIG_SRS_ROLE "origin/edge server" 37 #define RTMP_SIG_SRS_ROLE "origin/edge server"