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

For #1509, decrease the fast vector init size from 64KB to 64B. 3.0.99

This commit is contained in:
winlin 2020-01-15 21:26:02 +08:00
parent 857c783efc
commit 7240fe3040
7 changed files with 17 additions and 31 deletions

View file

@ -6771,22 +6771,22 @@ string SrsConfig::get_vhost_http_dir(string vhost)
bool SrsConfig::get_vhost_http_remux_enabled(string vhost)
{
static bool DEFAULT = false;
SrsConfDirective* conf = get_vhost(vhost);
if (!conf) {
return DEFAULT;
}
conf = conf->get("http_remux");
if (!conf) {
return DEFAULT;
}
conf = conf->get("enabled");
if (!conf || conf->arg0().empty()) {
return DEFAULT;
}
return SRS_CONF_PERFER_FALSE(conf->arg0());
}

View file

@ -1023,7 +1023,7 @@ srs_error_t SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandle
if (it == tflvs.end()) {
return err;
}
// hstrs always enabled.
// for origin, the http stream will be mount already when publish,
// so it must never enter this line for stream already mounted.
@ -1064,7 +1064,7 @@ srs_error_t SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandle
if (srs_string_count(upath, "/") != srs_string_count(entry->mount, "/")) {
return err;
}
// convert to concreate class.
SrsHttpMessage* hreq = dynamic_cast<SrsHttpMessage*>(request);
srs_assert(hreq);
@ -1127,7 +1127,7 @@ srs_error_t SrsHttpStreamServer::initialize_flv_streaming()
if (!conf->is_vhost()) {
continue;
}
if ((err = initialize_flv_entry(conf->arg0())) != srs_success) {
return srs_error_wrap(err, "init flv entries");
}
@ -1139,7 +1139,7 @@ srs_error_t SrsHttpStreamServer::initialize_flv_streaming()
srs_error_t SrsHttpStreamServer::initialize_flv_entry(std::string vhost)
{
srs_error_t err = srs_success;
if (!_srs_config->get_vhost_http_remux_enabled(vhost)) {
return err;
}

View file

@ -154,7 +154,7 @@ int64_t SrsRtmpJitter::get_time()
SrsFastVector::SrsFastVector()
{
count = 0;
nb_msgs = SRS_PERF_MW_MSGS * 8;
nb_msgs = 8;
msgs = new SrsSharedPtrMessage*[nb_msgs];
}
@ -212,7 +212,7 @@ void SrsFastVector::push_back(SrsSharedPtrMessage* msg)
{
// increase vector.
if (count >= nb_msgs) {
int size = nb_msgs * 2;
int size = srs_max(SRS_PERF_MW_MSGS * 8, nb_msgs * 2);
SrsSharedPtrMessage** buf = new SrsSharedPtrMessage*[size];
for (int i = 0; i < nb_msgs; i++) {
buf[i] = msgs[i];

View file

@ -27,7 +27,7 @@
// The version config.
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_REVISION 98
#define VERSION_REVISION 99
// The macros generated by configure script.
#include <srs_auto_headers.hpp>