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

pull/1146/head
RocFang 7 years ago committed by winlin
parent 1721e4ea4b
commit fd016ed91a

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

@ -391,7 +391,7 @@ public:
/**
* 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,
* for the muxer object not destroyed.

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

Loading…
Cancel
Save