Commit 58799473 by xiongziliang

webrtc url添加session参数,用于hook追踪会话唯一性

parent b0af3334
ZLToolKit @ b82ceb10
Subproject commit 03433394e9923685cd5856dc308da877b2d1e81f Subproject commit b82ceb1054581e8b54fdc8467acd04727cb417cf
...@@ -1371,7 +1371,9 @@ void installWebApi() { ...@@ -1371,7 +1371,9 @@ void installWebApi() {
#ifdef ENABLE_WEBRTC #ifdef ENABLE_WEBRTC
class WebRtcArgsImp : public WebRtcArgs { class WebRtcArgsImp : public WebRtcArgs {
public: public:
WebRtcArgsImp(const HttpAllArgs<string> &args) : _args(args) {} WebRtcArgsImp(const HttpAllArgs<string> &args, std::string session_id)
: _args(args)
, _session_id(std::move(session_id)) {}
~WebRtcArgsImp() override = default; ~WebRtcArgsImp() override = default;
variant operator[](const string &key) const override { variant operator[](const string &key) const override {
...@@ -1387,11 +1389,12 @@ void installWebApi() { ...@@ -1387,11 +1389,12 @@ void installWebApi() {
CHECK_ARGS("app", "stream"); CHECK_ARGS("app", "stream");
return StrPrinter << RTC_SCHEMA << "://" << _args["Host"] << "/" << _args["app"] << "/" return StrPrinter << RTC_SCHEMA << "://" << _args["Host"] << "/" << _args["app"] << "/"
<< _args["stream"] << "?" << _args.getParser().Params(); << _args["stream"] << "?" << _args.getParser().Params() + "&session=" + _session_id;
} }
private: private:
HttpAllArgs<string> _args; HttpAllArgs<string> _args;
std::string _session_id;
}; };
api_regist("/index/api/webrtc",[](API_ARGS_STRING_ASYNC){ api_regist("/index/api/webrtc",[](API_ARGS_STRING_ASYNC){
...@@ -1400,7 +1403,8 @@ void installWebApi() { ...@@ -1400,7 +1403,8 @@ void installWebApi() {
auto offer = allArgs.getArgs(); auto offer = allArgs.getArgs();
CHECK(!offer.empty(), "http body(webrtc offer sdp) is empty"); CHECK(!offer.empty(), "http body(webrtc offer sdp) is empty");
WebRtcPluginManager::Instance().getAnswerSdp(*(static_cast<Session *>(&sender)), type, offer, WebRtcArgsImp(allArgs), WebRtcPluginManager::Instance().getAnswerSdp(
*(static_cast<Session *>(&sender)), type, offer, WebRtcArgsImp(allArgs, sender.getIdentifier()),
[invoker, val, offer, headerOut](const WebRtcInterface &exchanger) mutable { [invoker, val, offer, headerOut](const WebRtcInterface &exchanger) mutable {
//设置返回类型 //设置返回类型
headerOut["Content-Type"] = HttpFileManager::getContentType(".json"); headerOut["Content-Type"] = HttpFileManager::getContentType(".json");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论