winlin

refine the hls error log.

@@ -1548,6 +1548,24 @@ int SrsSource::on_audio(SrsCommonMessage* shared_audio) @@ -1548,6 +1548,24 @@ int SrsSource::on_audio(SrsCommonMessage* shared_audio)
1548 return ret; 1548 return ret;
1549 } 1549 }
1550 1550
  1551 +bool srs_hls_can_continue(int ret, SrsSharedPtrMessage* sh, SrsSharedPtrMessage* msg)
  1552 +{
  1553 + // only continue for decode error.
  1554 + if (ret != ERROR_HLS_DECODE_ERROR) {
  1555 + return false;
  1556 + }
  1557 +
  1558 + // when video size equals to sequence header,
  1559 + // the video actually maybe a sequence header,
  1560 + // continue to make ffmpeg happy.
  1561 + if (sh && sh->size == msg->size) {
  1562 + srs_warn("the msg is actually a sequence header, ignore this packet.");
  1563 + return true;
  1564 + }
  1565 +
  1566 + return false;
  1567 +}
  1568 +
1551 int SrsSource::on_audio_imp(SrsSharedPtrMessage* msg) 1569 int SrsSource::on_audio_imp(SrsSharedPtrMessage* msg)
1552 { 1570 {
1553 int ret = ERROR_SUCCESS; 1571 int ret = ERROR_SUCCESS;
@@ -1608,9 +1626,7 @@ int SrsSource::on_audio_imp(SrsSharedPtrMessage* msg) @@ -1608,9 +1626,7 @@ int SrsSource::on_audio_imp(SrsSharedPtrMessage* msg)
1608 // ignore. 1626 // ignore.
1609 ret = ERROR_SUCCESS; 1627 ret = ERROR_SUCCESS;
1610 } else if (srs_config_hls_is_on_error_continue(hls_error_strategy)) { 1628 } else if (srs_config_hls_is_on_error_continue(hls_error_strategy)) {
1611 - // compare the sequence header with audio, continue when it's actually an sequence header.  
1612 - if (ret == ERROR_HLS_DECODE_ERROR && cache_sh_audio && cache_sh_audio->size == msg->size) {  
1613 - srs_warn("the audio is actually a sequence header, ignore this packet."); 1629 + if (srs_hls_can_continue(ret, cache_sh_audio, msg)) {
1614 ret = ERROR_SUCCESS; 1630 ret = ERROR_SUCCESS;
1615 } else { 1631 } else {
1616 srs_warn("hls continue audio failed. ret=%d", ret); 1632 srs_warn("hls continue audio failed. ret=%d", ret);
@@ -1763,23 +1779,6 @@ int SrsSource::on_video(SrsCommonMessage* shared_video) @@ -1763,23 +1779,6 @@ int SrsSource::on_video(SrsCommonMessage* shared_video)
1763 return ret; 1779 return ret;
1764 } 1780 }
1765 1781
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 -  
1783 int SrsSource::on_video_imp(SrsSharedPtrMessage* msg) 1782 int SrsSource::on_video_imp(SrsSharedPtrMessage* msg)
1784 { 1783 {
1785 int ret = ERROR_SUCCESS; 1784 int ret = ERROR_SUCCESS;
@@ -1843,9 +1842,7 @@ int SrsSource::on_video_imp(SrsSharedPtrMessage* msg) @@ -1843,9 +1842,7 @@ int SrsSource::on_video_imp(SrsSharedPtrMessage* msg)
1843 // ignore. 1842 // ignore.
1844 ret = ERROR_SUCCESS; 1843 ret = ERROR_SUCCESS;
1845 } else if (srs_config_hls_is_on_error_continue(hls_error_strategy)) { 1844 } else if (srs_config_hls_is_on_error_continue(hls_error_strategy)) {
1846 - // compare the sequence header with video, continue when it's actually an sequence header.  
1847 if (srs_hls_can_continue(ret, cache_sh_video, msg)) { 1845 if (srs_hls_can_continue(ret, cache_sh_video, msg)) {
1848 - srs_warn("the video is actually a sequence header, ignore this packet.");  
1849 ret = ERROR_SUCCESS; 1846 ret = ERROR_SUCCESS;
1850 } else { 1847 } else {
1851 srs_warn("hls continue video failed. ret=%d", ret); 1848 srs_warn("hls continue video failed. ret=%d", ret);