diff --git a/README.md b/README.md
index dc6abcfb5..6a3e6e4bb 100755
--- a/README.md
+++ b/README.md
@@ -168,6 +168,9 @@ For previous versions, please read:
## 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
+* v3.0, 2020-03-05, [3.0 beta2(3.0.123)][r3.0b2] released. 122170 lines.
* 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-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
+* 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-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.
@@ -1691,14 +1695,16 @@ Winlin
[bug #1598]: https://github.com/ossrs/srs/issues/1598
[bug #1615]: https://github.com/ossrs/srs/issues/1615
[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 #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
+[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.0b0]: https://github.com/ossrs/srs/releases/tag/v3.0-b0
[r3.0a9]: https://github.com/ossrs/srs/releases/tag/v3.0-a9
diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf
index 928925e00..334827439 100644
--- a/trunk/conf/full.conf
+++ b/trunk/conf/full.conf
@@ -1000,6 +1000,16 @@ vhost exec.srs.com {
# [tcUrl] the client request tcUrl.
# [swfUrl] the client request swfUrl.
# [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.
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:
# [vhost] current vhost which start the ingest.
# [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;
}
}
@@ -1541,6 +1561,16 @@ vhost example.transcode.srs.com {
# [app] the input stream app.
# [stream] the input stream 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];
}
}
diff --git a/trunk/src/app/srs_app_encoder.cpp b/trunk/src/app/srs_app_encoder.cpp
index 346bd2715..1f4aae4ee 100644
--- a/trunk/src/app/srs_app_encoder.cpp
+++ b/trunk/src/app/srs_app_encoder.cpp
@@ -33,6 +33,7 @@ using namespace std;
#include
#include
#include
+#include
// for encoder to detect the dead loop
static std::vector _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.
diff --git a/trunk/src/app/srs_app_ingest.cpp b/trunk/src/app/srs_app_ingest.cpp
index c98ed7d04..addbd9bc2 100644
--- a/trunk/src/app/srs_app_ingest.cpp
+++ b/trunk/src/app/srs_app_ingest.cpp
@@ -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());
}
diff --git a/trunk/src/app/srs_app_ng_exec.cpp b/trunk/src/app/srs_app_ng_exec.cpp
index a1e613c8e..18d719e78 100644
--- a/trunk/src/app/srs_app_ng_exec.cpp
+++ b/trunk/src/app/srs_app_ng_exec.cpp
@@ -35,6 +35,7 @@ using namespace std;
#include
#include
#include
+#include
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);
diff --git a/trunk/src/app/srs_app_process.cpp b/trunk/src/app/srs_app_process.cpp
index 8ccc1b72e..0f12f493d 100644
--- a/trunk/src/app/srs_app_process.cpp
+++ b/trunk/src/app/srs_app_process.cpp
@@ -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());
diff --git a/trunk/src/app/srs_app_server.cpp b/trunk/src/app/srs_app_server.cpp
index c35c27a42..272954d82 100644
--- a/trunk/src/app/srs_app_server.cpp
+++ b/trunk/src/app/srs_app_server.cpp
@@ -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
diff --git a/trunk/src/core/srs_core_version3.hpp b/trunk/src/core/srs_core_version3.hpp
index c871670b0..8a69c55d2 100644
--- a/trunk/src/core/srs_core_version3.hpp
+++ b/trunk/src/core/srs_core_version3.hpp
@@ -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