Compare commits

...

2 Commits

Author SHA1 Message Date
xia-chu
6c82601fe2 修复状态紊乱导致访问空指针的bug
Some checks failed
Android / build (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Docker / build (push) Has been cancelled
Linux / build (push) Has been cancelled
Linux_Python / build (push) Has been cancelled
macOS / build (push) Has been cancelled
macOS_Python / build (push) Has been cancelled
Windows / build (push) Has been cancelled
Windows_Python / build (push) Has been cancelled
有用户反馈崩溃在此处,尝试修复之
2026-03-01 12:11:47 +08:00
xia-chu
725fdf1786 http api请求有json body才解析 2026-02-25 12:21:43 +08:00
2 changed files with 12 additions and 10 deletions

View File

@ -225,16 +225,18 @@ ApiArgsType getAllArgs(const Parser &parser) {
allArgs[pr.first] = strCoding::UrlDecodeComponent(pr.second);
}
} else if (parser["Content-Type"].find("application/json") == 0) {
try {
stringstream ss(parser.content());
Value jsonArgs;
ss >> jsonArgs;
auto keys = jsonArgs.getMemberNames();
for (auto key = keys.begin(); key != keys.end(); ++key) {
allArgs[*key] = jsonArgs[*key].asString();
if (!parser.content().empty()) {
try {
stringstream ss(parser.content());
Value jsonArgs;
ss >> jsonArgs;
auto keys = jsonArgs.getMemberNames();
for (auto key = keys.begin(); key != keys.end(); ++key) {
allArgs[*key] = jsonArgs[*key].asString();
}
} catch (std::exception &ex) {
WarnL << ex.what();
}
} catch (std::exception &ex) {
WarnL << ex.what();
}
} else if (!parser["Content-Type"].empty()) {
WarnL << "invalid Content-Type:" << parser["Content-Type"];

View File

@ -114,7 +114,7 @@ void WebRtcPusher::onRecvRtp(MediaTrack &track, const string &rid, RtpPacket::Pt
void WebRtcPusher::onStartWebRTC() {
WebRtcTransportImp::onStartWebRTC();
_simulcast = _answer_sdp->supportSimulcast();
if (canRecvRtp()) {
if (canRecvRtp() && _push_src) {
_push_src->setSdp(_answer_sdp->toRtspSdp());
}
}