From 4f5cc9c403aedd836fb1ef40220afff9bce03841 Mon Sep 17 00:00:00 2001 From: winlin Date: Fri, 23 Jan 2015 15:14:29 +0800 Subject: [PATCH] for #151, use absolutely overflow to make jwplayer happy. 1.0.23 --- README.md | 1 + trunk/src/app/srs_app_hls.cpp | 11 +++++++++-- trunk/src/app/srs_app_hls.hpp | 10 ++++++++-- trunk/src/core/srs_core.hpp | 2 +- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 11be6d538..dc64a5014 100755 --- a/README.md +++ b/README.md @@ -385,6 +385,7 @@ Supported operating systems and hardware: ## History +* v1.0, 2015-01-23, hotfix [#151](https://github.com/winlinvip/simple-rtmp-server/issues/151), use absolutely overflow to make jwplayer happy. 1.0.23 * v1.0, 2015-01-17, hotfix [#290](https://github.com/winlinvip/simple-rtmp-server/issues/290), use iformat only for rtmp input. 1.0.22 * v1.0, 2015-01-15, [1.0r1 release(1.0.21)](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0r1) released. 59472 lines. * v1.0, 2015-01-08, hotfix [#281](https://github.com/winlinvip/simple-rtmp-server/issues/281), fix hls bug ignore type-9 send aud. 1.0.20 diff --git a/trunk/src/app/srs_app_hls.cpp b/trunk/src/app/srs_app_hls.cpp index af294ddb2..7fe9a1c15 100644 --- a/trunk/src/app/srs_app_hls.cpp +++ b/trunk/src/app/srs_app_hls.cpp @@ -655,10 +655,15 @@ int SrsHlsMuxer::on_sequence_header() bool SrsHlsMuxer::is_segment_overflow() { srs_assert(current); - return current->duration >= hls_fragment; } +bool SrsHlsMuxer::is_segment_absolutely_overflow() +{ + srs_assert(current); + return current->duration >= 2 * hls_fragment; +} + int SrsHlsMuxer::flush_audio(SrsMpegtsFrame* af, SrsBuffer* ab) { int ret = ERROR_SUCCESS; @@ -1090,7 +1095,9 @@ int SrsHlsCache::write_audio(SrsAvcAacCodec* codec, SrsHlsMuxer* muxer, int64_t // pure audio again for audio disabled. // so we reap event when the audio incoming when segment overflow. // @see https://github.com/winlinvip/simple-rtmp-server/issues/151 - if (muxer->is_segment_overflow()) { + // we use absolutely overflow of segment to make jwplayer/ffplay happy + // @see https://github.com/winlinvip/simple-rtmp-server/issues/151#issuecomment-71155184 + if (muxer->is_segment_absolutely_overflow()) { if ((ret = reap_segment("audio", muxer, af->pts)) != ERROR_SUCCESS) { return ret; } diff --git a/trunk/src/app/srs_app_hls.hpp b/trunk/src/app/srs_app_hls.hpp index d31820367..fff25c90b 100644 --- a/trunk/src/app/srs_app_hls.hpp +++ b/trunk/src/app/srs_app_hls.hpp @@ -192,10 +192,16 @@ public: virtual int segment_open(int64_t segment_start_dts); virtual int on_sequence_header(); /** - * whether video overflow, - * that is whether the current segment duration >= the segment in config + * whether segment overflow, + * that is whether the current segment duration>=(the segment in config) */ virtual bool is_segment_overflow(); + /** + * whether segment absolutely overflow, for pure audio to reap segment, + * that is whether the current segment duration>=2*(the segment in config) + * @see https://github.com/winlinvip/simple-rtmp-server/issues/151#issuecomment-71155184 + */ + virtual bool is_segment_absolutely_overflow(); virtual int flush_audio(SrsMpegtsFrame* af, SrsBuffer* ab); virtual int flush_video(SrsMpegtsFrame* af, SrsBuffer* ab, SrsMpegtsFrame* vf, SrsBuffer* vb); /** diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index a6797e1a9..d3745e539 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // current release version #define VERSION_MAJOR 1 #define VERSION_MINOR 0 -#define VERSION_REVISION 22 +#define VERSION_REVISION 23 // server info. #define RTMP_SIG_SRS_KEY "SRS" #define RTMP_SIG_SRS_ROLE "origin/edge server"