1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

use hls->initialize to set req of hls (#1077)

This commit is contained in:
RocFang 2018-02-28 13:35:33 +08:00 committed by winlin
parent 1721e4ea4b
commit fd016ed91a
3 changed files with 6 additions and 7 deletions

View file

@ -1205,10 +1205,13 @@ int SrsHls::cycle()
return ret; return ret;
} }
int SrsHls::initialize(SrsSource* s) int SrsHls::initialize(SrsSource* s, SrsRequest* r)
{ {
int ret = ERROR_SUCCESS; int ret = ERROR_SUCCESS;
srs_assert(!_req);
_req = r->copy();
source = s; source = s;
if ((ret = muxer->initialize()) != ERROR_SUCCESS) { if ((ret = muxer->initialize()) != ERROR_SUCCESS) {
@ -1222,9 +1225,6 @@ int SrsHls::on_publish(SrsRequest* req, bool fetch_sequence_header)
{ {
int ret = ERROR_SUCCESS; int ret = ERROR_SUCCESS;
srs_freep(_req);
_req = req->copy();
// update the hls time, for hls_dispose. // update the hls time, for hls_dispose.
last_update_time = srs_get_system_time_ms(); last_update_time = srs_get_system_time_ms();

View file

@ -391,7 +391,7 @@ public:
/** /**
* initialize the hls by handler and source. * initialize the hls by handler and source.
*/ */
virtual int initialize(SrsSource* s); virtual int initialize(SrsSource* s, SrsRequest* r);
/** /**
* publish stream event, continue to write the m3u8, * publish stream event, continue to write the m3u8,
* for the muxer object not destroyed. * for the muxer object not destroyed.

View file

@ -1080,7 +1080,7 @@ int SrsSource::initialize(SrsRequest* r, ISrsSourceHandler* h)
atc = _srs_config->get_atc(_req->vhost); atc = _srs_config->get_atc(_req->vhost);
#ifdef SRS_AUTO_HLS #ifdef SRS_AUTO_HLS
if ((ret = hls->initialize(this)) != ERROR_SUCCESS) { if ((ret = hls->initialize(this, _req)) != ERROR_SUCCESS) {
return ret; return ret;
} }
#endif #endif
@ -2175,7 +2175,6 @@ int SrsSource::on_publish()
} }
#endif #endif
// TODO: FIXME: use initialize to set req.
#ifdef SRS_AUTO_HLS #ifdef SRS_AUTO_HLS
if ((ret = hls->on_publish(_req, false)) != ERROR_SUCCESS) { if ((ret = hls->on_publish(_req, false)) != ERROR_SUCCESS) {
srs_error("start hls failed. ret=%d", ret); srs_error("start hls failed. ret=%d", ret);