Merge branch 'develop' into min

min
winlin 5 years ago
commit 7ecd01e657

@ -168,6 +168,9 @@ For previous versions, please read:
## V3 changes ## V3 changes
* v3.0, 2020-03-11, For [#1634][bug #1634], refactor output with datetime for ingest/encoder/exec. 3.0.125
* v3.0, 2020-03-11, For [#1634][bug #1634], fix quit by accident SIGTERM while killing FFMPEG. 3.0.124
* <strong>v3.0, 2020-03-05, [3.0 beta2(3.0.123)][r3.0b2] released. 122170 lines.</strong>
* v3.0, 2020-02-21, For [#1598][bug #1598], support SLB health checking by TCP. 3.0.123 * v3.0, 2020-02-21, For [#1598][bug #1598], support SLB health checking by TCP. 3.0.123
* v3.0, 2020-02-21, Fix bug for librtmp client ipv4/ipv6 socket. 3.0.122 * v3.0, 2020-02-21, Fix bug for librtmp client ipv4/ipv6 socket. 3.0.122
* v3.0, 2020-02-18, For [#1579][bug #1579], support start/final wait for gracefully quit. 3.0.121 * v3.0, 2020-02-18, For [#1579][bug #1579], support start/final wait for gracefully quit. 3.0.121
@ -767,6 +770,7 @@ For previous versions, please read:
## Releases ## Releases
* 2020-03-05, [Release v3.0-b2][r3.0b2], 3.0 beta2, 3.0.123, 122170 lines.
* 2020-02-14, [Release v3.0-b1][r3.0b1], 3.0 beta1, 3.0.117, 121964 lines. * 2020-02-14, [Release v3.0-b1][r3.0b1], 3.0 beta1, 3.0.117, 121964 lines.
* 2020-02-02, [Release v3.0-b0][r3.0b0], 3.0 beta0, 3.0.112, 121709 lines. * 2020-02-02, [Release v3.0-b0][r3.0b0], 3.0 beta0, 3.0.112, 121709 lines.
* 2020-01-21, [Release v3.0-a9][r3.0a9], 3.0 alpha9, 3.0.105, 121577 lines. * 2020-01-21, [Release v3.0-a9][r3.0a9], 3.0 alpha9, 3.0.105, 121577 lines.
@ -1691,14 +1695,16 @@ Winlin
[bug #1598]: https://github.com/ossrs/srs/issues/1598 [bug #1598]: https://github.com/ossrs/srs/issues/1598
[bug #1615]: https://github.com/ossrs/srs/issues/1615 [bug #1615]: https://github.com/ossrs/srs/issues/1615
[bug #1621]: https://github.com/ossrs/srs/issues/1621 [bug #1621]: https://github.com/ossrs/srs/issues/1621
[bug #xxxxxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxxxxx [bug #1634]: https://github.com/ossrs/srs/issues/1634
[bug #yyyyyyyyyyyyy]: https://github.com/ossrs/srs/issues/yyyyyyyyyyyyy
[bug #1631]: https://github.com/ossrs/srs/issues/1631 [bug #1631]: https://github.com/ossrs/srs/issues/1631
[bug #1612]: https://github.com/ossrs/srs/issues/1612 [bug #1612]: https://github.com/ossrs/srs/issues/1612
[bug #xxxxxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxxxxx [bug #zzzzzzzzzzzzz]: https://github.com/ossrs/srs/issues/zzzzzzzzzzzzz
[exo #828]: https://github.com/google/ExoPlayer/pull/828 [exo #828]: https://github.com/google/ExoPlayer/pull/828
[r3.0b2]: https://github.com/ossrs/srs/releases/tag/v3.0-b2
[r3.0b1]: https://github.com/ossrs/srs/releases/tag/v3.0-b1 [r3.0b1]: https://github.com/ossrs/srs/releases/tag/v3.0-b1
[r3.0b0]: https://github.com/ossrs/srs/releases/tag/v3.0-b0 [r3.0b0]: https://github.com/ossrs/srs/releases/tag/v3.0-b0
[r3.0a9]: https://github.com/ossrs/srs/releases/tag/v3.0-a9 [r3.0a9]: https://github.com/ossrs/srs/releases/tag/v3.0-a9

@ -1000,6 +1000,16 @@ vhost exec.srs.com {
# [tcUrl] the client request tcUrl. # [tcUrl] the client request tcUrl.
# [swfUrl] the client request swfUrl. # [swfUrl] the client request swfUrl.
# [pageUrl] the client request pageUrl. # [pageUrl] the client request pageUrl.
# we also support datetime variables.
# [2006], replace this const to current year.
# [01], replace this const to current month.
# [02], replace this const to current date.
# [15], replace this const to current hour.
# [04], replace this const to current minute.
# [05], replace this const to current second.
# [999], replace this const to current millisecond.
# [timestamp],replace this const to current UNIX timestamp in ms.
# @remark we use golang time format "2006-01-02 15:04:05.999" as "[2006]-[01]-[02]_[15].[04].[05]_[999]"
# @remark empty to ignore this exec. # @remark empty to ignore this exec.
publish ./objs/ffmpeg/bin/ffmpeg -f flv -i [url] -c copy -y ./[stream].flv; publish ./objs/ffmpeg/bin/ffmpeg -f flv -i [url] -c copy -y ./[stream].flv;
} }
@ -1353,6 +1363,16 @@ vhost ingest.srs.com {
# output stream. variables: # output stream. variables:
# [vhost] current vhost which start the ingest. # [vhost] current vhost which start the ingest.
# [port] system RTMP stream port. # [port] system RTMP stream port.
# we also support datetime variables.
# [2006], replace this const to current year.
# [01], replace this const to current month.
# [02], replace this const to current date.
# [15], replace this const to current hour.
# [04], replace this const to current minute.
# [05], replace this const to current second.
# [999], replace this const to current millisecond.
# [timestamp],replace this const to current UNIX timestamp in ms.
# @remark we use golang time format "2006-01-02 15:04:05.999" as "[2006]-[01]-[02]_[15].[04].[05]_[999]"
output rtmp://127.0.0.1:[port]/live?vhost=[vhost]/livestream; output rtmp://127.0.0.1:[port]/live?vhost=[vhost]/livestream;
} }
} }
@ -1541,6 +1561,16 @@ vhost example.transcode.srs.com {
# [app] the input stream app. # [app] the input stream app.
# [stream] the input stream name. # [stream] the input stream name.
# [engine] the transcode engine name. # [engine] the transcode engine name.
# we also support datetime variables.
# [2006], replace this const to current year.
# [01], replace this const to current month.
# [02], replace this const to current date.
# [15], replace this const to current hour.
# [04], replace this const to current minute.
# [05], replace this const to current second.
# [999], replace this const to current millisecond.
# [timestamp],replace this const to current UNIX timestamp in ms.
# @remark we use golang time format "2006-01-02 15:04:05.999" as "[2006]-[01]-[02]_[15].[04].[05]_[999]"
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine]; output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
} }
} }

@ -33,6 +33,7 @@ using namespace std;
#include <srs_app_pithy_print.hpp> #include <srs_app_pithy_print.hpp>
#include <srs_app_ffmpeg.hpp> #include <srs_app_ffmpeg.hpp>
#include <srs_kernel_utility.hpp> #include <srs_kernel_utility.hpp>
#include <srs_app_utility.hpp>
// for encoder to detect the dead loop // for encoder to detect the dead loop
static std::vector<std::string> _transcoded_url; static std::vector<std::string> _transcoded_url;
@ -94,15 +95,17 @@ srs_error_t SrsEncoder::cycle()
srs_error_t err = srs_success; srs_error_t err = srs_success;
while (true) { while (true) {
if ((err = do_cycle()) != srs_success) { // We always check status first.
srs_warn("Encoder: Ignore error, %s", srs_error_desc(err).c_str()); // @see https://github.com/ossrs/srs/issues/1634#issuecomment-597571561
srs_error_reset(err);
}
if ((err = trd->pull()) != srs_success) { if ((err = trd->pull()) != srs_success) {
err = srs_error_wrap(err, "encoder"); err = srs_error_wrap(err, "encoder");
break; 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); 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, "[stream]", req->stream);
output = srs_string_replace(output, "[param]", req->param); output = srs_string_replace(output, "[param]", req->param);
output = srs_string_replace(output, "[engine]", engine->arg0()); output = srs_string_replace(output, "[engine]", engine->arg0());
output = srs_path_build_timestamp(output);
std::string log_file = SRS_CONSTS_NULL_FILE; // disabled std::string log_file = SRS_CONSTS_NULL_FILE; // disabled
// write ffmpeg info to log file. // 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 // ie. rtmp://localhost:1935/live/livestream_sd
output = srs_string_replace(output, "[vhost]", vhost->arg0()); output = srs_string_replace(output, "[vhost]", vhost->arg0());
output = srs_string_replace(output, "[port]", srs_int2str(port)); output = srs_string_replace(output, "[port]", srs_int2str(port));
output = srs_path_build_timestamp(output);
if (output.empty()) { if (output.empty()) {
return srs_error_new(ERROR_ENCODER_NO_OUTPUT, "empty output url, ingest=%s", ingest->arg0().c_str()); 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_utility.hpp>
#include <srs_kernel_consts.hpp> #include <srs_kernel_consts.hpp>
#include <srs_protocol_utility.hpp> #include <srs_protocol_utility.hpp>
#include <srs_app_utility.hpp>
SrsNgExec::SrsNgExec() 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, "[tcUrl]", req->tcUrl);
output = srs_string_replace(output, "[swfUrl]", req->swfUrl); output = srs_string_replace(output, "[swfUrl]", req->swfUrl);
output = srs_string_replace(output, "[pageUrl]", req->pageUrl); output = srs_string_replace(output, "[pageUrl]", req->pageUrl);
output = srs_path_build_timestamp(output);
if (output.find("[url]") != string::npos) { 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); 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. // parent.
if (pid > 0) { 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; is_started = true;
srs_trace("fored process, pid=%d, bin=%s, stdout=%s, stderr=%s, argv=%s", 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()); 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(SrsListenerMpegTsOverUdp);
close_listeners(SrsListenerRtsp); close_listeners(SrsListenerRtsp);
close_listeners(SrsListenerFlv); close_listeners(SrsListenerFlv);
srs_trace("listeners closed");
// Fast stop to notify FFMPEG to quit, wait for a while then fast kill. // Fast stop to notify FFMPEG to quit, wait for a while then fast kill.
ingester->stop(); ingester->stop();
srs_trace("ingesters stopped");
// Wait for connections to quit. // Wait for connections to quit.
// While gracefully quiting, user can requires SRS to fast 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. // dispose the source for hls and dvr.
_srs_sources->dispose(); _srs_sources->dispose();
srs_trace("source disposed");
#ifdef SRS_AUTO_MEM_WATCH #ifdef SRS_AUTO_MEM_WATCH
srs_memory_report(); srs_memory_report();
@ -887,6 +890,7 @@ srs_error_t SrsServer::cycle()
void SrsServer::on_signal(int signo) void SrsServer::on_signal(int signo)
{ {
if (signo == SRS_SIGNAL_RELOAD) { if (signo == SRS_SIGNAL_RELOAD) {
srs_trace("reload config, signo=%d", signo);
signal_reload = true; signal_reload = true;
return; return;
} }
@ -894,7 +898,7 @@ void SrsServer::on_signal(int signo)
#ifndef SRS_AUTO_GPERF_MC #ifndef SRS_AUTO_GPERF_MC
if (signo == SRS_SIGNAL_REOPEN_LOG) { if (signo == SRS_SIGNAL_REOPEN_LOG) {
_srs_log->reopen(); _srs_log->reopen();
srs_warn("reopen log file"); srs_warn("reopen log file, signo=%d", signo);
return; return;
} }
#endif #endif
@ -902,7 +906,7 @@ void SrsServer::on_signal(int signo)
#ifdef SRS_AUTO_GPERF_MC #ifdef SRS_AUTO_GPERF_MC
if (signo == SRS_SIGNAL_REOPEN_LOG) { if (signo == SRS_SIGNAL_REOPEN_LOG) {
signal_gmc_stop = true; 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; return;
} }
#endif #endif
@ -914,7 +918,7 @@ void SrsServer::on_signal(int signo)
if (signo == SIGINT) { if (signo == SIGINT) {
#ifdef SRS_AUTO_GPERF_MC #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; signal_gmc_stop = true;
#else #else
#ifdef SRS_AUTO_MEM_WATCH #ifdef SRS_AUTO_MEM_WATCH

@ -24,6 +24,6 @@
#ifndef SRS_CORE_VERSION3_HPP #ifndef SRS_CORE_VERSION3_HPP
#define SRS_CORE_VERSION3_HPP #define SRS_CORE_VERSION3_HPP
#define SRS_VERSION3_REVISION 123 #define SRS_VERSION3_REVISION 125
#endif #endif

Loading…
Cancel
Save