Skip to content

Commit e4f531c

Browse files
committed
fixed:build error and remove audio fifo
1 parent 8b9594e commit e4f531c

File tree

2 files changed

+17
-41
lines changed

2 files changed

+17
-41
lines changed

XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskPost/TaskPost_BackService.cpp

Lines changed: 15 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,50 +6,36 @@ static XHANDLE xhAudio = NULL;
66
static XHANDLE xhSound = NULL;
77
static XHANDLE xhScreen = NULL;
88
static XHANDLE xhPacket = NULL;
9-
static XHANDLE xhAudioFifo = NULL;
109
static XHANDLE xhFilter = 0;
1110

12-
void XCALLBACK HTTPTask_TaskPost_CBVideo(AVCODEC_VIDEO_MSGBUFFER* pSt_MSGBuffer, XPVOID lParam)
11+
void XCALLBACK HTTPTask_TaskPost_CBVideo(XHANDLE*** pppSt_AVBuffer, XPVOID lParam)
1312
{
1413
int nListCount = 0;
15-
AVCODEC_VIDEO_MSGBUFFER** ppSt_MSGBuffer;
16-
pSt_MSGBuffer->st_TimeStamp = {};
17-
VideoCodec_Stream_EnCodec(xhVideo, pSt_MSGBuffer, &ppSt_MSGBuffer, &nListCount);
14+
XHANDLE** ppSt_AVPacket;
15+
VideoCodec_Stream_EnCodec(xhVideo, pppSt_AVBuffer, &ppSt_AVPacket, &nListCount);
1816
for (int i = 0; i < nListCount; i++)
1917
{
20-
AVFormat_Packet_StreamWrite(xhPacket, 0, ppSt_MSGBuffer[i]->st_MSGBuffer.unData.ptszMSGBuffer, ppSt_MSGBuffer[i]->st_MSGBuffer.nMSGLen[0], &ppSt_MSGBuffer[i]->st_TimeStamp);
21-
BaseLib_Memory_MSGFree(&ppSt_MSGBuffer[i]->st_MSGBuffer);
18+
AVFormat_Packet_StreamWrite(xhPacket, 0, ppSt_AVPacket[i]);
2219
}
23-
BaseLib_Memory_Free((XPPPMEM)&ppSt_MSGBuffer, nListCount);
20+
AVHelp_Memory_FreeAVList(&ppSt_AVPacket, nListCount);
2421
}
25-
void XCALLBACK HTTPTask_TaskPost_CBAudio(AVCODEC_AUDIO_MSGBUFFER* pSt_MSGBuffer, XPVOID lParam)
22+
void XCALLBACK HTTPTask_TaskPost_CBAudio(XHANDLE*** pppSt_AVBuffer, XPVOID lParam)
2623
{
2724
int nListCount = 0;
28-
AVCODEC_AUDIO_MSGBUFFER** ppSt_MSGBuffer;
29-
AVFilter_Audio_Cvt(xhFilter, pSt_MSGBuffer, &ppSt_MSGBuffer, &nListCount);
25+
XHANDLE** ppSt_MSGBuffer;
26+
AVFilter_Audio_Cvt(xhFilter, pppSt_AVBuffer, &ppSt_MSGBuffer, &nListCount);
3027
for (int i = 0; i < nListCount; i++)
3128
{
32-
AudioCodec_Help_FifoSend(xhAudioFifo, ppSt_MSGBuffer[i]);
33-
while (true)
29+
int nAudioCount = 0;
30+
XHANDLE** ppSt_AVPacket;
31+
AudioCodec_Stream_EnCodec(xhAudio, ppSt_MSGBuffer[i], &ppSt_AVPacket, &nAudioCount);
32+
for (int j = 0; j < nAudioCount; j++)
3433
{
35-
AVCODEC_AUDIO_MSGBUFFER st_MSGBuffer = {};
36-
if (!AudioCodec_Help_FifoRecv(xhAudioFifo, &st_MSGBuffer))
37-
{
38-
break;
39-
}
40-
int nAudioCount = 0;
41-
AVCODEC_AUDIO_MSGBUFFER** ppSt_AudioBuffer;
42-
AudioCodec_Stream_EnCodec(xhAudio, &st_MSGBuffer, &ppSt_AudioBuffer, &nAudioCount);
43-
for (int j = 0; j < nAudioCount; j++)
44-
{
45-
AVFormat_Packet_StreamWrite(xhPacket, 1, ppSt_AudioBuffer[j]->st_MSGBuffer.unData.ptszMSGArray[0], ppSt_AudioBuffer[j]->st_MSGBuffer.nMSGLen[0], &ppSt_AudioBuffer[j]->st_TimeStamp);
46-
BaseLib_Memory_MSGFree(&ppSt_AudioBuffer[j]->st_MSGBuffer);
47-
}
48-
BaseLib_Memory_Free((XPPPMEM)&ppSt_AudioBuffer, nAudioCount);
34+
AVFormat_Packet_StreamWrite(xhPacket, 1, ppSt_AVPacket[j]);
4935
}
50-
BaseLib_Memory_MSGFree(&ppSt_MSGBuffer[i]->st_MSGBuffer);
36+
AVHelp_Memory_FreeAVList(&ppSt_AVPacket, nAudioCount);
5137
}
52-
BaseLib_Memory_Free((XPPPMEM)&ppSt_MSGBuffer, nListCount);
38+
AVHelp_Memory_FreeAVList(&ppSt_MSGBuffer, nListCount, false);
5339
}
5440

5541
bool HTTPTask_TaskPost_BackService(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nMsgLen, int nType)
@@ -411,15 +397,6 @@ bool HTTPTask_TaskPost_BackService(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer
411397
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,初始化音频采集器请求失败,错误码:%lX"), lpszClientAddr, AudioCodec_GetLastError());
412398
return false;
413399
}
414-
xhAudioFifo = AudioCodec_Help_FifoInit(ENUM_AVCODEC_AUDIO_SAMPLEFMT_FLTP, 2);
415-
if (NULL == xhAudioFifo)
416-
{
417-
st_HDRParam.nHttpCode = 400;
418-
HttpProtocol_Server_SendMsgEx(xhHTTPPacket, m_MemorySend.get(), &nSDLen, &st_HDRParam);
419-
XEngine_Network_Send(lpszClientAddr, m_MemorySend.get(), nSDLen);
420-
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,初始化音频采集器请求失败,错误码:%lX"), lpszClientAddr, AudioCodec_GetLastError());
421-
return false;
422-
}
423400
XHANDLE xhAudioCodec = NULL;
424401
AudioCodec_Stream_GetAVCodec(xhAudio, &xhAudioCodec);
425402
AVFormat_Packet_StreamCreate(xhPacket, xhAudioCodec);
@@ -448,7 +425,6 @@ bool HTTPTask_TaskPost_BackService(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer
448425

449426
VideoCodec_Stream_Destroy(xhVideo);
450427
AudioCodec_Stream_Destroy(xhAudio);
451-
AudioCodec_Help_FifoClose(xhAudioFifo);
452428

453429
AVFilter_Audio_Destroy(xhFilter);
454430

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#pragma once
2-
void XCALLBACK HTTPTask_TaskPost_CBVideo(XENGINE_MSGBUFFER* pSt_MSGBuffer, AVCODEC_TIMESTAMP* pSt_TimeInfo, int nNBSample, int nSampleFmt, XPVOID lParam);
3-
void XCALLBACK HTTPTask_TaskPost_CBAudio(XENGINE_MSGBUFFER* pSt_MSGBuffer, AVCODEC_TIMESTAMP* pSt_TimeInfo, int nNBSample, int nSampleFmt, XPVOID lParam);
2+
void XCALLBACK HTTPTask_TaskPost_CBVideo(XHANDLE*** pppSt_AVBuffer, XPVOID lParam);
3+
void XCALLBACK HTTPTask_TaskPost_CBAudio(XHANDLE*** pppSt_AVBuffer, XPVOID lParam);
44

55
bool HTTPTask_TaskPost_BackService(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nMsgLen, int nType);

0 commit comments

Comments
 (0)