Skip to content

Commit 692e987

Browse files
committed
added:configure for webrtc
modify:audio webrtc sdp info added
1 parent b37781a commit 692e987

File tree

6 files changed

+36
-4
lines changed

6 files changed

+36
-4
lines changed

XEngine_Source/XEngine_BuildSwitch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
// Purpose: 编译开关选项
1111
// History:
1212
*********************************************************************/
13-
#define _XENGINE_STREAMMEDIA_BUILDSWITCH_SRT 0 //SRT协议编译开关选项
14-
#define _XENGINE_STREAMMEDIA_BUILDSWITCH_RTC 0 //WEBRTC协议编译开关选项
13+
#define _XENGINE_STREAMMEDIA_BUILDSWITCH_SRT 1 //SRT协议编译开关选项
14+
#define _XENGINE_STREAMMEDIA_BUILDSWITCH_RTC 1 //WEBRTC协议编译开关选项

XEngine_Source/XEngine_ModuleConfigure/ModuleConfig_Define.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,11 @@ typedef struct tag_XEngine_ServiceConfig
8989
}st_PullRtsp;
9090
struct
9191
{
92-
bool bEnable;
92+
XCHAR tszPrivateKey[MAX_PATH];
93+
XCHAR tszPublicKey[MAX_PATH];
94+
XCHAR tszRequestKey[MAX_PATH];
9395
int nSTUNPort;
96+
bool bEnable;
9497
}st_PullWebRtc;
9598
}st_XPull;
9699
struct

XEngine_Source/XEngine_ModuleConfigure/ModuleConfigure_Json/ModuleConfigure_Json.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE
155155
_tcsxcpy(pSt_ServerConfig->st_XPull.st_PullHls.tszHLSPath, st_PullHls["tszHLSPath"].asCString());
156156

157157
pSt_ServerConfig->st_XPull.st_PullWebRtc.nSTUNPort = st_PullWebRtc["nSTUNPort"].asInt();
158+
_tcsxcpy(pSt_ServerConfig->st_XPull.st_PullWebRtc.tszPrivateKey, st_PullWebRtc["RSAPrivateKey"].asCString());
159+
_tcsxcpy(pSt_ServerConfig->st_XPull.st_PullWebRtc.tszPublicKey, st_PullWebRtc["RSAPublicKey"].asCString());
160+
_tcsxcpy(pSt_ServerConfig->st_XPull.st_PullWebRtc.tszRequestKey, st_PullWebRtc["RSARequestKey"].asCString());
158161
//日志配置
159162
if (st_JsonRoot["XLog"].empty() || (3 != st_JsonRoot["XLog"].size()))
160163
{

XEngine_Source/XEngine_ModuleHelp/pch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <WinSock2.h>
1515
#endif
1616
#endif //PCH_H
17+
#include "../XEngine_BuildSwitch.h"
1718
#include <string.h>
1819
#include <errno.h>
1920
#include <time.h>
@@ -34,7 +35,6 @@ using namespace std;
3435
#include <XEngine_Include/XEngine_Core/OPenSsl_Define.h>
3536
#include <XEngine_Include/XEngine_Core/OPenSsl_Error.h>
3637
#include "../XEngine_UserProtocol.h"
37-
#include "../XEngine_BuildSwitch.h"
3838
#include "ModuleHelp_Define.h"
3939
#include "ModuleHelp_Error.h"
4040
/********************************************************************

XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PullStream/PullStream_ClientWebRtc.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,31 @@ bool PullStream_ClientWebRtc_Handle(RFCCOMPONENTS_HTTP_REQPARAM* pSt_HTTPParam,
133133
SDPProtocol_Packet_OptionalAddAttr(xhPacket, _X("ice-ufrag"), "j107le40");
134134
SDPProtocol_Packet_OptionalAddAttr(xhPacket, _X("ice-pwd"), "3321308h8i6vt3769r6638l1409d50jz");
135135

136+
int nDLen = 0;
137+
XBYTE tszDigestStr[MAX_PATH] = {};
138+
XCHAR tszDigestHex[MAX_PATH] = {};
139+
int nPos = _xstprintf(tszDigestHex, _X("sha-256 "));
140+
OPenSsl_Api_Digest(st_ServiceConfig.st_XPull.st_PullWebRtc.tszRequestKey, tszDigestStr, &nDLen, true, XENGINE_OPENSSL_API_DIGEST_SHA256);
141+
for (int i = 0; i < nDLen; i++)
142+
{
143+
int nRet = _xstprintf(tszDigestHex + nPos, _X("%02X"), tszDigestStr[i]);
144+
nPos += nRet;
145+
tszDigestHex[nPos] = ':';
146+
nPos++;
147+
}
148+
tszDigestHex[nPos - 1] = '\0';
149+
150+
SDPProtocol_Packet_OptionalAddAttr(xhPacket, _X("fingerprint"), tszDigestHex);
151+
SDPProtocol_Packet_OptionalAddAttr(xhPacket, _X("setup"), _X("passive"));
152+
SDPProtocol_Packet_OptionalAddAttr(xhPacket, _X("mid"), _X("0"));
153+
SDPProtocol_Packet_OptionalAddAttr(xhPacket, _X("extmap"), _X("3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"));
154+
SDPProtocol_Packet_OnlyRWFlag(xhPacket, true);
155+
SDPProtocol_Packet_RtcpComm(xhPacket, true, true);
156+
SDPProtocol_Packet_OptionalAddAttr(xhPacket, _X("rtpmap"), _X("111 opus/48000/2"));
157+
SDPProtocol_Packet_OptionalAddAttr(xhPacket, _X("rtcp-fb"), _X("111 transport-cc"));
158+
SDPProtocol_Packet_OptionalAddAttr(xhPacket, _X("ssrc"), _X("2124085006 cname:79a9722580589zr5"));
159+
SDPProtocol_Packet_OptionalAddAttr(xhPacket, _X("ssrc"), _X("2124085006 label:audio-23z8fj2g"));
160+
136161
SDPProtocol_Packet_GetPacket(xhPacket, tszRVBuffer, &nRVLen);
137162
SDPProtocol_Packet_Destory(xhPacket);
138163
BaseLib_OperatorMemory_Free((XPPPMEM)&pptszAVList, 1);

XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_Hdr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ using namespace std;
6464
#include <XEngine_Include/XEngine_SystemSdk/SystemApi_Define.h>
6565
#include <XEngine_Include/XEngine_SystemSdk/SystemApi_Error.h>
6666
//加载项目相关头文件
67+
#include "../../XEngine_BuildSwitch.h"
6768
#include "../../XEngine_UserProtocol.h"
6869
#include "../../XEngine_ModuleConfigure/ModuleConfig_Define.h"
6970
#include "../../XEngine_ModuleConfigure/ModuleConfig_Error.h"

0 commit comments

Comments
 (0)