Skip to content

Commit 257134a

Browse files
authored
Merge pull request #10 from libxengine/develop
V2.3.0.1001 Merge
2 parents 1ec8a62 + c6a5226 commit 257134a

File tree

74 files changed

+2379
-1664
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+2379
-1664
lines changed

CHANGELOG

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,51 @@
1+
XEngine_StreamMedia V2.3.0.1001
2+
3+
增加:队列模块
4+
增加:HLS配置项目
5+
增加:srt解析转换程序线程
6+
优化:av头包函数
7+
修改:h264的sei会被解析为头的问题
8+
修改:始终更新avc视频参数配置信息在rtmp推流的时候
9+
修改:xstream http支持
10+
修改:xstream http 帧大小字段
11+
修改:http任务区分post和get
12+
修改:为拉流修改提交名称方法名字
13+
修改:jt1078 推流支持
14+
修正:当程序退出的时候崩溃的问题
15+
修正:FLV TAG大小不正确导致某些网页播放器无法播放的问题
16+
修正:srt任务程序释放内存错误
17+
修正:没有hTTP跨域控制字段的问题
18+
修正:播放客户端只支持一个的问题
19+
修正:xstream h264nalu头的解析问题
20+
修正:SRT客户端退出没有关闭资源的问题
21+
修正:如果没有音频,设置时间戳不被设置的问题
22+
修正:发布流退出的时候创建流的问题
23+
删除:会话模块的获取和设置音视频缓冲区
24+
删除:JT1078 2014解析代码
25+
26+
added:queue module
27+
added:hls configure
28+
added:srt parse process thread
29+
improved:avhdr packet function
30+
modify:The sei of h264 is also parsed as a header.
31+
modify:always update avc configure at the rtmp push
32+
modify:xstream http supported
33+
modify:xstream http chunked has frame size
34+
modify:http tasks are divided into post and get
35+
modify:post name to method name for pull stream
36+
modify:jt1078 push stream supported
37+
fixed:crashed when app exit
38+
fixed:flv.js does not play because tagsize is not right
39+
fixed:the problem free memory error that srt task
40+
fixed:http Access-Control-Allow-Origin not set
41+
fixed:just play once client
42+
fixed:the problem that not support parse nalu header of h264
43+
fixed:does not close srt client
44+
fixed:if not audio,then video time will not set
45+
fixed:create stream when publish stream exit
46+
delete:get and set av buffer for push of session module
47+
delete:jt1078 2014 was deleted
48+
=======================================================
149
XEngine_StreamMedia V2.2.0.1001
250

351
添加:SRT推拉流支持
@@ -115,7 +163,6 @@ XEngine_StreamMedia V1.2.0.1001
115163
修正:关闭通知没有释放通道内存的问题
116164
修正:停止锁不正确的问题
117165
修正:Center没有正确释放内存的问题
118-
删除:插件池支持
119166

120167
added:http request return to json payload
121168
added:comm packet for protocol module

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ c c++ streammedia server  
2020
1. RTMP(H264,H265,AAC)
2121
2. XStream
2222
3. SRT
23-
4. JT1078(planning)
23+
4. JT1078
2424
5. GB28181(planning)
2525
6. WEBRTC(planning)
2626

XEngine_APPClient/APPClient_FLVPull/APPClient_FLVPull.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ int main()
3636
WSAStartup(MAKEWORD(2, 2), &st_WSAData);
3737
#endif
3838
XNETHANDLE xhToken = 0;
39-
LPCXSTR lpszFLVUrl = _X("http://127.0.0.1:5600/api?stream=play&sms=live/qyt&type=flv");
39+
LPCXSTR lpszFLVUrl = _X("http://127.0.0.1:5600/api?stream=play&sms=live/013699435573_1&type=flv");
4040

4141
pSt_File = _xtfopen("D:\\XEngine_StreamMedia\\XEngine_APPClient\\Debug\\1.flv", "wb");
4242

4343
APIClient_Http_Create(&xhToken, APPClient_FLVPull_Callback);
4444
APIClient_Http_SetUrl(xhToken, lpszFLVUrl, _X("GET"));
4545
APIClient_Http_Excute(xhToken);
4646

47-
std::this_thread::sleep_for(std::chrono::seconds(10));
47+
std::this_thread::sleep_for(std::chrono::seconds(20));
4848

4949
APIClient_Http_Close(xhToken);
5050
fclose(pSt_File);
Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
#ifdef _MSC_BUILD
2+
#include <windows.h>
3+
#include <tchar.h>
4+
#pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib")
5+
#pragma comment(lib,"XEngine_Core/XEngine_OPenSsl")
6+
#pragma comment(lib,"XEngine_Client/XClient_Socket")
7+
#pragma comment(lib,"XEngine_AVCodec/XEngine_AVHelp")
8+
#pragma comment(lib,"Ws2_32")
9+
#endif
10+
#include <thread>
11+
#include <XEngine_Include/XEngine_CommHdr.h>
12+
#include <XEngine_Include/XEngine_Types.h>
13+
#include <XEngine_Include/XEngine_ProtocolHdr.h>
14+
#include <XEngine_Include/XEngine_BaseLib/BaseLib_Define.h>
15+
#include <XEngine_Include/XEngine_BaseLib/BaseLib_Error.h>
16+
#include <XEngine_Include/XEngine_Core/OPenSsl_Define.h>
17+
#include <XEngine_Include/XEngine_Core/OPenSsl_Error.h>
18+
#include <XEngine_Include/XEngine_Client/XClient_Define.h>
19+
#include <XEngine_Include/XEngine_Client/XClient_Error.h>
20+
#include <XEngine_Include/XEngine_AVCodec/AVCollect_Define.h>
21+
#include <XEngine_Include/XEngine_AVCodec/VideoCodec_Define.h>
22+
#include <XEngine_Include/XEngine_AVCodec/AVHelp_Define.h>
23+
#include <XEngine_Include/XEngine_AVCodec/AVHelp_Error.h>
24+
#include "../../XEngine_Source/XEngine_UserProtocol.h"
25+
using namespace std;
26+
27+
//需要优先配置XEngine
28+
//WINDOWS使用VS2022 x86 或者 x64 debug 编译
29+
//linux::g++ -std=c++17 -Wall -g APPClient_JT1078.cpp -o APPClient_JT1078.exe -L /usr/local/lib/XEngine_Release/XEngine_BaseLib -L /usr/local/lib/XEngine_Release/XEngine_NetHelp -L /usr/local/lib/XEngine_Release/XEngine_SystemSdk -L ../../XEngine_Source/XEngine_ThirdPart/jsoncpp -lXEngine_BaseLib -lNetHelp_APIClient -lXEngine_SystemApi -ljsoncpp
30+
//macos::g++ -std=c++17 -Wall -g APPClient_JT1078.cpp -o APPClient_JT1078.exe -lXEngine_BaseLib -lNetHelp_APIClient -lXEngine_SystemApi -ljsoncpp
31+
32+
void XEngine_Device_StrtoBCD(LPCXSTR lpszPhoneCode, XBYTE* ptszBCD)
33+
{
34+
for (int i = 0, nPos = 0; i < 6; i++)
35+
{
36+
OPenSsl_Codec_2BytesToBCD(&lpszPhoneCode[nPos], ptszBCD[i]);
37+
nPos += 2;
38+
}
39+
}
40+
41+
int main()
42+
{
43+
WSADATA st_WSAData;
44+
WSAStartup(MAKEWORD(2, 2), &st_WSAData);
45+
46+
LPCXSTR lpszFile = _X("D:\\h264 file\\1080P.264");
47+
LPCXSTR lpszPhone = _X("013699435573");
48+
LPCXSTR lpszAddr = _X("127.0.0.1");
49+
int nPort = 5602;
50+
XSOCKET hSocket;
51+
52+
if (!XClient_TCPSelect_Create(&hSocket, lpszAddr, nPort))
53+
{
54+
_xtprintf(_X("连接失败"));
55+
return -1;
56+
}
57+
58+
FILE *pSt_File = _xtfopen(lpszFile, _X("rb"));
59+
if (NULL == pSt_File)
60+
{
61+
_xtprintf(_X("文件打开失败!"));
62+
return -1;
63+
}
64+
65+
int nSeq = 0;
66+
XNETHANDLE xhToken = 0;
67+
AVHelp_Parse_FrameInit(&xhToken, ENUM_XENGINE_AVCODEC_VIDEO_TYPE_H264);
68+
69+
while (true)
70+
{
71+
XCHAR tszRVBuffer[8192];
72+
memset(tszRVBuffer, '\0', sizeof(tszRVBuffer));
73+
74+
int nRet = fread(tszRVBuffer, 1, sizeof(tszRVBuffer), pSt_File);
75+
if (nRet <= 0)
76+
{
77+
fclose(pSt_File);
78+
pSt_File = _xtfopen(lpszFile, _X("rb"));
79+
if (NULL == pSt_File)
80+
{
81+
break;
82+
}
83+
}
84+
int nListCount = 0;
85+
AVHELP_FRAMEDATA** ppSt_Frame;
86+
AVHelp_Parse_FrameGet(xhToken, tszRVBuffer, nRet, &ppSt_Frame, &nListCount);
87+
for (int i = 0; i < nListCount; i++)
88+
{
89+
bool bFirst = true;
90+
int nCpyCount = 0;
91+
int nUseCount = 0;
92+
int nMsgCount = ppSt_Frame[i]->nMsgLen;
93+
XENGINE_AVCODEC_VIDEOFRAMETYPE enFrameType;
94+
95+
printf("%d\n", nMsgCount);
96+
AVHelp_Parse_NaluType((LPCXSTR)ppSt_Frame[i]->ptszMsgBuffer, ENUM_XENGINE_AVCODEC_VIDEO_TYPE_H264, &enFrameType);
97+
while (nMsgCount > 0)
98+
{
99+
XENGINE_RTPPACKETHDR st_RTPPacket;
100+
XENGINE_RTPPACKETTAIL st_PacketTail;
101+
102+
memset(&st_RTPPacket, '\0', sizeof(XENGINE_RTPPACKETHDR));
103+
memset(&st_PacketTail, '\0', sizeof(XENGINE_RTPPACKETTAIL));
104+
105+
st_RTPPacket.byFlags[0] = 0x30;
106+
st_RTPPacket.byFlags[1] = 0x31;
107+
st_RTPPacket.byFlags[2] = 0x63;
108+
st_RTPPacket.byFlags[3] = 0x64;
109+
110+
st_RTPPacket.byV = 2;
111+
st_RTPPacket.byX = 0;
112+
st_RTPPacket.byCC = 1;
113+
st_RTPPacket.byM = 0;
114+
st_RTPPacket.byPT = 98;
115+
116+
st_RTPPacket.byChannel = 1;
117+
st_RTPPacket.byType = 0;
118+
st_RTPPacket.byPacket = 0;
119+
120+
if (nMsgCount > 950)
121+
{
122+
if (bFirst)
123+
{
124+
st_RTPPacket.byPacket = 1;
125+
bFirst = false;
126+
}
127+
else
128+
{
129+
st_RTPPacket.byPacket = 3;
130+
}
131+
nCpyCount = 950;
132+
}
133+
else
134+
{
135+
st_RTPPacket.byM = 1;
136+
st_RTPPacket.byPacket = 2;
137+
nCpyCount = nMsgCount;
138+
}
139+
140+
if (ENUM_XENGINE_AVCODEC_VIDEO_FRAMETYPE_P == enFrameType)
141+
{
142+
st_RTPPacket.byType = 1;
143+
}
144+
else
145+
{
146+
st_RTPPacket.byType = 0;
147+
}
148+
149+
st_RTPPacket.wSerial = htons(nSeq++);
150+
XEngine_Device_StrtoBCD(lpszPhone, st_RTPPacket.bySIMNumber);
151+
BaseLib_OperatorTime_SetXTPTime(&st_RTPPacket.ullTimestamp);
152+
153+
int nPos = 0;
154+
XCHAR tszMsgBuffer[2048];
155+
memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
156+
157+
memcpy(tszMsgBuffer, &st_RTPPacket, sizeof(XENGINE_RTPPACKETHDR));
158+
nPos += sizeof(XENGINE_RTPPACKETHDR);
159+
160+
memcpy(tszMsgBuffer + nPos, &st_PacketTail, sizeof(XENGINE_RTPPACKETTAIL));
161+
nPos += sizeof(XENGINE_RTPPACKETTAIL);
162+
163+
XSHOT wLen = htons(nCpyCount);
164+
memcpy(tszMsgBuffer + nPos, &wLen, sizeof(XSHOT));
165+
nPos += sizeof(XSHOT);
166+
167+
XClient_TCPSelect_SendMsg(hSocket, tszMsgBuffer, nPos);
168+
XClient_TCPSelect_SendMsg(hSocket, (LPCXSTR)ppSt_Frame[i]->ptszMsgBuffer + nUseCount, nCpyCount);
169+
nUseCount += nCpyCount;
170+
nMsgCount -= nCpyCount;
171+
}
172+
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ppSt_Frame[i]->ptszMsgBuffer);
173+
}
174+
BaseLib_OperatorMemory_Free((XPPPMEM)&ppSt_Frame, nListCount);
175+
std::this_thread::sleep_for(std::chrono::milliseconds(40));
176+
}
177+
AVHelp_Parse_FrameClose(xhToken);
178+
179+
WSACleanup();
180+
return 0;
181+
}

0 commit comments

Comments
 (0)