Fix parse srs version bug

pull/790/head
winlin 8 years ago
parent c849010fe2
commit 26c20db2b3

1
trunk/.gitignore vendored

@ -31,4 +31,5 @@
/research/speex/
/test/
.DS_Store
srs

@ -2176,16 +2176,19 @@ int SrsRtmpClient::connect_app(string app, string tcUrl, SrsRequest* r, bool dsu
if ((prop = arr->ensure_property_number("srs_pid")) != NULL) {
si->pid = (int)prop->to_number();
}
if ((prop = arr->ensure_property_number("srs_version")) != NULL) {
if ((prop = arr->ensure_property_string("srs_version")) != NULL) {
vector<string> versions = srs_string_split(prop->to_str(), ".");
if (versions.size() > 3) {
si->build = ::atoi(versions.at(3).c_str());
} else if (versions.size() > 2) {
si->revision = ::atoi(versions.at(2).c_str());
} else if (versions.size() > 1) {
si->minor = ::atoi(versions.at(1).c_str());
} else if (versions.size() > 0) {
if (versions.size() > 0) {
si->major = ::atoi(versions.at(0).c_str());
if (versions.size() > 1) {
si->minor = ::atoi(versions.at(1).c_str());
if (versions.size() > 2) {
si->revision = ::atoi(versions.at(2).c_str());
if (versions.size() > 3) {
si->build = ::atoi(versions.at(3).c_str());
}
}
}
}
}
}

Loading…
Cancel
Save