ABLMediaServer程序的重要函数

1.CNetRevcBase类是所有类的基类

(1)virtual int InputNetData(NETHANDLE nServerHandle, NETHANDLE nClientHandle, uint8_t* pData, uint32_t nDataLength,void* address) = 0;//接收网络数据
(2)virtual int ProcessNetData() = 0;//处理网络数据,比如进行解包、发送网络数据等等

(3)virtual int PushVideo(uint8_t* pVideoData, uint32_t nDataLength,char* szVideoCodec) = 0;//塞入视频数据
virtual int PushAudio(uint8_t* pVideoData, uint32_t nDataLength,char* szAudioCodec,int nChannels,int SampleRate) = 0;//塞入音频数据

(4)virtual int SendVideo() = 0;//发送视频数据
virtual int SendAudio() = 0;//发送音频数据

2.InputNetData、ProcessNetData的调用 

(1)ABLMediaServer.cpp的回调函数void LIBNET_CALLMETHOD onread。

(2)onread通过基类CNetRevcBase调用InputNetData函数。

(3)通过CNetBaseThreadPool插入到线程池中。

(4)在线程池中ProcessFunc调用ProcessNetData。

3.PushVideo(PushAudio)调用 

(1)在NetRtspServer.cpp中ProcessNetData中调用InputRtspData(data_, data_Length);
(2)在NetRtspServer.cpp中InputRtspData中ANNOUNCE通过rtp_depacket_start设置回调函数rtppacket_callback。
(3)在NetRtspServer.cpp中rtppacket_callback调用CMediaStreamSource中的PushVideo(PushAudio)。
(4)在MediaStreamSource.cpp中pClient->PushVideo(PushAudio)调用NetRtspServer.cpp中的PushVideo(PushAudio)。

4.SendVideo(SendAudio)调用

(1)在ABLMediaServer.cpp中,
pMediaSendThreadPool = new CMediaSendThreadPool(ABL_MediaServerPort.nSendThreadCount);
创建发送线程。
(2)在NetRtspServer.cpp中,InputRtspData函数“PLAY”中
pMediaSendThreadPool->AddClientToThreadPool(nClient);//媒体发送线程
将拉流端加入到发送线程中。
(3)在MediaSendThreadPool.cpp中AddClientToThreadPool创建线程调用OnProcessThread函数。
(4)在MediaSendThreadPool.cpp中OnProcessThread函数调用ProcessFunc函数。
(5)在MediaSendThreadPool.cpp中ProcessFunc函数调用NetRtspServer.cpp中的SendVideo和SendAudio。
(6)在NetRtspServer.cpp中的SendVideo和SendAudio组RTP包。
(7)在NetRtspServer.cpp中,InputRtspData函数“DESCRIBE”中
GetRtspSDPFromMediaStreamSource(sdpContent,bGetSDP).
(8)在NetRtspServer.cpp中GetRtspSDPFromMediaStreamSource
int nRet = rtp_packet_start(Video_rtp_packet_callback_func, (void*)this, &hRtpVideo);
(9)在NetRtspServer.cpp中Video_rtp_packet_callback_func和Audio_rtp_packet_callback_func
(10)在NetRtspServer.cpp中Video_rtp_packet_callback_func和Audio_rtp_packet_callback_func调用SumSendRtpMediaBuffer
(11)在NetRtspServer.cpp中SumSendRtpMediaBuffer调用XHNetSDK_Write发送。

 

posted @ 2022-11-02 11:42  泽良_小涛  阅读(233)  评论(0编辑  收藏  举报