1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-24 06:54:22 +00:00
srs/trunk/src/app/srs_app_ingest.cpp

571 lines
16 KiB
C++
Raw Normal View History

2017-03-25 09:21:39 +00:00
/**
* The MIT License (MIT)
*
2019-01-01 13:37:28 +00:00
* Copyright (c) 2013-2019 Winlin
2017-03-25 09:21:39 +00:00
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
2014-04-07 00:32:28 +00:00
#include <srs_app_ingest.hpp>
2015-06-06 12:34:49 +00:00
#include <stdlib.h>
using namespace std;
2014-04-07 01:07:12 +00:00
#include <srs_kernel_error.hpp>
2014-04-07 05:13:57 +00:00
#include <srs_app_config.hpp>
#include <srs_kernel_log.hpp>
#include <srs_app_ffmpeg.hpp>
2014-04-07 06:20:03 +00:00
#include <srs_app_pithy_print.hpp>
#include <srs_kernel_utility.hpp>
#include <srs_app_utility.hpp>
2015-10-13 08:06:37 +00:00
#include <srs_protocol_utility.hpp>
2014-04-07 01:07:12 +00:00
2015-06-06 10:57:41 +00:00
SrsIngesterFFMPEG::SrsIngesterFFMPEG()
{
2015-06-06 10:57:41 +00:00
ffmpeg = NULL;
}
SrsIngesterFFMPEG::~SrsIngesterFFMPEG()
{
srs_freep(ffmpeg);
}
2018-01-01 11:39:57 +00:00
srs_error_t SrsIngesterFFMPEG::initialize(SrsFFMPEG* ff, string v, string i)
2015-06-06 10:57:41 +00:00
{
2018-01-01 11:39:57 +00:00
srs_error_t err = srs_success;
2015-06-06 10:57:41 +00:00
ffmpeg = ff;
vhost = v;
id = i;
starttime = srs_get_system_time_ms();
2018-01-01 11:39:57 +00:00
return err;
2015-06-06 10:57:41 +00:00
}
string SrsIngesterFFMPEG::uri()
{
return vhost + "/" + id;
}
int SrsIngesterFFMPEG::alive()
{
return (int)(srs_get_system_time_ms() - starttime);
}
bool SrsIngesterFFMPEG::equals(string v)
{
return vhost == v;
}
bool SrsIngesterFFMPEG::equals(string v, string i)
{
return vhost == v && id == i;
}
2018-01-01 11:39:57 +00:00
srs_error_t SrsIngesterFFMPEG::start()
2015-06-06 10:57:41 +00:00
{
return ffmpeg->start();
}
void SrsIngesterFFMPEG::stop()
{
ffmpeg->stop();
}
2018-01-01 11:39:57 +00:00
srs_error_t SrsIngesterFFMPEG::cycle()
2015-06-06 10:57:41 +00:00
{
return ffmpeg->cycle();
}
void SrsIngesterFFMPEG::fast_stop()
{
ffmpeg->fast_stop();
}
2014-04-07 01:07:12 +00:00
SrsIngester::SrsIngester()
{
_srs_config->subscribe(this);
expired = false;
trd = new SrsDummyCoroutine();
pprint = SrsPithyPrint::create_ingester();
2014-04-07 01:07:12 +00:00
}
SrsIngester::~SrsIngester()
{
_srs_config->unsubscribe(this);
srs_freep(trd);
2014-04-07 05:13:57 +00:00
clear_engines();
2014-04-07 01:07:12 +00:00
}
2015-09-01 10:41:30 +00:00
void SrsIngester::dispose()
{
// first, use fast stop to notice all FFMPEG to quit gracefully.
fast_stop();
// then, use stop to wait FFMPEG quit one by one and send SIGKILL if needed.
stop();
}
srs_error_t SrsIngester::start()
{
srs_error_t err = srs_success;
2014-04-07 05:13:57 +00:00
2018-01-01 11:39:57 +00:00
if ((err = parse()) != srs_success) {
2014-04-07 05:32:00 +00:00
clear_engines();
2018-01-01 11:39:57 +00:00
return srs_error_wrap(err, "parse");
2014-04-07 05:13:57 +00:00
}
// even no ingesters, we must also start it,
// for the reload may add more ingesters.
2014-04-07 06:20:03 +00:00
// start thread to run all encoding engines.
srs_freep(trd);
trd = new SrsSTCoroutine("ingest", this, _srs_context->get_id());
if ((err = trd->start()) != srs_success) {
return srs_error_wrap(err, "start coroutine");
2014-04-07 06:20:03 +00:00
}
return err;
2014-04-07 05:13:57 +00:00
}
2015-09-01 10:41:30 +00:00
void SrsIngester::stop()
2014-04-07 05:32:00 +00:00
{
trd->stop();
2015-09-01 10:41:30 +00:00
clear_engines();
}
void SrsIngester::fast_stop()
{
std::vector<SrsIngesterFFMPEG*>::iterator it;
for (it = ingesters.begin(); it != ingesters.end(); ++it) {
SrsIngesterFFMPEG* ingester = *it;
ingester->fast_stop();
}
if (!ingesters.empty()) {
srs_trace("fast stop all ingesters ok.");
}
}
// when error, ingester sleep for a while and retry.
// ingest never sleep a long time, for we must start the stream ASAP.
2019-04-07 08:25:52 +00:00
#define SRS_AUTO_INGESTER_CIMS (3000 * SRS_UTIME_MILLISECONDS)
srs_error_t SrsIngester::cycle()
2014-04-07 01:07:12 +00:00
{
srs_error_t err = srs_success;
2014-04-07 06:20:03 +00:00
while (true) {
if ((err = do_cycle()) != srs_success) {
srs_warn("Ingester: Ignore error, %s", srs_error_desc(err).c_str());
srs_freep(err);
}
if ((err = trd->pull()) != srs_success) {
return srs_error_wrap(err, "ingester");
}
2019-04-07 08:25:52 +00:00
srs_usleep(SRS_AUTO_INGESTER_CIMS);
}
return err;
}
srs_error_t SrsIngester::do_cycle()
{
srs_error_t err = srs_success;
// when expired, restart all ingesters.
if (expired) {
expired = false;
// stop current ingesters.
fast_stop();
clear_engines();
// re-prase the ingesters.
2018-01-01 11:39:57 +00:00
if ((err = parse()) != srs_success) {
return srs_error_wrap(err, "parse");
}
}
// cycle exists ingesters.
std::vector<SrsIngesterFFMPEG*>::iterator it;
for (it = ingesters.begin(); it != ingesters.end(); ++it) {
SrsIngesterFFMPEG* ingester = *it;
2014-04-07 06:20:03 +00:00
// start all ffmpegs.
2018-01-01 11:39:57 +00:00
if ((err = ingester->start()) != srs_success) {
return srs_error_wrap(err, "ingester start");
2014-04-07 06:20:03 +00:00
}
2017-03-25 09:21:39 +00:00
2014-04-07 06:20:03 +00:00
// check ffmpeg status.
2018-01-01 11:39:57 +00:00
if ((err = ingester->cycle()) != srs_success) {
return srs_error_wrap(err, "ingester cycle");
2014-04-07 06:20:03 +00:00
}
}
2017-03-25 09:21:39 +00:00
2014-04-07 06:20:03 +00:00
// pithy print
show_ingest_log_message();
2014-04-07 06:20:03 +00:00
return err;
2014-04-07 01:07:12 +00:00
}
2014-04-07 05:13:57 +00:00
void SrsIngester::clear_engines()
{
std::vector<SrsIngesterFFMPEG*>::iterator it;
2014-04-07 05:13:57 +00:00
for (it = ingesters.begin(); it != ingesters.end(); ++it) {
SrsIngesterFFMPEG* ingester = *it;
srs_freep(ingester);
2014-04-07 05:13:57 +00:00
}
2017-03-25 09:21:39 +00:00
ingesters.clear();
2014-04-07 05:13:57 +00:00
}
2018-01-01 11:39:57 +00:00
srs_error_t SrsIngester::parse()
2014-04-07 05:32:00 +00:00
{
2018-01-01 11:39:57 +00:00
srs_error_t err = srs_success;
2014-04-07 05:32:00 +00:00
// parse ingesters
std::vector<SrsConfDirective*> vhosts;
_srs_config->get_vhosts(vhosts);
2014-04-07 05:32:00 +00:00
for (int i = 0; i < (int)vhosts.size(); i++) {
SrsConfDirective* vhost = vhosts[i];
2018-01-01 11:39:57 +00:00
if ((err = parse_ingesters(vhost)) != srs_success) {
return srs_error_wrap(err, "parse ingesters");
2014-04-07 05:32:00 +00:00
}
}
2018-01-01 11:39:57 +00:00
return err;
2014-04-07 05:32:00 +00:00
}
2018-01-01 11:39:57 +00:00
srs_error_t SrsIngester::parse_ingesters(SrsConfDirective* vhost)
2015-09-01 10:41:30 +00:00
{
2018-01-01 11:39:57 +00:00
srs_error_t err = srs_success;
2015-09-01 10:41:30 +00:00
2016-01-11 05:11:14 +00:00
// when vhost disabled, ignore any ingesters.
if (!_srs_config->get_vhost_enabled(vhost)) {
2018-01-01 11:39:57 +00:00
return err;
2016-01-11 05:11:14 +00:00
}
2015-09-01 10:41:30 +00:00
std::vector<SrsConfDirective*> ingesters = _srs_config->get_ingesters(vhost->arg0());
// create engine
for (int i = 0; i < (int)ingesters.size(); i++) {
SrsConfDirective* ingest = ingesters[i];
2018-01-01 11:39:57 +00:00
if ((err = parse_engines(vhost, ingest)) != srs_success) {
return srs_error_wrap(err, "parse engines");
2015-09-01 10:41:30 +00:00
}
}
2018-01-01 11:39:57 +00:00
return err;
2015-09-01 10:41:30 +00:00
}
2018-01-01 11:39:57 +00:00
srs_error_t SrsIngester::parse_engines(SrsConfDirective* vhost, SrsConfDirective* ingest)
2015-09-01 10:41:30 +00:00
{
2018-01-01 11:39:57 +00:00
srs_error_t err = srs_success;
2015-09-01 10:41:30 +00:00
if (!_srs_config->get_ingest_enabled(ingest)) {
2018-01-01 11:39:57 +00:00
return err;
2015-09-01 10:41:30 +00:00
}
std::string ffmpeg_bin = _srs_config->get_ingest_ffmpeg(ingest);
if (ffmpeg_bin.empty()) {
2018-01-01 11:39:57 +00:00
return srs_error_new(ERROR_ENCODER_PARSE, "parse ffmpeg");
2015-09-01 10:41:30 +00:00
}
// get all engines.
std::vector<SrsConfDirective*> engines = _srs_config->get_transcode_engines(ingest);
// create ingesters without engines.
if (engines.empty()) {
SrsFFMPEG* ffmpeg = new SrsFFMPEG(ffmpeg_bin);
2018-01-01 11:39:57 +00:00
if ((err = initialize_ffmpeg(ffmpeg, vhost, ingest, NULL)) != srs_success) {
2015-09-01 10:41:30 +00:00
srs_freep(ffmpeg);
2018-01-01 11:39:57 +00:00
return srs_error_wrap(err, "init ffmpeg");
2015-09-01 10:41:30 +00:00
}
SrsIngesterFFMPEG* ingester = new SrsIngesterFFMPEG();
2018-01-01 11:39:57 +00:00
if ((err = ingester->initialize(ffmpeg, vhost->arg0(), ingest->arg0())) != srs_success) {
2015-09-01 10:41:30 +00:00
srs_freep(ingester);
2018-01-01 11:39:57 +00:00
return srs_error_wrap(err, "init ingester");
2015-09-01 10:41:30 +00:00
}
ingesters.push_back(ingester);
2018-01-01 11:39:57 +00:00
return err;
2015-09-01 10:41:30 +00:00
}
// create ingesters with engine
for (int i = 0; i < (int)engines.size(); i++) {
SrsConfDirective* engine = engines[i];
SrsFFMPEG* ffmpeg = new SrsFFMPEG(ffmpeg_bin);
2018-01-01 11:39:57 +00:00
if ((err = initialize_ffmpeg(ffmpeg, vhost, ingest, engine)) != srs_success) {
2015-09-01 10:41:30 +00:00
srs_freep(ffmpeg);
2018-01-01 11:39:57 +00:00
return srs_error_wrap(err, "init ffmpeg");
2015-09-01 10:41:30 +00:00
}
SrsIngesterFFMPEG* ingester = new SrsIngesterFFMPEG();
2018-01-01 11:39:57 +00:00
if ((err = ingester->initialize(ffmpeg, vhost->arg0(), ingest->arg0())) != srs_success) {
2015-09-01 10:41:30 +00:00
srs_freep(ingester);
2018-01-01 11:39:57 +00:00
return srs_error_wrap(err, "init ingester");
2015-09-01 10:41:30 +00:00
}
ingesters.push_back(ingester);
}
2018-01-01 11:39:57 +00:00
return err;
2015-09-01 10:41:30 +00:00
}
2018-01-01 11:39:57 +00:00
srs_error_t SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, SrsConfDirective* ingest, SrsConfDirective* engine)
2014-04-07 05:13:57 +00:00
{
2018-01-01 11:39:57 +00:00
srs_error_t err = srs_success;
2014-04-07 05:13:57 +00:00
2015-09-24 10:33:07 +00:00
int port;
if (true) {
std::vector<std::string> ip_ports = _srs_config->get_listens();
srs_assert(ip_ports.size() > 0);
std::string ip;
2015-09-24 10:33:07 +00:00
std::string ep = ip_ports[0];
srs_parse_endpoint(ep, ip, port);
}
2014-04-07 06:20:03 +00:00
std::string output = _srs_config->get_engine_output(engine);
// output stream, to other/self server
2014-07-20 05:04:48 +00:00
// ie. rtmp://localhost:1935/live/livestream_sd
2014-04-07 06:20:03 +00:00
output = srs_string_replace(output, "[vhost]", vhost->arg0());
2015-09-24 10:33:07 +00:00
output = srs_string_replace(output, "[port]", srs_int2str(port));
2014-04-07 06:20:03 +00:00
if (output.empty()) {
2018-01-01 11:39:57 +00:00
return srs_error_new(ERROR_ENCODER_NO_OUTPUT, "empty output url, ingest=%s", ingest->arg0().c_str());
2014-04-07 06:20:03 +00:00
}
// find the app and stream in rtmp url
std::string app, stream;
2015-11-02 05:37:44 +00:00
if (true) {
int port = SRS_CONSTS_RTMP_DEFAULT_PORT;
std::string tcUrl, schema, host, vhost2, param;
srs_parse_rtmp_url(output, tcUrl, stream);
srs_discovery_tc_url(tcUrl, schema, host, vhost2, app, stream, port, param);
2014-04-07 06:20:03 +00:00
}
2014-07-20 05:04:48 +00:00
std::string log_file = SRS_CONSTS_NULL_FILE; // disabled
2014-04-07 06:20:03 +00:00
// write ffmpeg info to log file.
if (_srs_config->get_ffmpeg_log_enabled()) {
log_file = _srs_config->get_ffmpeg_log_dir();
log_file += "/";
log_file += "ffmpeg-ingest";
log_file += "-";
log_file += vhost->arg0();
log_file += "-";
log_file += app;
log_file += "-";
log_file += stream;
log_file += ".log";
}
2014-04-07 06:20:03 +00:00
// input
std::string input_type = _srs_config->get_ingest_input_type(ingest);
if (input_type.empty()) {
2018-01-01 11:39:57 +00:00
return srs_error_new(ERROR_ENCODER_NO_INPUT, "empty intput type, ingest=%s", ingest->arg0().c_str());
2014-04-07 05:32:00 +00:00
}
2017-03-25 09:21:39 +00:00
if (srs_config_ingest_is_file(input_type)) {
2014-04-07 06:20:03 +00:00
std::string input_url = _srs_config->get_ingest_input_url(ingest);
if (input_url.empty()) {
2018-01-01 11:39:57 +00:00
return srs_error_new(ERROR_ENCODER_NO_INPUT, "empty intput url, ingest=%s", ingest->arg0().c_str());
2014-04-07 06:20:03 +00:00
}
// for file, set re.
ffmpeg->set_iparams("-re");
2017-03-25 09:21:39 +00:00
2018-01-01 11:39:57 +00:00
if ((err = ffmpeg->initialize(input_url, output, log_file)) != srs_success) {
return srs_error_wrap(err, "init ffmpeg");
2014-04-07 06:28:06 +00:00
}
} else if (srs_config_ingest_is_stream(input_type)) {
2014-04-07 06:28:06 +00:00
std::string input_url = _srs_config->get_ingest_input_url(ingest);
if (input_url.empty()) {
2018-01-01 11:39:57 +00:00
return srs_error_new(ERROR_ENCODER_NO_INPUT, "empty intput url, ingest=%s", ingest->arg0().c_str());
2014-04-07 06:28:06 +00:00
}
// for stream, no re.
ffmpeg->set_iparams("");
2017-03-25 09:21:39 +00:00
2018-01-01 11:39:57 +00:00
if ((err = ffmpeg->initialize(input_url, output, log_file)) != srs_success) {
return srs_error_wrap(err, "init ffmpeg");
2014-04-07 06:20:03 +00:00
}
} else {
2018-01-01 11:39:57 +00:00
return srs_error_new(ERROR_ENCODER_INPUT_TYPE, "invalid ingest=%s type=%s", ingest->arg0().c_str(), input_type.c_str());
2014-04-07 06:20:03 +00:00
}
2014-04-07 05:32:00 +00:00
// set output format to flv for RTMP
ffmpeg->set_oformat("flv");
2014-04-07 07:04:31 +00:00
std::string vcodec = _srs_config->get_engine_vcodec(engine);
std::string acodec = _srs_config->get_engine_acodec(engine);
// whatever the engine config, use copy as default.
bool engine_disabled = !engine || !_srs_config->get_engine_enabled(engine);
if (engine_disabled || vcodec.empty() || acodec.empty()) {
2018-01-01 11:39:57 +00:00
if ((err = ffmpeg->initialize_copy()) != srs_success) {
return srs_error_wrap(err, "init ffmpeg");
2014-04-07 06:20:03 +00:00
}
} else {
2018-01-01 11:39:57 +00:00
if ((err = ffmpeg->initialize_transcode(engine)) != srs_success) {
return srs_error_wrap(err, "init ffmpeg");
2014-04-07 06:20:03 +00:00
}
2014-04-07 05:13:57 +00:00
}
2018-01-01 11:39:57 +00:00
srs_trace("parse success, ingest=%s, vhost=%s", ingest->arg0().c_str(), vhost->arg0().c_str());
2014-04-08 10:01:14 +00:00
2018-01-01 11:39:57 +00:00
return err;
2014-04-07 05:13:57 +00:00
}
void SrsIngester::show_ingest_log_message()
2014-04-07 06:20:03 +00:00
{
pprint->elapse();
2017-03-25 09:21:39 +00:00
2014-04-10 02:35:02 +00:00
if ((int)ingesters.size() <= 0) {
return;
}
2015-06-06 10:57:41 +00:00
// random choose one ingester to report.
int index = rand() % (int)ingesters.size();
SrsIngesterFFMPEG* ingester = ingesters.at(index);
2014-04-07 06:20:03 +00:00
// reportable
if (pprint->can_print()) {
srs_trace("-> " SRS_CONSTS_LOG_INGESTER " time=%" PRId64 ", ingesters=%d, #%d(alive=%ds, %s)",
2017-03-25 09:21:39 +00:00
pprint->age(), (int)ingesters.size(), index, ingester->alive() / 1000, ingester->uri().c_str());
2014-04-07 06:20:03 +00:00
}
}
2017-09-22 08:14:30 +00:00
srs_error_t SrsIngester::on_reload_vhost_removed(string vhost)
2014-04-10 02:35:02 +00:00
{
2017-09-22 08:14:30 +00:00
srs_error_t err = srs_success;
2014-04-10 02:35:02 +00:00
std::vector<SrsIngesterFFMPEG*>::iterator it;
for (it = ingesters.begin(); it != ingesters.end();) {
SrsIngesterFFMPEG* ingester = *it;
2015-06-06 10:57:41 +00:00
if (!ingester->equals(vhost)) {
2014-04-10 02:35:02 +00:00
++it;
continue;
}
// stop the ffmpeg and free it.
2015-06-06 10:57:41 +00:00
ingester->stop();
2014-04-10 02:35:02 +00:00
2015-06-06 10:57:41 +00:00
srs_trace("reload stop ingester, vhost=%s, id=%s", vhost.c_str(), ingester->uri().c_str());
2017-03-25 09:21:39 +00:00
2014-04-10 02:35:02 +00:00
srs_freep(ingester);
// remove the item from ingesters.
it = ingesters.erase(it);
}
2017-03-25 09:21:39 +00:00
2017-09-22 08:14:30 +00:00
return err;
2014-04-10 02:35:02 +00:00
}
2017-09-22 08:14:30 +00:00
srs_error_t SrsIngester::on_reload_vhost_added(string vhost)
2015-09-01 10:41:30 +00:00
{
2017-09-22 08:14:30 +00:00
srs_error_t err = srs_success;
2015-09-01 10:41:30 +00:00
SrsConfDirective* _vhost = _srs_config->get_vhost(vhost);
2018-01-01 11:39:57 +00:00
if ((err = parse_ingesters(_vhost)) != srs_success) {
return srs_error_wrap(err, "parse ingesters");
2015-09-01 10:41:30 +00:00
}
srs_trace("reload add vhost ingesters, vhost=%s", vhost.c_str());
2017-09-22 08:14:30 +00:00
return err;
2015-09-01 10:41:30 +00:00
}
2017-09-22 08:14:30 +00:00
srs_error_t SrsIngester::on_reload_ingest_removed(string vhost, string ingest_id)
{
2017-09-22 08:14:30 +00:00
srs_error_t err = srs_success;
std::vector<SrsIngesterFFMPEG*>::iterator it;
for (it = ingesters.begin(); it != ingesters.end();) {
SrsIngesterFFMPEG* ingester = *it;
2015-06-06 10:57:41 +00:00
if (!ingester->equals(vhost, ingest_id)) {
++it;
continue;
}
// stop the ffmpeg and free it.
2015-06-06 10:57:41 +00:00
ingester->stop();
2015-06-06 10:57:41 +00:00
srs_trace("reload stop ingester, vhost=%s, id=%s", vhost.c_str(), ingester->uri().c_str());
2017-03-25 09:21:39 +00:00
srs_freep(ingester);
// remove the item from ingesters.
it = ingesters.erase(it);
}
2017-09-22 08:14:30 +00:00
return err;
}
2017-09-22 08:14:30 +00:00
srs_error_t SrsIngester::on_reload_ingest_added(string vhost, string ingest_id)
{
2017-09-22 08:14:30 +00:00
srs_error_t err = srs_success;
SrsConfDirective* _vhost = _srs_config->get_vhost(vhost);
SrsConfDirective* _ingester = _srs_config->get_ingest_by_id(vhost, ingest_id);
2018-01-01 11:39:57 +00:00
if ((err = parse_engines(_vhost, _ingester)) != srs_success) {
return srs_error_wrap(err, "parse engines");
}
2017-09-22 08:14:30 +00:00
srs_trace("reload add ingester, vhost=%s, id=%s", vhost.c_str(), ingest_id.c_str());
2017-09-22 08:14:30 +00:00
return err;
}
2017-09-22 08:14:30 +00:00
srs_error_t SrsIngester::on_reload_ingest_updated(string vhost, string ingest_id)
{
2017-09-22 08:14:30 +00:00
srs_error_t err = srs_success;
2017-03-25 09:21:39 +00:00
2017-09-22 08:14:30 +00:00
if ((err = on_reload_ingest_removed(vhost, ingest_id)) != srs_success) {
return srs_error_wrap(err, "reload ingest removed");
}
2017-03-25 09:21:39 +00:00
2017-09-22 08:14:30 +00:00
if ((err = on_reload_ingest_added(vhost, ingest_id)) != srs_success) {
return srs_error_wrap(err, "reload ingest added");
}
2017-09-22 08:14:30 +00:00
srs_trace("reload updated ingester, vhost=%s, id=%s", vhost.c_str(), ingest_id.c_str());
2017-09-22 08:14:30 +00:00
return err;
}
2017-09-22 08:14:30 +00:00
srs_error_t SrsIngester::on_reload_listen()
{
expired = true;
2017-09-22 08:14:30 +00:00
return srs_success;
}