Skip to content

Commit

Permalink
Merge remote-tracking branch 'srs/4.0release' into feature/gb28181
Browse files Browse the repository at this point in the history
  • Loading branch information
basson099 committed Mar 13, 2020
2 parents 47c7b30 + a7c8980 commit 04e6aee
Show file tree
Hide file tree
Showing 26 changed files with 520 additions and 96 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ For previous versions, please read:

## V4 changes

* v4.0, 2020-03-13, For [#1636][bug #1636], fix bug for mux AAC to ADTS, never overwrite by RTMP sampling rate. 4.0.13
* v4.0, 2020-03-07, For [#1612][bug #1612], fix crash bug for RTSP. 4.0.12
* v4.0, 2020-03-07, For [#1631][bug #1631], support sei_filter for SRT. 4.0.11
* v4.0, 2020-03-01, For [#1621][bug #1621], support mix_correct for aggregate aac for SRT. 4.0.10
Expand All @@ -168,6 +169,14 @@ For previous versions, please read:

## V3 changes

* v3.0, 2020-03-12, For [#1635][bug #1635], inotify watch ConfigMap for reload. 3.0.134
* v3.0, 2020-03-12, For [#1635][bug #1635], support auto reaload config by inotify. 3.0.129
* v3.0, 2020-03-12, For [#1630][bug #1630], disable cache for stream changing, and drop dup header. 3.0.128
* v3.0, 2020-03-12, For [#1594][bug #1594], detect and disable daemon for docker. 3.0.127
* v3.0, 2020-03-12, For [#1634][bug #1634], always check status in thread loop. 3.0.126
* 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, 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
Expand Down Expand Up @@ -767,6 +776,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.
Expand Down Expand Up @@ -1691,14 +1701,19 @@ 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 #1594]: https://github.com/ossrs/srs/issues/1594
[bug #1630]: https://github.com/ossrs/srs/issues/1630
[bug #1635]: https://github.com/ossrs/srs/issues/1635
[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
Expand Down
41 changes: 41 additions & 0 deletions trunk/conf/full.conf
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,17 @@ grace_final_wait 3200;
# @see https://github.com/ossrs/srs/issues/1579#issuecomment-587475077
# default: off
force_grace_quit off;
# Whether disable daemon for docker.
# If on, it will set daemon to off in docker, even daemon is on.
# default: on
disable_daemon_for_docker on;
# Whether auto reload by watching the config file by inotify.
# default: off
inotify_auto_reload off;
# Whether enable inotify_auto_reload for docker.
# If on, it will set inotify_auto_reload to on in docker, even it's off.
# default: on
auto_reload_for_docker on;

#############################################################################################
# heartbeat/stats sections
Expand Down Expand Up @@ -1000,6 +1011,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;
}
Expand Down Expand Up @@ -1353,6 +1374,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;
}
}
Expand Down Expand Up @@ -1541,6 +1572,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];
}
}
Expand Down
39 changes: 38 additions & 1 deletion trunk/src/app/srs_app_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3489,7 +3489,8 @@ srs_error_t SrsConfig::check_normal_config()
&& n != "http_server" && n != "stream_caster" && n != "srt_server"
&& n != "utc_time" && n != "work_dir" && n != "asprocess"
&& n != "ff_log_level" && n != "grace_final_wait" && n != "force_grace_quit"
&& n != "grace_start_wait" && n != "empty_ip_ok"
&& n != "grace_start_wait" && n != "empty_ip_ok" && n != "disable_daemon_for_docker"
&& n != "inotify_auto_reload" && n != "auto_reload_for_docker"
) {
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "illegal directive %s", n.c_str());
}
Expand Down Expand Up @@ -4114,6 +4115,42 @@ bool SrsConfig::is_force_grace_quit()
return SRS_CONF_PERFER_FALSE(conf->arg0());
}

bool SrsConfig::disable_daemon_for_docker()
{
static bool DEFAULT = true;

SrsConfDirective* conf = root->get("disable_daemon_for_docker");
if (!conf || conf->arg0().empty()) {
return DEFAULT;
}

return SRS_CONF_PERFER_TRUE(conf->arg0());
}

bool SrsConfig::inotify_auto_reload()
{
static bool DEFAULT = false;

SrsConfDirective* conf = root->get("inotify_auto_reload");
if (!conf || conf->arg0().empty()) {
return DEFAULT;
}

return SRS_CONF_PERFER_FALSE(conf->arg0());
}

bool SrsConfig::auto_reload_for_docker()
{
static bool DEFAULT = true;

SrsConfDirective* conf = root->get("auto_reload_for_docker");
if (!conf || conf->arg0().empty()) {
return DEFAULT;
}

return SRS_CONF_PERFER_TRUE(conf->arg0());
}

vector<SrsConfDirective*> SrsConfig::get_stream_casters()
{
srs_assert(root);
Expand Down
6 changes: 6 additions & 0 deletions trunk/src/app/srs_app_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,12 @@ class SrsConfig
virtual srs_utime_t get_grace_final_wait();
// Whether force to gracefully quit, never fast quit.
virtual bool is_force_grace_quit();
// Whether disable daemon for docker.
virtual bool disable_daemon_for_docker();
// Whether use inotify to auto reload by watching config file changes.
virtual bool inotify_auto_reload();
// Whether enable auto reload config for docker.
virtual bool auto_reload_for_docker();
// stream_caster section
public:
// Get all stream_caster in config file.
Expand Down
25 changes: 14 additions & 11 deletions trunk/src/app/srs_app_edge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,17 @@ srs_error_t SrsEdgeIngester::cycle()
srs_error_t err = srs_success;

while (true) {
// We always check status first.
// @see https://github.com/ossrs/srs/issues/1634#issuecomment-597571561
if ((err = trd->pull()) != srs_success) {
return srs_error_wrap(err, "edge ingester");
}

if ((err = do_cycle()) != srs_success) {
srs_warn("EdgeIngester: Ignore error, %s", srs_error_desc(err).c_str());
srs_freep(err);
}

if ((err = trd->pull()) != srs_success) {
return srs_error_wrap(err, "edge ingester");
}


srs_usleep(SRS_EDGE_INGESTER_CIMS);
}

Expand Down Expand Up @@ -314,7 +316,6 @@ srs_error_t SrsEdgeIngester::ingest(string& redirect)
redirect = "";

while (true) {
srs_error_t err = srs_success;
if ((err = trd->pull()) != srs_success) {
return srs_error_wrap(err, "thread quit");
}
Expand Down Expand Up @@ -534,14 +535,16 @@ srs_error_t SrsEdgeForwarder::cycle()
srs_error_t err = srs_success;

while (true) {
if ((err = do_cycle()) != srs_success) {
return srs_error_wrap(err, "do cycle");
}

// We always check status first.
// @see https://github.com/ossrs/srs/issues/1634#issuecomment-597571561
if ((err = trd->pull()) != srs_success) {
return srs_error_wrap(err, "thread pull");
}


if ((err = do_cycle()) != srs_success) {
return srs_error_wrap(err, "do cycle");
}

srs_usleep(SRS_EDGE_FORWARDER_CIMS);
}

Expand Down
14 changes: 9 additions & 5 deletions trunk/src/app/srs_app_encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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.
Expand Down
12 changes: 7 additions & 5 deletions trunk/src/app/srs_app_forward.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,17 @@ srs_error_t SrsForwarder::cycle()
srs_error_t err = srs_success;

while (true) {
// We always check status first.
// @see https://github.com/ossrs/srs/issues/1634#issuecomment-597571561
if ((err = trd->pull()) != srs_success) {
return srs_error_wrap(err, "forwarder");
}

if ((err = do_cycle()) != srs_success) {
srs_warn("Forwarder: Ignore error, %s", srs_error_desc(err).c_str());
srs_freep(err);
}

if ((err = trd->pull()) != srs_success) {
return srs_error_wrap(err, "forwarder");
}


srs_usleep(SRS_FORWARDER_CIMS);
}

Expand Down
4 changes: 2 additions & 2 deletions trunk/src/app/srs_app_http_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -646,13 +646,13 @@ srs_error_t SrsLiveStream::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMess
// TODO: free and erase the disabled entry after all related connections is closed.
// TODO: FXIME: Support timeout for player, quit infinite-loop.
while (entry->enabled) {
pprint->elapse();

// Whether client closed the FD.
if ((err = trd->pull()) != srs_success) {
return srs_error_wrap(err, "recv thread");
}

pprint->elapse();

// get messages from consumer.
// each msg in msgs.msgs must be free, for the SrsMessageArray never free them.
int count = 0;
Expand Down
13 changes: 8 additions & 5 deletions trunk/src/app/srs_app_ingest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,17 @@ srs_error_t SrsIngester::cycle()
srs_error_t err = srs_success;

while (!disposed) {
// We always check status first.
// @see https://github.com/ossrs/srs/issues/1634#issuecomment-597571561
if ((err = trd->pull()) != srs_success) {
return srs_error_wrap(err, "ingester");
}

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");
}


srs_usleep(SRS_AUTO_INGESTER_CIMS);
}

Expand Down Expand Up @@ -382,6 +384,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());
}
Expand Down
17 changes: 11 additions & 6 deletions trunk/src/app/srs_app_ng_exec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -82,16 +83,18 @@ srs_error_t SrsNgExec::cycle()
srs_error_t err = srs_success;

while (true) {
if ((err = do_cycle()) != srs_success) {
srs_warn("EXEC: Ignore error, %s", srs_error_desc(err).c_str());
srs_freep(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, "ng exec cycle");
break;
}


if ((err = do_cycle()) != srs_success) {
srs_warn("EXEC: Ignore error, %s", srs_error_desc(err).c_str());
srs_freep(err);
}

srs_usleep(SRS_RTMP_EXEC_CIMS);
}

Expand Down Expand Up @@ -219,6 +222,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);
Expand Down
Loading

0 comments on commit 04e6aee

Please sign in to comment.