rtsp服务器支持发送rtcp包

This commit is contained in:
xiongziliang 2019-05-08 18:46:56 +08:00
parent bceff73429
commit fe19ea3991

View File

@ -1210,7 +1210,8 @@ inline void RtspSession::sendRtpPacket(const RtpPacket::Ptr & pkt) {
#ifdef RTSP_SEND_RTCP #ifdef RTSP_SEND_RTCP
inline void RtspSession::sendSenderReport(bool overTcp,int iTrackIndex) { inline void RtspSession::sendSenderReport(bool overTcp,int iTrackIndex) {
uint8_t aui8Rtcp[4 + 28 + 10 + sizeof(SERVER_NAME) + 1] = {0}; static const char server_name[] = "ZLMediaKitRtsp";
uint8_t aui8Rtcp[4 + 28 + 10 + sizeof(server_name) + 1] = {0};
uint8_t *pui8Rtcp_SR = aui8Rtcp + 4, *pui8Rtcp_SDES = pui8Rtcp_SR + 28; uint8_t *pui8Rtcp_SR = aui8Rtcp + 4, *pui8Rtcp_SDES = pui8Rtcp_SR + 28;
auto &track = _aTrackInfo[iTrackIndex]; auto &track = _aTrackInfo[iTrackIndex];
auto &counter = _aRtcpCnt[iTrackIndex]; auto &counter = _aRtcpCnt[iTrackIndex];
@ -1258,8 +1259,8 @@ inline void RtspSession::sendSenderReport(bool overTcp,int iTrackIndex) {
pui8Rtcp_SDES[8] = 0x01; pui8Rtcp_SDES[8] = 0x01;
pui8Rtcp_SDES[9] = 0x0f; pui8Rtcp_SDES[9] = 0x0f;
memcpy(&pui8Rtcp_SDES[10], SERVER_NAME, sizeof(SERVER_NAME)); memcpy(&pui8Rtcp_SDES[10], server_name, sizeof(server_name));
pui8Rtcp_SDES[10 + sizeof(SERVER_NAME)] = 0x00; pui8Rtcp_SDES[10 + sizeof(server_name)] = 0x00;
if(overTcp){ if(overTcp){
send(obtainBuffer((char *) aui8Rtcp, sizeof(aui8Rtcp))); send(obtainBuffer((char *) aui8Rtcp, sizeof(aui8Rtcp)));