Skip to content

Commit 8c27b77

Browse files
committed
added:set and get for rtc module with addr and connect
modify:dtls connect flags judgment modify:rtc rtcp judgment
1 parent 5ba07ef commit 8c27b77

File tree

6 files changed

+326
-17
lines changed

6 files changed

+326
-17
lines changed

XEngine_Source/XEngine_ModuleSession/ModuleSession_Define.h

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ typedef struct
3030
XCHAR tszICEUser[MAX_PATH];
3131
XCHAR tszICEPass[MAX_PATH];
3232
XCHAR tszHMacStr[MAX_PATH];
33+
XCHAR tszClientAddr[128];
34+
bool bConnect;
3335

3436
__int64x nVSsrc;
3537
XCHAR tszVideoCName[MAX_PATH];
@@ -185,6 +187,7 @@ extern "C" bool ModuleSession_PullStream_PublishDelete(LPCXSTR lpszClientAddr);
185187
备注:
186188
*********************************************************************/
187189
extern "C" bool ModuleSession_PullStream_GetList(STREAMMEDIA_PULLLISTINFO*** pppSt_PullList, int* pInt_ListCount);
190+
//////////////////////////////////////////////////////////////////////////
188191
/********************************************************************
189192
函数名称:ModuleSession_PullStream_FLVTagSet
190193
函数功能:设置会话的FLV标签大小
@@ -223,6 +226,7 @@ extern "C" bool ModuleSession_PullStream_FLVTagSet(LPCXSTR lpszClientAddr, int n
223226
备注:
224227
*********************************************************************/
225228
extern "C" bool ModuleSession_PullStream_FLVTagGet(LPCXSTR lpszClientAddr, int* pInt_TagSize);
229+
//////////////////////////////////////////////////////////////////////////
226230
/********************************************************************
227231
函数名称:ModuleSession_PullStream_RTCSet
228232
函数功能:设置RTC流的信息
@@ -325,6 +329,82 @@ extern "C" bool ModuleSession_PullStream_RTCGet(LPCXSTR lpszClientAddr, XCHAR *
325329
备注:
326330
*********************************************************************/
327331
extern "C" bool ModuleSession_PullStream_RTCSSrcSet(LPCXSTR lpszClientAddr, __int64x nSSrc, LPCXSTR lpszCNameStr, LPCXSTR lpszLabelStr, bool bVideo = true);
332+
/********************************************************************
333+
函数名称:ModuleSession_PullStream_RTCAddrSet
334+
函数功能:设置RTC的数据通信地址
335+
参数.一:lpszClientUser
336+
In/Out:In
337+
类型:常量字符指针
338+
可空:N
339+
意思:输入要操作的用户
340+
参数.二:lpszClientAddr
341+
In/Out:In
342+
类型:常量字符指针
343+
可空:N
344+
意思:输入绑定的地址
345+
返回值
346+
类型:逻辑型
347+
意思:是否成功
348+
备注:
349+
*********************************************************************/
350+
extern "C" bool ModuleSession_PullStream_RTCAddrSet(LPCXSTR lpszClientUser, LPCXSTR lpszClientAddr);
351+
/********************************************************************
352+
函数名称:ModuleSession_PullStream_RTCAddrGet
353+
函数功能:获取地址绑定的用户
354+
参数.一:lpszClientAddr
355+
In/Out:In
356+
类型:常量字符指针
357+
可空:N
358+
意思:输入要操作的地址
359+
参数.二:ptszClientUser
360+
In/Out:Out
361+
类型:字符指针
362+
可空:N
363+
意思:输出绑定的用户
364+
返回值
365+
类型:逻辑型
366+
意思:是否成功
367+
备注:
368+
*********************************************************************/
369+
extern "C" bool ModuleSession_PullStream_RTCAddrGet(LPCXSTR lpszClientAddr, XCHAR* ptszClientUser);
370+
/********************************************************************
371+
函数名称:ModuleSession_PullStream_RTCConnSet
372+
函数功能:设置RTC用户是否链接
373+
参数.一:lpszClientAddr
374+
In/Out:In
375+
类型:常量字符指针
376+
可空:N
377+
意思:输入要操作的地址
378+
参数.二:bConnect
379+
In/Out:In
380+
类型:逻辑型
381+
可空:N
382+
意思:是否链接
383+
返回值
384+
类型:逻辑型
385+
意思:是否成功
386+
备注:
387+
*********************************************************************/
388+
extern "C" bool ModuleSession_PullStream_RTCConnSet(LPCXSTR lpszClientAddr, bool bConnect);
389+
/********************************************************************
390+
函数名称:ModuleSession_PullStream_RTCConnGet
391+
函数功能:获取RTC是否链接
392+
参数.一:lpszClientAddr
393+
In/Out:In
394+
类型:常量字符指针
395+
可空:N
396+
意思:输入要操作的地址
397+
参数.二:pbConnect
398+
In/Out:Out
399+
类型:逻辑型指针
400+
可空:N
401+
意思:输出是否链接
402+
返回值
403+
类型:逻辑型
404+
意思:是否成功
405+
备注:
406+
*********************************************************************/
407+
extern "C" bool ModuleSession_PullStream_RTCConnGet(LPCXSTR lpszClientAddr, bool* pbConnect);
328408
/*********************************************************************************
329409
* 推流端导出会话模块 *
330410
*********************************************************************************/

XEngine_Source/XEngine_ModuleSession/ModuleSession_PullStream/ModuleSession_PullStream.cpp

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,4 +565,177 @@ bool CModuleSession_PullStream::ModuleSession_PullStream_RTCSSrcSet(LPCXSTR lpsz
565565
}
566566
st_Locker.unlock_shared();
567567
return true;
568+
}
569+
/********************************************************************
570+
函数名称:ModuleSession_PullStream_RTCAddrSet
571+
函数功能:设置RTC的数据通信地址
572+
参数.一:lpszClientUser
573+
In/Out:In
574+
类型:常量字符指针
575+
可空:N
576+
意思:输入要操作的用户
577+
参数.二:lpszClientAddr
578+
In/Out:In
579+
类型:常量字符指针
580+
可空:N
581+
意思:输入绑定的地址
582+
返回值
583+
类型:逻辑型
584+
意思:是否成功
585+
备注:
586+
*********************************************************************/
587+
bool CModuleSession_PullStream::ModuleSession_PullStream_RTCAddrSet(LPCXSTR lpszClientUser, LPCXSTR lpszClientAddr)
588+
{
589+
Session_IsErrorOccur = false;
590+
591+
st_Locker.lock_shared();
592+
auto stl_MapIterator = stl_MapClient.find(lpszClientUser);
593+
if (stl_MapIterator == stl_MapClient.end())
594+
{
595+
Session_IsErrorOccur = true;
596+
Session_dwErrorCode = ERROR_STREAMMEDIA_MODULE_SESSION_NOTFOUND;
597+
st_Locker.unlock_shared();
598+
return false;
599+
}
600+
_tcsxcpy(stl_MapIterator->second->st_WEBRtc.tszClientAddr, lpszClientAddr);
601+
st_Locker.unlock_shared();
602+
return true;
603+
}
604+
/********************************************************************
605+
函数名称:ModuleSession_PullStream_RTCAddrGet
606+
函数功能:获取地址绑定的用户
607+
参数.一:lpszClientAddr
608+
In/Out:In
609+
类型:常量字符指针
610+
可空:N
611+
意思:输入要操作的地址
612+
参数.二:ptszClientUser
613+
In/Out:Out
614+
类型:字符指针
615+
可空:N
616+
意思:输出绑定的用户
617+
返回值
618+
类型:逻辑型
619+
意思:是否成功
620+
备注:
621+
*********************************************************************/
622+
bool CModuleSession_PullStream::ModuleSession_PullStream_RTCAddrGet(LPCXSTR lpszClientAddr, XCHAR* ptszClientUser)
623+
{
624+
Session_IsErrorOccur = false;
625+
626+
bool bFound = false;
627+
628+
st_Locker.lock_shared();
629+
for (auto stl_MapIterator = stl_MapClient.begin(); stl_MapIterator != stl_MapClient.end(); stl_MapIterator++)
630+
{
631+
if (ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PULL_RTC == stl_MapIterator->second->enStreamType)
632+
{
633+
if (0 == _tcsxnicmp(lpszClientAddr, stl_MapIterator->second->st_WEBRtc.tszClientAddr, _tcsxlen(lpszClientAddr)))
634+
{
635+
bFound = true;
636+
break;
637+
}
638+
}
639+
}
640+
st_Locker.unlock_shared();
641+
642+
if (!bFound)
643+
{
644+
Session_IsErrorOccur = true;
645+
Session_dwErrorCode = ERROR_STREAMMEDIA_MODULE_SESSION_NOTFOUND;
646+
return false;
647+
}
648+
return true;
649+
}
650+
/********************************************************************
651+
函数名称:ModuleSession_PullStream_RTCConnSet
652+
函数功能:设置RTC用户是否链接
653+
参数.一:lpszClientAddr
654+
In/Out:In
655+
类型:常量字符指针
656+
可空:N
657+
意思:输入要操作的地址
658+
参数.二:bConnect
659+
In/Out:In
660+
类型:逻辑型
661+
可空:N
662+
意思:是否链接
663+
返回值
664+
类型:逻辑型
665+
意思:是否成功
666+
备注:
667+
*********************************************************************/
668+
bool CModuleSession_PullStream::ModuleSession_PullStream_RTCConnSet(LPCXSTR lpszClientAddr, bool bConnect)
669+
{
670+
Session_IsErrorOccur = false;
671+
672+
bool bFound = false;
673+
st_Locker.lock_shared();
674+
for (auto stl_MapIterator = stl_MapClient.begin(); stl_MapIterator != stl_MapClient.end(); stl_MapIterator++)
675+
{
676+
if (ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PULL_RTC == stl_MapIterator->second->enStreamType)
677+
{
678+
if (0 == _tcsxnicmp(lpszClientAddr, stl_MapIterator->second->st_WEBRtc.tszClientAddr, _tcsxlen(lpszClientAddr)))
679+
{
680+
bFound = true;
681+
stl_MapIterator->second->st_WEBRtc.bConnect = bConnect;
682+
break;
683+
}
684+
}
685+
}
686+
st_Locker.unlock_shared();
687+
688+
if (!bFound)
689+
{
690+
Session_IsErrorOccur = true;
691+
Session_dwErrorCode = ERROR_STREAMMEDIA_MODULE_SESSION_NOTFOUND;
692+
return false;
693+
}
694+
return true;
695+
}
696+
/********************************************************************
697+
函数名称:ModuleSession_PullStream_RTCConnGet
698+
函数功能:获取RTC是否链接
699+
参数.一:lpszClientAddr
700+
In/Out:In
701+
类型:常量字符指针
702+
可空:N
703+
意思:输入要操作的地址
704+
参数.二:pbConnect
705+
In/Out:Out
706+
类型:逻辑型指针
707+
可空:N
708+
意思:输出是否链接
709+
返回值
710+
类型:逻辑型
711+
意思:是否成功
712+
备注:
713+
*********************************************************************/
714+
bool CModuleSession_PullStream::ModuleSession_PullStream_RTCConnGet(LPCXSTR lpszClientAddr, bool* pbConnect)
715+
{
716+
Session_IsErrorOccur = false;
717+
718+
bool bFound = false;
719+
st_Locker.lock_shared();
720+
for (auto stl_MapIterator = stl_MapClient.begin(); stl_MapIterator != stl_MapClient.end(); stl_MapIterator++)
721+
{
722+
if (ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PULL_RTC == stl_MapIterator->second->enStreamType)
723+
{
724+
if (0 == _tcsxnicmp(lpszClientAddr, stl_MapIterator->second->st_WEBRtc.tszClientAddr, _tcsxlen(lpszClientAddr)))
725+
{
726+
bFound = true;
727+
*pbConnect = stl_MapIterator->second->st_WEBRtc.bConnect;
728+
break;
729+
}
730+
}
731+
}
732+
st_Locker.unlock_shared();
733+
734+
if (!bFound)
735+
{
736+
Session_IsErrorOccur = true;
737+
Session_dwErrorCode = ERROR_STREAMMEDIA_MODULE_SESSION_NOTFOUND;
738+
return false;
739+
}
740+
return true;
568741
}

XEngine_Source/XEngine_ModuleSession/ModuleSession_PullStream/ModuleSession_PullStream.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ class CModuleSession_PullStream
3131
bool ModuleSession_PullStream_RTCGet(LPCXSTR lpszClientAddr, XCHAR* ptszTokenStr = NULL, XCHAR* ptszICEUser = NULL, XCHAR* ptszICEPass = NULL, XCHAR* ptszHMacStr = NULL);
3232
bool ModuleSession_PullStream_RTCSSrcSet(LPCXSTR lpszClientAddr, __int64x nSSrc, LPCXSTR lpszCNameStr, LPCXSTR lpszLabelStr, bool bVideo = true);
3333
//bool ModuleSession_PullStream_RTCSSrcGet(LPCXSTR lpszClientAddr, XCHAR* ptszTokenStr = NULL, XCHAR* ptszICEUser = NULL, XCHAR* ptszICEPass = NULL, XCHAR* ptszHMacStr = NULL);
34+
bool ModuleSession_PullStream_RTCAddrSet(LPCXSTR lpszClientUser, LPCXSTR lpszClientAddr);
35+
bool ModuleSession_PullStream_RTCAddrGet(LPCXSTR lpszClientAddr, XCHAR* ptszClientUser);
36+
bool ModuleSession_PullStream_RTCConnSet(LPCXSTR lpszClientAddr, bool bConnect);
37+
bool ModuleSession_PullStream_RTCConnGet(LPCXSTR lpszClientAddr, bool* pbConnect);
38+
//bool ModuleSession_PullStream_RTCSHandshakeSet(LPCXSTR lpszClientAddr, __int64x nSSrc, LPCXSTR lpszCNameStr, LPCXSTR lpszLabelStr, bool bVideo = true);
39+
//bool ModuleSession_PullStream_RTCSHandshakeGet(LPCXSTR lpszClientAddr, __int64x nSSrc, LPCXSTR lpszCNameStr, LPCXSTR lpszLabelStr, bool bVideo = true);
3440
private:
3541
shared_mutex st_Locker;
3642
private:

XEngine_Source/XEngine_ModuleSession/XEngine_ModuleSession.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ EXPORTS
1717
ModuleSession_PullStream_RTCSet
1818
ModuleSession_PullStream_RTCGet
1919
ModuleSession_PullStream_RTCSSrcSet
20+
ModuleSession_PullStream_RTCAddrSet
21+
ModuleSession_PullStream_RTCAddrGet
22+
ModuleSession_PullStream_RTCConnSet
23+
ModuleSession_PullStream_RTCConnGet
2024

2125
ModuleSession_PushStream_Create
2226
ModuleSession_PushStream_Destroy

XEngine_Source/XEngine_ModuleSession/pch.cpp

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,24 @@ extern "C" bool ModuleSession_PullStream_GetStreamType(LPCXSTR lpszClientAddr, E
4747
{
4848
return m_PullStream.ModuleSession_PullStream_GetStreamType(lpszClientAddr, penStreamType);
4949
}
50+
extern "C" bool ModuleSession_PullStream_PublishDelete(LPCXSTR lpszClientAddr)
51+
{
52+
return m_PullStream.ModuleSession_PullStream_PublishDelete(lpszClientAddr);
53+
}
54+
extern "C" bool ModuleSession_PullStream_GetList(STREAMMEDIA_PULLLISTINFO*** pppSt_PullList, int* pInt_ListCount)
55+
{
56+
return m_PullStream.ModuleSession_PullStream_GetList(pppSt_PullList, pInt_ListCount);
57+
}
58+
//////////////////////////////////////////////////////////////////////////
59+
extern "C" bool ModuleSession_PullStream_FLVTagSet(LPCXSTR lpszClientAddr, int nTagSize)
60+
{
61+
return m_PullStream.ModuleSession_PullStream_FLVTagSet(lpszClientAddr, nTagSize);
62+
}
63+
extern "C" bool ModuleSession_PullStream_FLVTagGet(LPCXSTR lpszClientAddr, int* pInt_TagSize)
64+
{
65+
return m_PullStream.ModuleSession_PullStream_FLVTagGet(lpszClientAddr, pInt_TagSize);
66+
}
67+
//////////////////////////////////////////////////////////////////////////
5068
extern "C" bool ModuleSession_PullStream_RTCSet(LPCXSTR lpszClientAddr, LPCXSTR lpszTokenStr, LPCXSTR lpszICEUser, LPCXSTR lpszICEPass, LPCXSTR lpszHMacStr)
5169
{
5270
return m_PullStream.ModuleSession_PullStream_RTCSet(lpszClientAddr, lpszTokenStr, lpszICEUser, lpszICEPass, lpszHMacStr);
@@ -63,21 +81,21 @@ extern "C" bool ModuleSession_PullStream_Delete(LPCXSTR lpszClientAddr)
6381
{
6482
return m_PullStream.ModuleSession_PullStream_Delete(lpszClientAddr);
6583
}
66-
extern "C" bool ModuleSession_PullStream_PublishDelete(LPCXSTR lpszClientAddr)
84+
extern "C" bool ModuleSession_PullStream_RTCAddrSet(LPCXSTR lpszClientUser, LPCXSTR lpszClientAddr)
6785
{
68-
return m_PullStream.ModuleSession_PullStream_PublishDelete(lpszClientAddr);
86+
return m_PullStream.ModuleSession_PullStream_RTCAddrSet(lpszClientUser, lpszClientAddr);
6987
}
70-
extern "C" bool ModuleSession_PullStream_GetList(STREAMMEDIA_PULLLISTINFO * **pppSt_PullList, int* pInt_ListCount)
88+
extern "C" bool ModuleSession_PullStream_RTCAddrGet(LPCXSTR lpszClientAddr, XCHAR* ptszClientUser)
7189
{
72-
return m_PullStream.ModuleSession_PullStream_GetList(pppSt_PullList, pInt_ListCount);
90+
return m_PullStream.ModuleSession_PullStream_RTCAddrGet(lpszClientAddr, ptszClientUser);
7391
}
74-
extern "C" bool ModuleSession_PullStream_FLVTagSet(LPCXSTR lpszClientAddr, int nTagSize)
92+
extern "C" bool ModuleSession_PullStream_RTCConnSet(LPCXSTR lpszClientAddr, bool bConnect)
7593
{
76-
return m_PullStream.ModuleSession_PullStream_FLVTagSet(lpszClientAddr, nTagSize);
94+
return m_PullStream.ModuleSession_PullStream_RTCConnSet(lpszClientAddr, bConnect);
7795
}
78-
extern "C" bool ModuleSession_PullStream_FLVTagGet(LPCXSTR lpszClientAddr, int* pInt_TagSize)
96+
extern "C" bool ModuleSession_PullStream_RTCConnGet(LPCXSTR lpszClientAddr, bool* pbConnect)
7997
{
80-
return m_PullStream.ModuleSession_PullStream_FLVTagGet(lpszClientAddr, pInt_TagSize);
98+
return m_PullStream.ModuleSession_PullStream_RTCConnGet(lpszClientAddr, pbConnect);
8199
}
82100
/*********************************************************************************
83101
* 推流导出会话模块 *

0 commit comments

Comments
 (0)