Optimize the code

1. change param_strs to params
2. move params from MediaInfo to MediaTuple
3. passing MediaTuple as a parameter for some functions
This commit is contained in:
xia-chu
2024-03-30 14:41:20 +08:00
parent ecc05dae28
commit 390c374086
13 changed files with 31 additions and 39 deletions

View File

@@ -583,7 +583,7 @@ void MediaInfo::parse(const std::string &url_in){
auto url = url_in;
auto pos = url.find("?");
if (pos != string::npos) {
param_strs = url.substr(pos + 1);
params = url.substr(pos + 1);
url.erase(pos);
}
@@ -616,9 +616,10 @@ void MediaInfo::parse(const std::string &url_in){
stream = stream_id;
}
auto params = Parser::parseArgs(param_strs);
if (params.find(VHOST_KEY) != params.end()) {
vhost = params[VHOST_KEY];
auto kv = Parser::parseArgs(params);
auto it = kv.find(VHOST_KEY);
if (it != kv.end()) {
vhost = it->second;
}
GET_CONFIG(bool, enableVhost, General::kEnableVhost);