mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Merge
This commit is contained in:
commit
2e8766515e
4 changed files with 45 additions and 24 deletions
4
.github/ISSUE_TEMPLATE
vendored
4
.github/ISSUE_TEMPLATE
vendored
|
@ -7,6 +7,10 @@ assignees: ''
|
|||
|
||||
---
|
||||
|
||||
> 注意:不提供以下信息的Issue会被直接删除(Please follow issue template, or we will delete it)
|
||||
|
||||
> 注意:咨询和讨论请提交到SRS星球(Please ask question at) http://bbs.ossrs.net
|
||||
|
||||
**描述(Description)**
|
||||
|
||||
> 描述你遇到了什么问题(Please description your issue here)
|
||||
|
|
17
README.md
17
README.md
|
@ -74,14 +74,15 @@ Other important wiki:
|
|||
|
||||
The [TOC(Technical Oversight Committee)](trunk/AUTHORS.md#toc) and [contributors](trunk/AUTHORS.md#contributors):
|
||||
|
||||
* [Winlin](https://github.com/winlinvip): All areas of streaming server and documents.
|
||||
* [Wenjie](https://github.com/wenjiegit): The focus of his work is on the [HDS](https://github.com/simple-rtmp-server/srs/wiki/v4_CN_DeliveryHDS) module.
|
||||
* [Runner365](https://github.com/runner365): The focus of his work is on the [SRT](https://github.com/simple-rtmp-server/srs/wiki/v4_CN_SRTWiki) module.
|
||||
* [John](https://github.com/xiaozhihong): Focus on [WebRTC](https://github.com/simple-rtmp-server/srs/wiki/v4_CN_WebRTC) module.
|
||||
* [B.P.Y(Bepartofyou)](https://github.com/Bepartofyou): Focus on [WebRTC](https://github.com/simple-rtmp-server/srs/wiki/v4_CN_WebRTC) module.
|
||||
* [Lixin](https://github.com/xialixin): Focus on [GB28181](https://github.com/ossrs/srs/issues/1500) module.
|
||||
* [Mozhan](https://github.com/lipeng19811218): Focus on [WebRTC](https://github.com/simple-rtmp-server/srs/wiki/v4_CN_WebRTC) module.
|
||||
* [Jinxue](https://github.com/chen-guanghua): Focus on [WebRTC](https://github.com/simple-rtmp-server/srs/wiki/v4_CN_WebRTC) module.
|
||||
* [Winlin](https://github.com/winlinvip): Focus on [issues/PR](https://github.com/ossrs/srs/issues) and tests now.
|
||||
* [Wenjie](https://github.com/wenjiegit): Focus on [HDS](https://github.com/simple-rtmp-server/srs/wiki/v4_CN_DeliveryHDS) module.
|
||||
* [Runner365](https://github.com/runner365): Focus on [SRT](https://github.com/simple-rtmp-server/srs/wiki/v4_CN_SRTWiki) module.
|
||||
* [HongdaXiao](https://github.com/xiaozhihong): Focus on [WebRTC](https://github.com/simple-rtmp-server/srs/wiki/v4_CN_WebRTC) module.
|
||||
* [Bepartofyou](https://github.com/Bepartofyou): Focus on [WebRTC](https://github.com/simple-rtmp-server/srs/wiki/v4_CN_WebRTC) module.
|
||||
* [XiaLixin](https://github.com/xialixin): Focus on [GB28181](https://github.com/ossrs/srs/issues/1500) module.
|
||||
* [LiPeng](https://github.com/lipeng19811218): Focus on [WebRTC](https://github.com/simple-rtmp-server/srs/wiki/v4_CN_WebRTC) module.
|
||||
* [ChenGuanghua](https://github.com/chen-guanghua): Focus on [WebRTC](https://github.com/simple-rtmp-server/srs/wiki/v4_CN_WebRTC) module.
|
||||
* [HaiboChen](https://github.com/duiniuluantanqin): Focus on [GB28181](https://github.com/ossrs/srs/issues/1500) and [API](https://github.com/ossrs/srs/issues/1657) module.
|
||||
|
||||
A big `THANK YOU` also goes to:
|
||||
|
||||
|
|
|
@ -153,6 +153,30 @@ srs_error_t srs_redirect_output(string from_file, int to_fd)
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsProcess::redirect_io()
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
// for the stdout, ignore when not specified.
|
||||
// redirect stdout to file if possible.
|
||||
if ((err = srs_redirect_output(stdout_file, STDOUT_FILENO)) != srs_success) {
|
||||
return srs_error_wrap(err, "redirect stdout");
|
||||
}
|
||||
|
||||
// for the stderr, ignore when not specified.
|
||||
// redirect stderr to file if possible.
|
||||
if ((err = srs_redirect_output(stderr_file, STDERR_FILENO)) != srs_success) {
|
||||
return srs_error_wrap(err, "redirect stderr");
|
||||
}
|
||||
|
||||
// No stdin for process, @bug https://github.com/ossrs/srs/issues/1592
|
||||
if ((err = srs_redirect_output("/dev/null", STDIN_FILENO)) != srs_success) {
|
||||
return srs_error_wrap(err, "redirect /dev/null");
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsProcess::start()
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
@ -182,24 +206,13 @@ srs_error_t SrsProcess::start()
|
|||
// ignore the SIGINT and SIGTERM
|
||||
signal(SIGINT, SIG_IGN);
|
||||
signal(SIGTERM, SIG_IGN);
|
||||
|
||||
// for the stdout, ignore when not specified.
|
||||
// redirect stdout to file if possible.
|
||||
if ((err = srs_redirect_output(stdout_file, STDOUT_FILENO)) != srs_success) {
|
||||
return srs_error_wrap(err, "redirect output");
|
||||
|
||||
// redirect standard I/O, if it failed, output error to stdout, and exit child process.
|
||||
if ((err = redirect_io()) != srs_success) {
|
||||
fprintf(stdout, "child process error, %s\n", srs_error_desc(err).c_str());
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// for the stderr, ignore when not specified.
|
||||
// redirect stderr to file if possible.
|
||||
if ((err = srs_redirect_output(stderr_file, STDERR_FILENO)) != srs_success) {
|
||||
return srs_error_wrap(err, "redirect output");
|
||||
}
|
||||
|
||||
// No stdin for process, @bug https://github.com/ossrs/srs/issues/1592
|
||||
if ((err = srs_redirect_output("/dev/null", STDIN_FILENO)) != srs_success) {
|
||||
return srs_error_wrap(err, "redirect input");
|
||||
}
|
||||
|
||||
// should never close the fd 3+, for it myabe used.
|
||||
// for fd should close at exec, use fnctl to set it.
|
||||
|
||||
|
|
|
@ -53,6 +53,9 @@ public:
|
|||
// @param argv the argv for binary path, the argv[0] generally is the binary.
|
||||
// @remark the argv[0] must be the binary.
|
||||
virtual srs_error_t initialize(std::string binary, std::vector<std::string> argv);
|
||||
private:
|
||||
// Redirect standard I/O.
|
||||
virtual srs_error_t redirect_io();
|
||||
public:
|
||||
// Start the process, ignore when already started.
|
||||
virtual srs_error_t start();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue