Skip to content

Commit bf31faf

Browse files
committed
modify:webrtc process code
1 parent 62472eb commit bf31faf

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PullStream/PullStream_ClientWebRtc.cpp

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,28 +73,48 @@ bool PullStream_ClientWebRtc_Handle(RFCCOMPONENTS_HTTP_REQPARAM* pSt_HTTPParam,
7373
bool bBundle = false;
7474
bool bRTCPMux = false;
7575
int nListCount = 0;
76+
XCHAR tszICEUser[MAX_PATH] = {};
77+
XCHAR tszICEPass[MAX_PATH] = {};
78+
XCHAR tszHMacStr[MAX_PATH] = {};
7679
STREAMMEDIA_SDPPROTOCOL_ATTR** ppSt_ListAttr;
7780
SDPProtocol_Parse_GetAttr(xhParse, &ppSt_ListAttr, &nListCount);
7881
for (int i = 0; i < nListCount; i++)
7982
{
8083
LPCXSTR lpszAttrGroup = _X("group");
8184
LPCXSTR lpszAttrMux = _X("rtcp-mux");
85+
LPCXSTR lpszICEUfrag = _X("ice-ufrag");
86+
LPCXSTR lpszICEPwd = _X("ice-pwd");
87+
LPCXSTR lpszFinger = _X("fingerprint");
8288
if (0 == _tcsxnicmp(lpszAttrGroup, ppSt_ListAttr[i]->tszAttrKey, _tcsxlen(lpszAttrGroup)))
8389
{
8490
LPCXSTR lpszBundleStr = _X("BUNDLE");
8591
if (0 == _tcsxnicmp(lpszBundleStr, ppSt_ListAttr[i]->tszAttrValue, _tcsxlen(lpszBundleStr)))
8692
{
8793
//是否启用了端口一致绑定
8894
bBundle = true;
89-
break;
9095
}
9196
}
9297
else if (0 == _tcsxnicmp(lpszAttrMux, ppSt_ListAttr[i]->tszAttrKey, _tcsxlen(lpszAttrMux)))
9398
{
9499
bRTCPMux = true; //复用端口检查
95100
}
96-
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("SDPProtocol_Parse_GetAttr:%s-%s"), ppSt_ListAttr[i]->tszAttrKey, ppSt_ListAttr[i]->tszAttrValue);
101+
else if (0 == _tcsxnicmp(lpszICEUfrag, ppSt_ListAttr[i]->tszAttrKey, _tcsxlen(lpszICEUfrag)))
102+
{
103+
_tcsxcpy(tszICEUser, ppSt_ListAttr[i]->tszAttrValue);
104+
}
105+
else if (0 == _tcsxnicmp(lpszICEPwd, ppSt_ListAttr[i]->tszAttrKey, _tcsxlen(lpszICEPwd)))
106+
{
107+
_tcsxcpy(tszICEPass, ppSt_ListAttr[i]->tszAttrValue);
108+
}
109+
else if (0 == _tcsxnicmp(lpszFinger, ppSt_ListAttr[i]->tszAttrKey, _tcsxlen(lpszFinger)))
110+
{
111+
XCHAR tszKeyStr[MAX_PATH] = {};
112+
BaseLib_OperatorString_GetKeyValue(ppSt_ListAttr[i]->tszAttrValue, _X(" "), tszKeyStr, tszHMacStr);
113+
}
97114
}
115+
SDPProtocol_Parse_Destory(xhParse);
116+
BaseLib_OperatorMemory_Free((XPPPMEM)&ppSt_ListAttr, nListCount);
117+
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("WEBRTC:%s,请求的SDP信息属性解析完毕,总共解析了:%d 个属性"), nListCount);
98118

99119
SDPProtocol_Packet_Create(&xhPacket);
100120
SDPProtocol_Packet_Owner(xhPacket, _X("rtc"), xhPacket, _X("0.0.0.0"));
@@ -110,11 +130,15 @@ bool PullStream_ClientWebRtc_Handle(RFCCOMPONENTS_HTTP_REQPARAM* pSt_HTTPParam,
110130
SDPProtocol_Packet_OptionalAddAttr(xhPacket, _X("msid-semantic"), _X("WMS live/livestream"));
111131
SDPProtocol_Packet_AddMedia(xhPacket, _X("audio"), _X("UDP/TLS/RTP/SAVPF"), &pptszAVList, 1);
112132

113-
ModuleProtocol_Packet_Comm(tszRVBuffer, &nRVLen);
133+
SDPProtocol_Packet_OptionalAddAttr(xhPacket, _X("ice-ufrag"), "j107le40");
134+
SDPProtocol_Packet_OptionalAddAttr(xhPacket, _X("ice-pwd"), "3321308h8i6vt3769r6638l1409d50jz");
135+
136+
SDPProtocol_Packet_GetPacket(xhPacket, tszRVBuffer, &nRVLen);
137+
SDPProtocol_Packet_Destory(xhPacket);
138+
139+
st_HDRParam.nHttpCode = 201;
114140
HttpProtocol_Server_SendMsgEx(xhHttpPacket, tszSDBuffer, &nSDLen, &st_HDRParam, tszRVBuffer, nRVLen);
115141
XEngine_Network_Send(lpszClientAddr, tszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_HTTP);
116-
SDPProtocol_Parse_Destory(xhParse);
117-
SDPProtocol_Packet_Destory(xhPacket);
118-
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("WEBRTC:%s,WHIP协议拉流请求成功"), lpszClientAddr);
142+
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("WEBRTC:%s,WHEP协议拉流请求成功"), lpszClientAddr);
119143
return true;
120144
}

0 commit comments

Comments
 (0)