From 9080c2e559279dbd4f4c1849da913155c26680be Mon Sep 17 00:00:00 2001 From: winlin Date: Sun, 15 Dec 2013 20:36:59 +0800 Subject: [PATCH] ensure the HLS(ts) is continous when republish stream. --- README.md | 1 + trunk/src/core/srs_core_hls.cpp | 4 ++-- trunk/src/core/srs_core_hls.hpp | 19 ++++++++++++++++++- trunk/src/core/srs_core_source.cpp | 1 - 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index dde6d578c..8740f1cf7 100755 --- a/README.md +++ b/README.md @@ -212,6 +212,7 @@ usr sys idl wai hiq siq| read writ| recv send| in out | int csw * nginx v1.5.0: 139524 lines
### History +* v0.9, 2013-12-15, ensure the HLS(ts) is continous when republish stream. * v0.9, 2013-12-15, fix the hls reload bug, feed it the sequence header. * v0.9, 2013-12-15, refine protocol, use int64_t timestamp for ts and jitter. * v0.9, 2013-12-15, support set the live queue length(in seconds), drop when full. diff --git a/trunk/src/core/srs_core_hls.cpp b/trunk/src/core/srs_core_hls.cpp index 706fd0081..b7182cad5 100644 --- a/trunk/src/core/srs_core_hls.cpp +++ b/trunk/src/core/srs_core_hls.cpp @@ -1332,12 +1332,12 @@ int SrsHls::on_video(SrsSharedPtrMessage* video) return ret; } - _mpegts(); + hls_mux(); return ret; } -void SrsHls::_mpegts() +void SrsHls::hls_mux() { // reportable if (pithy_print->can_print()) { diff --git a/trunk/src/core/srs_core_hls.hpp b/trunk/src/core/srs_core_hls.hpp index 7bc49ade9..9474909f3 100644 --- a/trunk/src/core/srs_core_hls.hpp +++ b/trunk/src/core/srs_core_hls.hpp @@ -217,13 +217,30 @@ public: SrsHls(SrsSource* _source); virtual ~SrsHls(); public: + /** + * publish stream event, continue to write the m3u8, + * for the muxer object not destroyed. + */ virtual int on_publish(SrsRequest* req); + /** + * the unpublish event, only close the muxer, donot destroy the + * muxer, for when we continue to publish, the m3u8 will continue. + */ virtual void on_unpublish(); + /** + * get some information from metadata, it's optinal. + */ virtual int on_meta_data(SrsAmf0Object* metadata); + /** + * mux the audio packets to ts. + */ virtual int on_audio(SrsSharedPtrMessage* audio); + /** + * mux the video packets to ts. + */ virtual int on_video(SrsSharedPtrMessage* video); private: - virtual void _mpegts(); + virtual void hls_mux(); }; #endif diff --git a/trunk/src/core/srs_core_source.cpp b/trunk/src/core/srs_core_source.cpp index 0143fed2c..5cca79543 100644 --- a/trunk/src/core/srs_core_source.cpp +++ b/trunk/src/core/srs_core_source.cpp @@ -546,7 +546,6 @@ int SrsSource::on_reload_hls(string vhost) return ret; } - // TODO: HLS should continue previous sequence and stream. #ifdef SRS_HLS hls->on_unpublish(); if ((ret = hls->on_publish(req)) != ERROR_SUCCESS) {