Skip to content

Commit

Permalink
use hls->initialize to set req of hls (#1077)
Browse files Browse the repository at this point in the history
  • Loading branch information
RocFang authored and winlinvip committed Feb 28, 2018
1 parent 1721e4e commit fd016ed
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions trunk/src/app/srs_app_hls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion trunk/src/app/srs_app_hls.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ class SrsHls
/**
* 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.
Expand Down
3 changes: 1 addition & 2 deletions trunk/src/app/srs_app_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit fd016ed

Please sign in to comment.