Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Feb 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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