1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-15 04:42:04 +00:00

ensure the HLS(ts) is continous when republish stream.

This commit is contained in:
winlin 2013-12-15 20:36:59 +08:00
parent e262147e81
commit 9080c2e559
4 changed files with 21 additions and 4 deletions

View file

@ -212,6 +212,7 @@ usr sys idl wai hiq siq| read writ| recv send| in out | int csw
* nginx v1.5.0: 139524 lines <br/> * nginx v1.5.0: 139524 lines <br/>
### History ### 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, 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, 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. * v0.9, 2013-12-15, support set the live queue length(in seconds), drop when full.

View file

@ -1332,12 +1332,12 @@ int SrsHls::on_video(SrsSharedPtrMessage* video)
return ret; return ret;
} }
_mpegts(); hls_mux();
return ret; return ret;
} }
void SrsHls::_mpegts() void SrsHls::hls_mux()
{ {
// reportable // reportable
if (pithy_print->can_print()) { if (pithy_print->can_print()) {

View file

@ -217,13 +217,30 @@ public:
SrsHls(SrsSource* _source); SrsHls(SrsSource* _source);
virtual ~SrsHls(); virtual ~SrsHls();
public: public:
/**
* publish stream event, continue to write the m3u8,
* for the muxer object not destroyed.
*/
virtual int on_publish(SrsRequest* req); 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(); virtual void on_unpublish();
/**
* get some information from metadata, it's optinal.
*/
virtual int on_meta_data(SrsAmf0Object* metadata); virtual int on_meta_data(SrsAmf0Object* metadata);
/**
* mux the audio packets to ts.
*/
virtual int on_audio(SrsSharedPtrMessage* audio); virtual int on_audio(SrsSharedPtrMessage* audio);
/**
* mux the video packets to ts.
*/
virtual int on_video(SrsSharedPtrMessage* video); virtual int on_video(SrsSharedPtrMessage* video);
private: private:
virtual void _mpegts(); virtual void hls_mux();
}; };
#endif #endif

View file

@ -546,7 +546,6 @@ int SrsSource::on_reload_hls(string vhost)
return ret; return ret;
} }
// TODO: HLS should continue previous sequence and stream.
#ifdef SRS_HLS #ifdef SRS_HLS
hls->on_unpublish(); hls->on_unpublish();
if ((ret = hls->on_publish(req)) != ERROR_SUCCESS) { if ((ret = hls->on_publish(req)) != ERROR_SUCCESS) {