1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

merge from wenjie: support set chunk size at vhost level

This commit is contained in:
winlin 2013-12-22 12:23:20 +08:00
parent 309322fd5c
commit 725ff8e5a5
4 changed files with 41 additions and 8 deletions

View file

@ -173,7 +173,7 @@ int SrsClient::service_cycle()
req->strip();
srs_trace("identify client success. type=%d, stream_name=%s", type, req->stream.c_str());
int chunk_size = config->get_chunk_size();
int chunk_size = config->get_chunk_size(req->vhost);
if ((ret = rtmp->set_chunk_size(chunk_size)) != ERROR_SUCCESS) {
srs_error("set chunk_size=%d failed. ret=%d", chunk_size, ret);
return ret;

View file

@ -2,6 +2,7 @@
The MIT License (MIT)
Copyright (c) 2013 winlin
Copyright (c) 2013 wenjiegit
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
@ -1442,14 +1443,27 @@ SrsConfDirective* SrsConfig::get_listen()
return root->get("listen");
}
int SrsConfig::get_chunk_size()
int SrsConfig::get_chunk_size(const std::string &vhost)
{
SrsConfDirective* conf = root->get("chunk_size");
if (!conf) {
SrsConfDirective* conf = get_vhost(vhost);
if (!conf) {
return SRS_CONF_DEFAULT_CHUNK_SIZE;
}
return ::atoi(conf->arg0().c_str());
}
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_CONF_DEFAULT_CHUNK_SIZE;
}
return ::atoi(conf->arg0().c_str());
}
return ::atoi(conf->arg0().c_str());
}
int SrsConfig::get_pithy_print_publish()

View file

@ -2,6 +2,7 @@
The MIT License (MIT)
Copyright (c) 2013 winlin
Copyright (c) 2013 wenjiegit
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
@ -162,7 +163,7 @@ public:
virtual SrsConfDirective* get_refer_play(std::string vhost);
virtual SrsConfDirective* get_refer_publish(std::string vhost);
virtual SrsConfDirective* get_listen();
virtual int get_chunk_size();
virtual int get_chunk_size(const std::string& vhost);
virtual int get_pithy_print_publish();
virtual int get_pithy_print_forwarder();
virtual int get_pithy_print_encoder();