fix rtsp player pull hik record stream (#2624 #2701)

修复rtsp 拉流 sdp中全局a:control:获取失败的bug
This commit is contained in:
xiongguangjie 2023-07-25 15:47:28 +08:00 committed by GitHub
parent 9317665058
commit e8f8b48d38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -166,13 +166,13 @@ void SdpParser::load(const string &sdp) {
string opt_val = line.substr(2); string opt_val = line.substr(2);
switch (opt) { switch (opt) {
case 't': case 't':
if (_track_vec.empty()) if (_track_vec.size() == 1)
global_infos.emplace(opt, opt_val); global_infos.emplace(opt, opt_val);
else else
track->_t = opt_val; track->_t = opt_val;
break; break;
case 'b': case 'b':
if (_track_vec.empty()) if (_track_vec.size() == 1)
global_infos.emplace(opt, opt_val); global_infos.emplace(opt, opt_val);
else else
track->_b = opt_val; track->_b = opt_val;
@ -195,12 +195,12 @@ void SdpParser::load(const string &sdp) {
case 'a': { case 'a': {
string attr = findSubString(opt_val.data(), nullptr, ":"); string attr = findSubString(opt_val.data(), nullptr, ":");
if (attr.empty()) { if (attr.empty()) {
if (_track_vec.empty()) if (_track_vec.size() == 1)
global_infos.emplace(opt, opt_val); global_infos.emplace(opt, opt_val);
else else
track->_attr.emplace(opt_val, ""); track->_attr.emplace(opt_val, "");
} else { } else {
if (_track_vec.empty()) if (_track_vec.size() == 1)
global_infos.emplace(opt, opt_val); global_infos.emplace(opt, opt_val);
else else
track->_attr.emplace(attr, findSubString(opt_val.data(), ":", nullptr)); track->_attr.emplace(attr, findSubString(opt_val.data(), ":", nullptr));
@ -208,7 +208,7 @@ void SdpParser::load(const string &sdp) {
break; break;
} }
default: { default: {
if (_track_vec.empty()) { if (_track_vec.size() == 1) {
global_infos.emplace(opt, opt_val); global_infos.emplace(opt, opt_val);
} else { } else {
track->_other[opt] = opt_val; track->_other[opt] = opt_val;