mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Merge SRS3
This commit is contained in:
commit
6a765ab849
8 changed files with 63 additions and 11 deletions
|
@ -33,6 +33,7 @@ using namespace std;
|
|||
#include <srs_app_pithy_print.hpp>
|
||||
#include <srs_app_ffmpeg.hpp>
|
||||
#include <srs_kernel_utility.hpp>
|
||||
#include <srs_app_utility.hpp>
|
||||
|
||||
// for encoder to detect the dead loop
|
||||
static std::vector<std::string> _transcoded_url;
|
||||
|
@ -94,15 +95,17 @@ srs_error_t SrsEncoder::cycle()
|
|||
srs_error_t err = srs_success;
|
||||
|
||||
while (true) {
|
||||
if ((err = do_cycle()) != srs_success) {
|
||||
srs_warn("Encoder: Ignore error, %s", srs_error_desc(err).c_str());
|
||||
srs_error_reset(err);
|
||||
}
|
||||
|
||||
// We always check status first.
|
||||
// @see https://github.com/ossrs/srs/issues/1634#issuecomment-597571561
|
||||
if ((err = trd->pull()) != srs_success) {
|
||||
err = srs_error_wrap(err, "encoder");
|
||||
break;
|
||||
}
|
||||
|
||||
if ((err = do_cycle()) != srs_success) {
|
||||
srs_warn("Encoder: Ignore error, %s", srs_error_desc(err).c_str());
|
||||
srs_error_reset(err);
|
||||
}
|
||||
|
||||
srs_usleep(SRS_RTMP_ENCODER_CIMS);
|
||||
}
|
||||
|
@ -282,6 +285,7 @@ srs_error_t SrsEncoder::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsRequest* req, Sr
|
|||
output = srs_string_replace(output, "[stream]", req->stream);
|
||||
output = srs_string_replace(output, "[param]", req->param);
|
||||
output = srs_string_replace(output, "[engine]", engine->arg0());
|
||||
output = srs_path_build_timestamp(output);
|
||||
|
||||
std::string log_file = SRS_CONSTS_NULL_FILE; // disabled
|
||||
// write ffmpeg info to log file.
|
||||
|
|
|
@ -382,6 +382,7 @@ srs_error_t SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective*
|
|||
// ie. rtmp://localhost:1935/live/livestream_sd
|
||||
output = srs_string_replace(output, "[vhost]", vhost->arg0());
|
||||
output = srs_string_replace(output, "[port]", srs_int2str(port));
|
||||
output = srs_path_build_timestamp(output);
|
||||
if (output.empty()) {
|
||||
return srs_error_new(ERROR_ENCODER_NO_OUTPUT, "empty output url, ingest=%s", ingest->arg0().c_str());
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ using namespace std;
|
|||
#include <srs_kernel_utility.hpp>
|
||||
#include <srs_kernel_consts.hpp>
|
||||
#include <srs_protocol_utility.hpp>
|
||||
#include <srs_app_utility.hpp>
|
||||
|
||||
SrsNgExec::SrsNgExec()
|
||||
{
|
||||
|
@ -219,6 +220,8 @@ string SrsNgExec::parse(SrsRequest* req, string tmpl)
|
|||
output = srs_string_replace(output, "[tcUrl]", req->tcUrl);
|
||||
output = srs_string_replace(output, "[swfUrl]", req->swfUrl);
|
||||
output = srs_string_replace(output, "[pageUrl]", req->pageUrl);
|
||||
|
||||
output = srs_path_build_timestamp(output);
|
||||
|
||||
if (output.find("[url]") != string::npos) {
|
||||
string url = srs_generate_rtmp_url(req->host, req->port, req->host, req->vhost, req->app, req->stream, req->param);
|
||||
|
|
|
@ -248,6 +248,10 @@ srs_error_t SrsProcess::start()
|
|||
|
||||
// parent.
|
||||
if (pid > 0) {
|
||||
// Wait for a while for process to really started.
|
||||
// @see https://github.com/ossrs/srs/issues/1634#issuecomment-597568840
|
||||
srs_usleep(10 * SRS_UTIME_MILLISECONDS);
|
||||
|
||||
is_started = true;
|
||||
srs_trace("fored process, pid=%d, bin=%s, stdout=%s, stderr=%s, argv=%s",
|
||||
pid, bin.c_str(), stdout_file.c_str(), stderr_file.c_str(), actual_cli.c_str());
|
||||
|
|
|
@ -557,9 +557,11 @@ void SrsServer::gracefully_dispose()
|
|||
close_listeners(SrsListenerMpegTsOverUdp);
|
||||
close_listeners(SrsListenerRtsp);
|
||||
close_listeners(SrsListenerFlv);
|
||||
srs_trace("listeners closed");
|
||||
|
||||
// Fast stop to notify FFMPEG to quit, wait for a while then fast kill.
|
||||
ingester->stop();
|
||||
srs_trace("ingesters stopped");
|
||||
|
||||
// Wait for connections to quit.
|
||||
// While gracefully quiting, user can requires SRS to fast quit.
|
||||
|
@ -575,6 +577,7 @@ void SrsServer::gracefully_dispose()
|
|||
|
||||
// dispose the source for hls and dvr.
|
||||
_srs_sources->dispose();
|
||||
srs_trace("source disposed");
|
||||
|
||||
#ifdef SRS_AUTO_MEM_WATCH
|
||||
srs_memory_report();
|
||||
|
@ -887,6 +890,7 @@ srs_error_t SrsServer::cycle()
|
|||
void SrsServer::on_signal(int signo)
|
||||
{
|
||||
if (signo == SRS_SIGNAL_RELOAD) {
|
||||
srs_trace("reload config, signo=%d", signo);
|
||||
signal_reload = true;
|
||||
return;
|
||||
}
|
||||
|
@ -894,7 +898,7 @@ void SrsServer::on_signal(int signo)
|
|||
#ifndef SRS_AUTO_GPERF_MC
|
||||
if (signo == SRS_SIGNAL_REOPEN_LOG) {
|
||||
_srs_log->reopen();
|
||||
srs_warn("reopen log file");
|
||||
srs_warn("reopen log file, signo=%d", signo);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -902,7 +906,7 @@ void SrsServer::on_signal(int signo)
|
|||
#ifdef SRS_AUTO_GPERF_MC
|
||||
if (signo == SRS_SIGNAL_REOPEN_LOG) {
|
||||
signal_gmc_stop = true;
|
||||
srs_warn("for gmc, the SIGUSR1 used as SIGINT");
|
||||
srs_warn("for gmc, the SIGUSR1 used as SIGINT, signo=%d", signo);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -914,7 +918,7 @@ void SrsServer::on_signal(int signo)
|
|||
|
||||
if (signo == SIGINT) {
|
||||
#ifdef SRS_AUTO_GPERF_MC
|
||||
srs_trace("gmc is on, main cycle will terminate normally.");
|
||||
srs_trace("gmc is on, main cycle will terminate normally, signo=%d", signo);
|
||||
signal_gmc_stop = true;
|
||||
#else
|
||||
#ifdef SRS_AUTO_MEM_WATCH
|
||||
|
|
|
@ -24,6 +24,6 @@
|
|||
#ifndef SRS_CORE_VERSION3_HPP
|
||||
#define SRS_CORE_VERSION3_HPP
|
||||
|
||||
#define SRS_VERSION3_REVISION 123
|
||||
#define SRS_VERSION3_REVISION 125
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue