winlin

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

@@ -212,6 +212,7 @@ usr sys idl wai hiq siq| read writ| recv send| in out | int csw @@ -212,6 +212,7 @@ usr sys idl wai hiq siq| read writ| recv send| in out | int csw
212 * nginx v1.5.0: 139524 lines <br/> 212 * nginx v1.5.0: 139524 lines <br/>
213 213
214 ### History 214 ### History
  215 +* v0.9, 2013-12-15, ensure the HLS(ts) is continous when republish stream.
215 * v0.9, 2013-12-15, fix the hls reload bug, feed it the sequence header. 216 * v0.9, 2013-12-15, fix the hls reload bug, feed it the sequence header.
216 * v0.9, 2013-12-15, refine protocol, use int64_t timestamp for ts and jitter. 217 * v0.9, 2013-12-15, refine protocol, use int64_t timestamp for ts and jitter.
217 * v0.9, 2013-12-15, support set the live queue length(in seconds), drop when full. 218 * v0.9, 2013-12-15, support set the live queue length(in seconds), drop when full.
@@ -1332,12 +1332,12 @@ int SrsHls::on_video(SrsSharedPtrMessage* video) @@ -1332,12 +1332,12 @@ int SrsHls::on_video(SrsSharedPtrMessage* video)
1332 return ret; 1332 return ret;
1333 } 1333 }
1334 1334
1335 - _mpegts(); 1335 + hls_mux();
1336 1336
1337 return ret; 1337 return ret;
1338 } 1338 }
1339 1339
1340 -void SrsHls::_mpegts() 1340 +void SrsHls::hls_mux()
1341 { 1341 {
1342 // reportable 1342 // reportable
1343 if (pithy_print->can_print()) { 1343 if (pithy_print->can_print()) {
@@ -217,13 +217,30 @@ public: @@ -217,13 +217,30 @@ public:
217 SrsHls(SrsSource* _source); 217 SrsHls(SrsSource* _source);
218 virtual ~SrsHls(); 218 virtual ~SrsHls();
219 public: 219 public:
  220 + /**
  221 + * publish stream event, continue to write the m3u8,
  222 + * for the muxer object not destroyed.
  223 + */
220 virtual int on_publish(SrsRequest* req); 224 virtual int on_publish(SrsRequest* req);
  225 + /**
  226 + * the unpublish event, only close the muxer, donot destroy the
  227 + * muxer, for when we continue to publish, the m3u8 will continue.
  228 + */
221 virtual void on_unpublish(); 229 virtual void on_unpublish();
  230 + /**
  231 + * get some information from metadata, it's optinal.
  232 + */
222 virtual int on_meta_data(SrsAmf0Object* metadata); 233 virtual int on_meta_data(SrsAmf0Object* metadata);
  234 + /**
  235 + * mux the audio packets to ts.
  236 + */
223 virtual int on_audio(SrsSharedPtrMessage* audio); 237 virtual int on_audio(SrsSharedPtrMessage* audio);
  238 + /**
  239 + * mux the video packets to ts.
  240 + */
224 virtual int on_video(SrsSharedPtrMessage* video); 241 virtual int on_video(SrsSharedPtrMessage* video);
225 private: 242 private:
226 - virtual void _mpegts(); 243 + virtual void hls_mux();
227 }; 244 };
228 245
229 #endif 246 #endif
@@ -546,7 +546,6 @@ int SrsSource::on_reload_hls(string vhost) @@ -546,7 +546,6 @@ int SrsSource::on_reload_hls(string vhost)
546 return ret; 546 return ret;
547 } 547 }
548 548
549 - // TODO: HLS should continue previous sequence and stream.  
550 #ifdef SRS_HLS 549 #ifdef SRS_HLS
551 hls->on_unpublish(); 550 hls->on_unpublish();
552 if ((ret = hls->on_publish(req)) != ERROR_SUCCESS) { 551 if ((ret = hls->on_publish(req)) != ERROR_SUCCESS) {