winlin

add utest for config full.conf, fix the chunk-size bug

... ... @@ -1587,27 +1587,38 @@ SrsConfDirective* SrsConfig::get_refer_publish(string vhost)
int SrsConfig::get_chunk_size(string vhost)
{
if (vhost.empty()) {
return get_global_chunk_size();
}
SrsConfDirective* conf = get_vhost(vhost);
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");
if (!conf) {
// vhost does not specify the chunk size,
// use the global instead.
conf = root->get("chunk_size");
if (!conf) {
return SRS_CONSTS_RTMP_SRS_CHUNK_SIZE;
}
return ::atoi(conf->arg0().c_str());
return get_global_chunk_size();
}
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());
}
SrsConfDirective* SrsConfig::get_forward(string vhost)
{
SrsConfDirective* conf = get_vhost(vhost);
... ...
... ... @@ -490,12 +490,19 @@ public:
virtual SrsConfDirective* get_refer_publish(std::string 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);
private:
/**
* get the global chunk size.
*/
virtual int get_global_chunk_size();
// forward section
public:
/**
*
* get the forward directive of vhost.
*/
virtual SrsConfDirective* get_forward(std::string vhost);
// http_hooks section
... ...