mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
add utest for config full.conf, fix the chunk-size bug
This commit is contained in:
parent
ffa72d3522
commit
f1b1dc0c64
3 changed files with 1073 additions and 8 deletions
|
@ -1587,22 +1587,33 @@ SrsConfDirective* SrsConfig::get_refer_publish(string vhost)
|
||||||
|
|
||||||
int SrsConfig::get_chunk_size(string vhost)
|
int SrsConfig::get_chunk_size(string vhost)
|
||||||
{
|
{
|
||||||
|
if (vhost.empty()) {
|
||||||
|
return get_global_chunk_size();
|
||||||
|
}
|
||||||
|
|
||||||
SrsConfDirective* conf = get_vhost(vhost);
|
SrsConfDirective* conf = get_vhost(vhost);
|
||||||
|
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
return SRS_CONSTS_RTMP_SRS_CHUNK_SIZE;
|
// vhost does not specify the chunk size,
|
||||||
|
// use the global instead.
|
||||||
|
return get_global_chunk_size();
|
||||||
}
|
}
|
||||||
|
|
||||||
conf = conf->get("chunk_size");
|
conf = conf->get("chunk_size");
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
// vhost does not specify the chunk size,
|
// vhost does not specify the chunk size,
|
||||||
// use the global instead.
|
// use the global instead.
|
||||||
conf = root->get("chunk_size");
|
return get_global_chunk_size();
|
||||||
if (!conf) {
|
|
||||||
return SRS_CONSTS_RTMP_SRS_CHUNK_SIZE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ::atoi(conf->arg0().c_str());
|
return ::atoi(conf->arg0().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
int SrsConfig::get_global_chunk_size()
|
||||||
|
{
|
||||||
|
SrsConfDirective* conf = root->get("chunk_size");
|
||||||
|
if (!conf) {
|
||||||
|
return SRS_CONSTS_RTMP_SRS_CHUNK_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ::atoi(conf->arg0().c_str());
|
return ::atoi(conf->arg0().c_str());
|
||||||
|
|
|
@ -490,12 +490,19 @@ public:
|
||||||
virtual SrsConfDirective* get_refer_publish(std::string vhost);
|
virtual SrsConfDirective* get_refer_publish(std::string vhost);
|
||||||
/**
|
/**
|
||||||
* get the chunk size of vhost.
|
* get the chunk size of vhost.
|
||||||
|
* @param vhost, the vhost to get the chunk size. use global if not specified.
|
||||||
|
* empty string to get the global.
|
||||||
*/
|
*/
|
||||||
virtual int get_chunk_size(std::string vhost);
|
virtual int get_chunk_size(std::string vhost);
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* get the global chunk size.
|
||||||
|
*/
|
||||||
|
virtual int get_global_chunk_size();
|
||||||
// forward section
|
// forward section
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
*
|
* get the forward directive of vhost.
|
||||||
*/
|
*/
|
||||||
virtual SrsConfDirective* get_forward(std::string vhost);
|
virtual SrsConfDirective* get_forward(std::string vhost);
|
||||||
// http_hooks section
|
// http_hooks section
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue