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

support ingest reload: add new vhost with ingester

This commit is contained in:
winlin 2014-04-10 10:09:30 +08:00
parent e5646e3bb5
commit dc71eef394
5 changed files with 59 additions and 7 deletions

View file

@ -51,13 +51,16 @@ SrsIngesterFFMPEG::~SrsIngesterFFMPEG()
SrsIngester::SrsIngester()
{
// TODO: FIXME: support reload.
_srs_config->subscribe(this);
pthread = new SrsThread(this, SRS_INGESTER_SLEEP_US);
pithy_print = new SrsPithyPrint(SRS_STAGE_INGESTER);
}
SrsIngester::~SrsIngester()
{
_srs_config->unsubscribe(this);
srs_freep(pthread);
clear_engines();
}
@ -72,10 +75,8 @@ int SrsIngester::start()
return ret;
}
// return for error or no engine.
if (ingesters.empty()) {
return ret;
}
// even no ingesters, we must also start it,
// for the reload may add more ingesters.
// start thread to run all encoding engines.
if ((ret = pthread->start()) != ERROR_SUCCESS) {
@ -353,4 +354,16 @@ void SrsIngester::ingester()
}
}
int SrsIngester::on_reload_vhost_added(string vhost)
{
int ret = ERROR_SUCCESS;
SrsConfDirective* _vhost = _srs_config->get_vhost(vhost);
if ((ret = parse_ingesters(_vhost)) != ERROR_SUCCESS) {
return ret;
}
return ret;
}
#endif