mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
fix hls bug, refine config and log, according to clion of jetbrains. 0.9.216.
This commit is contained in:
parent
002facb85b
commit
20ebf68ea5
7 changed files with 49 additions and 20 deletions
|
@ -208,6 +208,7 @@ Supported operating systems and hardware:
|
||||||
* 2013-10-17, Created.<br/>
|
* 2013-10-17, Created.<br/>
|
||||||
|
|
||||||
## History
|
## History
|
||||||
|
* v1.0, 2014-09-26, fix hls bug, refine config and log, according to clion of jetbrains. 0.9.216.
|
||||||
* v1.0, 2014-09-25, fix [#177](https://github.com/winlinvip/simple-rtmp-server/issues/177), dvr segment add config dvr_wait_keyframe. 0.9.213.
|
* v1.0, 2014-09-25, fix [#177](https://github.com/winlinvip/simple-rtmp-server/issues/177), dvr segment add config dvr_wait_keyframe. 0.9.213.
|
||||||
* v1.0, 2014-08-28, fix [#167](https://github.com/winlinvip/simple-rtmp-server/issues/167), add openssl includes to utest. 0.9.209.
|
* v1.0, 2014-08-28, fix [#167](https://github.com/winlinvip/simple-rtmp-server/issues/167), add openssl includes to utest. 0.9.209.
|
||||||
* v1.0, 2014-08-27, max connections is 32756, for st use mmap default. 0.9.209
|
* v1.0, 2014-08-27, max connections is 32756, for st use mmap default. 0.9.209
|
||||||
|
|
|
@ -50,16 +50,6 @@ using namespace _srs_internal;
|
||||||
|
|
||||||
#define SRS_WIKI_URL_LOG "https://github.com/winlinvip/simple-rtmp-server/wiki/SrsLog"
|
#define SRS_WIKI_URL_LOG "https://github.com/winlinvip/simple-rtmp-server/wiki/SrsLog"
|
||||||
|
|
||||||
#define FILE_OFFSET(fd) lseek(fd, 0, SEEK_CUR)
|
|
||||||
|
|
||||||
int64_t FILE_SIZE(int fd)
|
|
||||||
{
|
|
||||||
int64_t pre = FILE_OFFSET(fd);
|
|
||||||
int64_t pos = lseek(fd, 0, SEEK_END);
|
|
||||||
lseek(fd, pre, SEEK_SET);
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
// '\n'
|
// '\n'
|
||||||
#define __LF (char)0x0a
|
#define __LF (char)0x0a
|
||||||
|
|
||||||
|
@ -407,12 +397,19 @@ int SrsConfig::reload()
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
SrsConfig conf;
|
SrsConfig conf;
|
||||||
|
|
||||||
if ((ret = conf.parse_file(config_file.c_str())) != ERROR_SUCCESS) {
|
if ((ret = conf.parse_file(config_file.c_str())) != ERROR_SUCCESS) {
|
||||||
srs_error("ignore config reloader parse file failed. ret=%d", ret);
|
srs_error("ignore config reloader parse file failed. ret=%d", ret);
|
||||||
ret = ERROR_SUCCESS;
|
ret = ERROR_SUCCESS;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
srs_info("config reloader parse file success.");
|
srs_info("config reloader parse file success.");
|
||||||
|
|
||||||
|
if ((ret = conf.check_config()) != ERROR_SUCCESS) {
|
||||||
|
srs_error("ignore config reloader check config failed. ret=%d", ret);
|
||||||
|
ret = ERROR_SUCCESS;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
return reload_conf(&conf);
|
return reload_conf(&conf);
|
||||||
}
|
}
|
||||||
|
@ -1074,6 +1071,12 @@ int SrsConfig::parse_options(int argc, char** argv)
|
||||||
ret = parse_file(config_file.c_str());
|
ret = parse_file(config_file.c_str());
|
||||||
|
|
||||||
if (test_conf) {
|
if (test_conf) {
|
||||||
|
// the parse_file never check the config,
|
||||||
|
// we check it when user requires check config file.
|
||||||
|
if (ret == ERROR_SUCCESS) {
|
||||||
|
ret = check_config();
|
||||||
|
}
|
||||||
|
|
||||||
if (ret == ERROR_SUCCESS) {
|
if (ret == ERROR_SUCCESS) {
|
||||||
srs_trace("config file is ok");
|
srs_trace("config file is ok");
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@ -1082,6 +1085,25 @@ int SrsConfig::parse_options(int argc, char** argv)
|
||||||
exit(ret);
|
exit(ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
// check log name and level
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
if (true) {
|
||||||
|
std::string log_filename = this->get_log_file();
|
||||||
|
if (get_log_tank_file() && log_filename.empty()) {
|
||||||
|
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
||||||
|
srs_error("must specifies the file to write log to. ret=%d", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
if (get_log_tank_file()) {
|
||||||
|
srs_trace("write log to file %s", log_filename.c_str());
|
||||||
|
srs_trace("you can: tailf %s", log_filename.c_str());
|
||||||
|
srs_trace("@see: %s", SRS_WIKI_URL_LOG);
|
||||||
|
} else {
|
||||||
|
srs_trace("write log to console");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1189,6 +1211,8 @@ int SrsConfig::parse_file(const char* filename)
|
||||||
int SrsConfig::check_config()
|
int SrsConfig::check_config()
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
|
srs_trace("srs checking config...");
|
||||||
|
|
||||||
vector<SrsConfDirective*> vhosts = get_vhosts();
|
vector<SrsConfDirective*> vhosts = get_vhosts();
|
||||||
|
|
||||||
|
@ -1628,8 +1652,8 @@ int SrsConfig::parse_buffer(SrsConfigBuffer* buffer)
|
||||||
if ((ret = root->parse(buffer)) != ERROR_SUCCESS) {
|
if ((ret = root->parse(buffer)) != ERROR_SUCCESS) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return check_config();
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
string SrsConfig::cwd()
|
string SrsConfig::cwd()
|
||||||
|
|
|
@ -340,6 +340,11 @@ private:
|
||||||
* parse the config file, which is specified by cli.
|
* parse the config file, which is specified by cli.
|
||||||
*/
|
*/
|
||||||
virtual int parse_file(const char* filename);
|
virtual int parse_file(const char* filename);
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* check the parsed config.
|
||||||
|
*/
|
||||||
|
virtual int check_config();
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* parse config from the buffer.
|
* parse config from the buffer.
|
||||||
|
@ -347,11 +352,6 @@ protected:
|
||||||
* @remark, use protected for the utest to override with mock.
|
* @remark, use protected for the utest to override with mock.
|
||||||
*/
|
*/
|
||||||
virtual int parse_buffer(_srs_internal::SrsConfigBuffer* buffer);
|
virtual int parse_buffer(_srs_internal::SrsConfigBuffer* buffer);
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* check the parsed config.
|
|
||||||
*/
|
|
||||||
virtual int check_config();
|
|
||||||
// global env
|
// global env
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -38,7 +38,7 @@ SrsStageInfo::SrsStageInfo(int _stage_id)
|
||||||
{
|
{
|
||||||
stage_id = _stage_id;
|
stage_id = _stage_id;
|
||||||
nb_clients = 0;
|
nb_clients = 0;
|
||||||
age = printed_age = 0;
|
age = 0;
|
||||||
|
|
||||||
update_print_time();
|
update_print_time();
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,6 @@ public:
|
||||||
int nb_clients;
|
int nb_clients;
|
||||||
public:
|
public:
|
||||||
int64_t age;
|
int64_t age;
|
||||||
int64_t printed_age;
|
|
||||||
public:
|
public:
|
||||||
SrsStageInfo(int _stage_id);
|
SrsStageInfo(int _stage_id);
|
||||||
virtual ~SrsStageInfo();
|
virtual ~SrsStageInfo();
|
||||||
|
|
|
@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
// current release version
|
// current release version
|
||||||
#define VERSION_MAJOR "0"
|
#define VERSION_MAJOR "0"
|
||||||
#define VERSION_MINOR "9"
|
#define VERSION_MINOR "9"
|
||||||
#define VERSION_REVISION "215"
|
#define VERSION_REVISION "216"
|
||||||
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
|
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
|
||||||
// server info.
|
// server info.
|
||||||
#define RTMP_SIG_SRS_KEY "SRS"
|
#define RTMP_SIG_SRS_KEY "SRS"
|
||||||
|
|
|
@ -169,6 +169,11 @@ int main(int argc, char** argv)
|
||||||
if ((ret = _srs_log->initialize()) != ERROR_SUCCESS) {
|
if ((ret = _srs_log->initialize()) != ERROR_SUCCESS) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we check the config when the log initialized.
|
||||||
|
if ((ret = _srs_config->check_config()) != ERROR_SUCCESS) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
srs_trace("srs(simple-rtmp-server) "RTMP_SIG_SRS_VERSION);
|
srs_trace("srs(simple-rtmp-server) "RTMP_SIG_SRS_VERSION);
|
||||||
srs_trace("license: "RTMP_SIG_SRS_LICENSE);
|
srs_trace("license: "RTMP_SIG_SRS_LICENSE);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue