Changeset 699
- Timestamp:
- 11/16/11 16:09:02 (6 months ago)
- Files:
-
- 26 edited
-
branches/1.0/sources/common/include/platform/android/androidplatform.h (modified) (1 diff)
-
branches/1.0/sources/common/include/platform/dfreebsd/dfreebsdplatform.h (modified) (1 diff)
-
branches/1.0/sources/common/include/platform/freebsd/freebsdplatform.h (modified) (1 diff)
-
branches/1.0/sources/common/include/platform/linux/linuxplatform.h (modified) (1 diff)
-
branches/1.0/sources/common/include/platform/openbsd/openbsdplatform.h (modified) (1 diff)
-
branches/1.0/sources/common/include/platform/osx/osxplatform.h (modified) (1 diff)
-
branches/1.0/sources/common/include/platform/solaris/solarisplatform.h (modified) (1 diff)
-
branches/1.0/sources/thelib/include/protocols/rtp/connectivity/outboundconnectivity.h (modified) (3 diffs)
-
branches/1.0/sources/thelib/include/protocols/rtp/rtspprotocol.h (modified) (1 diff)
-
branches/1.0/sources/thelib/include/protocols/rtp/streaming/outnetrtpudph264stream.h (modified) (2 diffs)
-
branches/1.0/sources/thelib/src/protocols/rtp/connectivity/outboundconnectivity.cpp (modified) (11 diffs)
-
branches/1.0/sources/thelib/src/protocols/rtp/rtspprotocol.cpp (modified) (2 diffs)
-
branches/1.0/sources/thelib/src/protocols/rtp/streaming/outnetrtpudph264stream.cpp (modified) (7 diffs)
-
trunk/sources/common/include/platform/android/androidplatform.h (modified) (1 diff)
-
trunk/sources/common/include/platform/dfreebsd/dfreebsdplatform.h (modified) (1 diff)
-
trunk/sources/common/include/platform/freebsd/freebsdplatform.h (modified) (1 diff)
-
trunk/sources/common/include/platform/linux/linuxplatform.h (modified) (1 diff)
-
trunk/sources/common/include/platform/openbsd/openbsdplatform.h (modified) (1 diff)
-
trunk/sources/common/include/platform/osx/osxplatform.h (modified) (1 diff)
-
trunk/sources/common/include/platform/solaris/solarisplatform.h (modified) (1 diff)
-
trunk/sources/thelib/include/protocols/rtp/connectivity/outboundconnectivity.h (modified) (3 diffs)
-
trunk/sources/thelib/include/protocols/rtp/rtspprotocol.h (modified) (1 diff)
-
trunk/sources/thelib/include/protocols/rtp/streaming/outnetrtpudph264stream.h (modified) (2 diffs)
-
trunk/sources/thelib/src/protocols/rtp/connectivity/outboundconnectivity.cpp (modified) (11 diffs)
-
trunk/sources/thelib/src/protocols/rtp/rtspprotocol.cpp (modified) (2 diffs)
-
trunk/sources/thelib/src/protocols/rtp/streaming/outnetrtpudph264stream.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0/sources/common/include/platform/android/androidplatform.h
r681 r699 138 138 } select_event; 139 139 140 #define MSGHDR struct msghdr 141 #define IOVEC iovec 142 #define MSGHDR_MSG_IOV msg_iov 143 #define MSGHDR_MSG_IOVLEN msg_iovlen 144 #define MSGHDR_MSG_NAME msg_name 145 #define MSGHDR_MSG_NAMELEN msg_namelen 146 #define IOVEC_IOV_BASE iov_base 147 #define IOVEC_IOV_LEN iov_len 148 #define IOVEC_IOV_BASE_TYPE uint8_t 149 #define SENDMSG(s,msg,flags,sent) sendmsg(s,msg,flags) 150 140 151 string format(string fmt, ...); 141 152 string vFormat(string fmt, va_list args); -
branches/1.0/sources/common/include/platform/dfreebsd/dfreebsdplatform.h
r681 r699 143 143 } select_event; 144 144 145 #define MSGHDR struct msghdr 146 #define IOVEC iovec 147 #define MSGHDR_MSG_IOV msg_iov 148 #define MSGHDR_MSG_IOVLEN msg_iovlen 149 #define MSGHDR_MSG_NAME msg_name 150 #define MSGHDR_MSG_NAMELEN msg_namelen 151 #define IOVEC_IOV_BASE iov_base 152 #define IOVEC_IOV_LEN iov_len 153 #define IOVEC_IOV_BASE_TYPE uint8_t 154 #define SENDMSG(s,msg,flags,sent) sendmsg(s,msg,flags) 145 155 146 156 string format(string fmt, ...); -
branches/1.0/sources/common/include/platform/freebsd/freebsdplatform.h
r681 r699 142 142 } select_event; 143 143 144 #define MSGHDR struct msghdr 145 #define IOVEC iovec 146 #define MSGHDR_MSG_IOV msg_iov 147 #define MSGHDR_MSG_IOVLEN msg_iovlen 148 #define MSGHDR_MSG_NAME msg_name 149 #define MSGHDR_MSG_NAMELEN msg_namelen 150 #define IOVEC_IOV_BASE iov_base 151 #define IOVEC_IOV_LEN iov_len 152 #define IOVEC_IOV_BASE_TYPE uint8_t 153 #define SENDMSG(s,msg,flags,sent) sendmsg(s,msg,flags) 144 154 145 155 string format(string fmt, ...); -
branches/1.0/sources/common/include/platform/linux/linuxplatform.h
r681 r699 146 146 } select_event; 147 147 148 #define MSGHDR struct msghdr 149 #define IOVEC iovec 150 #define MSGHDR_MSG_IOV msg_iov 151 #define MSGHDR_MSG_IOVLEN msg_iovlen 152 #define MSGHDR_MSG_NAME msg_name 153 #define MSGHDR_MSG_NAMELEN msg_namelen 154 #define IOVEC_IOV_BASE iov_base 155 #define IOVEC_IOV_LEN iov_len 156 #define IOVEC_IOV_BASE_TYPE uint8_t 157 #define SENDMSG(s,msg,flags,sent) sendmsg(s,msg,flags) 158 148 159 string format(string fmt, ...); 149 160 string vFormat(string fmt, va_list args); -
branches/1.0/sources/common/include/platform/openbsd/openbsdplatform.h
r681 r699 144 144 } select_event; 145 145 146 #define MSGHDR struct msghdr 147 #define IOVEC iovec 148 #define MSGHDR_MSG_IOV msg_iov 149 #define MSGHDR_MSG_IOVLEN msg_iovlen 150 #define MSGHDR_MSG_NAME msg_name 151 #define MSGHDR_MSG_NAMELEN msg_namelen 152 #define IOVEC_IOV_BASE iov_base 153 #define IOVEC_IOV_LEN iov_len 154 #define IOVEC_IOV_BASE_TYPE uint8_t 155 #define SENDMSG(s,msg,flags,sent) sendmsg(s,msg,flags) 146 156 147 157 string format(string fmt, ...); -
branches/1.0/sources/common/include/platform/osx/osxplatform.h
r681 r699 142 142 } select_event; 143 143 144 #define MSGHDR struct msghdr 145 #define IOVEC iovec 146 #define MSGHDR_MSG_IOV msg_iov 147 #define MSGHDR_MSG_IOVLEN msg_iovlen 148 #define MSGHDR_MSG_NAME msg_name 149 #define MSGHDR_MSG_NAMELEN msg_namelen 150 #define IOVEC_IOV_BASE iov_base 151 #define IOVEC_IOV_LEN iov_len 152 #define IOVEC_IOV_BASE_TYPE uint8_t 153 #define SENDMSG(s,msg,flags,sent) sendmsg(s,msg,flags) 154 144 155 string format(string fmt, ...); 145 156 string vFormat(string fmt, va_list args); -
branches/1.0/sources/common/include/platform/solaris/solarisplatform.h
r681 r699 144 144 } select_event; 145 145 146 #define MSGHDR struct msghdr 147 #define IOVEC iovec 148 #define MSGHDR_MSG_IOV msg_iov 149 #define MSGHDR_MSG_IOVLEN msg_iovlen 150 #define MSGHDR_MSG_NAME msg_name 151 #define MSGHDR_MSG_NAMELEN msg_namelen 152 #define IOVEC_IOV_BASE iov_base 153 #define IOVEC_IOV_LEN iov_len 154 #define IOVEC_IOV_BASE_TYPE uint8_t 155 #define SENDMSG(s,msg,flags,sent) sendmsg(s,msg,flags) 156 146 157 string format(string fmt, ...); 147 158 string vFormat(string fmt, va_list args); -
branches/1.0/sources/thelib/include/protocols/rtp/connectivity/outboundconnectivity.h
r696 r699 84 84 RTSPProtocol *_pRTSPProtocol; 85 85 BaseOutNetRTPUDPStream *_pOutStream; 86 msghdr_dataMessage;87 msghdr_rtcpMessage;86 MSGHDR _dataMessage; 87 MSGHDR _rtcpMessage; 88 88 uint8_t *_pRTCPNTP; 89 89 uint8_t *_pRTCPRTP; … … 108 108 NATTraversalProtocol *_pAudioNATData; 109 109 NATTraversalProtocol *_pAudioNATRTCP; 110 111 uint32_t _dummyValue; 110 112 public: 111 113 OutboundConnectivity(bool forceTcp, RTSPProtocol *pRTSPProtocol); … … 130 132 bool RegisterTCPAudioClient(uint32_t rtspProtocolId, uint8_t data, uint8_t rtcp); 131 133 void SignalDetachedFromInStream(); 132 bool FeedVideoData( msghdr&message, double absoluteTimestamp);133 bool FeedAudioData( msghdr&message, double absoluteTimestamp);134 bool FeedVideoData(MSGHDR &message, double absoluteTimestamp); 135 bool FeedAudioData(MSGHDR &message, double absoluteTimestamp); 134 136 private: 135 137 bool InitializePorts(int32_t &dataFd, uint16_t &dataPort, 136 138 NATTraversalProtocol **ppNATData, int32_t &RTCPFd, uint16_t &RTCPPort, 137 139 NATTraversalProtocol **ppNATRTCP); 138 bool FeedData( msghdr&message, double absoluteTimestamp, bool isAudio);140 bool FeedData(MSGHDR &message, double absoluteTimestamp, bool isAudio); 139 141 }; 140 142 -
branches/1.0/sources/thelib/include/protocols/rtp/rtspprotocol.h
r694 r699 133 133 134 134 bool SendRaw(uint8_t *pBuffer, uint32_t length); 135 bool SendRaw( msghdr*pMessage, uint16_t length, RTPClient *pClient,135 bool SendRaw(MSGHDR *pMessage, uint16_t length, RTPClient *pClient, 136 136 bool isAudio, bool isData); 137 137 -
branches/1.0/sources/thelib/include/protocols/rtp/streaming/outnetrtpudph264stream.h
r694 r699 29 29 bool _forceTcp; 30 30 IOBuffer _videoBuffer; 31 msghdr_videoData;31 MSGHDR _videoData; 32 32 uint8_t *_pSPS; 33 33 uint32_t _SPSLen; … … 36 36 37 37 IOBuffer _audioBuffer; 38 msghdr_audioData;38 MSGHDR _audioData; 39 39 40 40 uint64_t _audioPacketsCount; -
branches/1.0/sources/thelib/src/protocols/rtp/connectivity/outboundconnectivity.cpp
r696 r699 36 36 37 37 memset(&_dataMessage, 0, sizeof (_dataMessage)); 38 _dataMessage. msg_iov = new iovec[1];39 _dataMessage. msg_iovlen= 1;40 _dataMessage. msg_namelen= sizeof (sockaddr_in);38 _dataMessage.MSGHDR_MSG_IOV = new IOVEC[1]; 39 _dataMessage.MSGHDR_MSG_IOVLEN = 1; 40 _dataMessage.MSGHDR_MSG_NAMELEN = sizeof (sockaddr_in); 41 41 42 42 memset(&_rtcpMessage, 0, sizeof (_rtcpMessage)); 43 _rtcpMessage. msg_iov = new iovec[1];44 _rtcpMessage. msg_iovlen= 1;45 _rtcpMessage. msg_namelen= sizeof (sockaddr_in);46 _rtcpMessage. msg_iov[0].iov_len= 28;47 _rtcpMessage. msg_iov[0].iov_base = new uint8_t[_rtcpMessage.msg_iov[0].iov_len];48 ((uint8_t *) _rtcpMessage. msg_iov[0].iov_base)[0] = 0x80; //V,P,RC49 ((uint8_t *) _rtcpMessage. msg_iov[0].iov_base)[1] = 0xc8; //PT=SR=20050 EHTONSP(((uint8_t *) _rtcpMessage. msg_iov[0].iov_base) + 2, 6); //length51 EHTONLP(((uint8_t *) _rtcpMessage. msg_iov[0].iov_base) + 4, 0); //SSRC52 _pRTCPNTP = ((uint8_t *) _rtcpMessage. msg_iov[0].iov_base) + 8;53 _pRTCPRTP = ((uint8_t *) _rtcpMessage. msg_iov[0].iov_base) + 16;54 _pRTCPSPC = ((uint8_t *) _rtcpMessage. msg_iov[0].iov_base) + 20;55 _pRTCPSOC = ((uint8_t *) _rtcpMessage. msg_iov[0].iov_base) + 24;43 _rtcpMessage.MSGHDR_MSG_IOV = new IOVEC[1]; 44 _rtcpMessage.MSGHDR_MSG_IOVLEN = 1; 45 _rtcpMessage.MSGHDR_MSG_NAMELEN = sizeof (sockaddr_in); 46 _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_LEN = 28; 47 _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE = new IOVEC_IOV_BASE_TYPE[_rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_LEN]; 48 ((uint8_t *) _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[0] = 0x80; //V,P,RC 49 ((uint8_t *) _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[1] = 0xc8; //PT=SR=200 50 EHTONSP(((uint8_t *) _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 2, 6); //length 51 EHTONLP(((uint8_t *) _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 4, 0); //SSRC 52 _pRTCPNTP = ((uint8_t *) _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 8; 53 _pRTCPRTP = ((uint8_t *) _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 16; 54 _pRTCPSPC = ((uint8_t *) _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 20; 55 _pRTCPSOC = ((uint8_t *) _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 24; 56 56 57 57 _hasVideo = false; … … 75 75 76 76 OutboundConnectivity::~OutboundConnectivity() { 77 delete[] _dataMessage. msg_iov;78 delete[] ((uint8_t *) _rtcpMessage. msg_iov[0].iov_base);79 delete[] _rtcpMessage. msg_iov;77 delete[] _dataMessage.MSGHDR_MSG_IOV; 78 delete[] ((uint8_t *) _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE); 79 delete[] _rtcpMessage.MSGHDR_MSG_IOV; 80 80 if (_pOutStream != NULL) { 81 81 delete _pOutStream; … … 242 242 } 243 243 244 bool OutboundConnectivity::FeedVideoData( msghdr&message,244 bool OutboundConnectivity::FeedVideoData(MSGHDR &message, 245 245 double absoluteTimestamp) { 246 246 if (!FeedData(message, absoluteTimestamp, false)) { … … 251 251 } 252 252 253 bool OutboundConnectivity::FeedAudioData( msghdr&message,253 bool OutboundConnectivity::FeedAudioData(MSGHDR &message, 254 254 double absoluteTimestamp) { 255 255 if (!FeedData(message, absoluteTimestamp, true)) { … … 345 345 } 346 346 347 bool OutboundConnectivity::FeedData( msghdr&message, double absoluteTimestamp,347 bool OutboundConnectivity::FeedData(MSGHDR &message, double absoluteTimestamp, 348 348 bool isAudio) { 349 349 if (absoluteTimestamp == 0) … … 353 353 uint32_t ssrc = isAudio ? _pOutStream->AudioSSRC() : _pOutStream->VideoSSRC(); 354 354 uint16_t messageLength = 0; 355 for (uint32_t i = 0; i < (uint32_t) message. msg_iovlen; i++) {356 messageLength += message. msg_iov[i].iov_len;355 for (uint32_t i = 0; i < (uint32_t) message.MSGHDR_MSG_IOVLEN; i++) { 356 messageLength += message.MSGHDR_MSG_IOV[i].IOVEC_IOV_LEN; 357 357 } 358 358 … … 367 367 368 368 if (startRTP == 0xffffffff) { 369 startRTP = ENTOHLP(((uint8_t *) message. msg_iov[0].iov_base) + 4);369 startRTP = ENTOHLP(((uint8_t *) message.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 4); 370 370 startTS = absoluteTimestamp; 371 371 } … … 373 373 if ((packetsCount % 500) == 0) { 374 374 //FINEST("Send %c RTCP: %u", isAudio ? 'A' : 'V', packetsCount); 375 EHTONLP(((uint8_t *) _rtcpMessage. msg_iov[0].iov_base) + 4, ssrc); //SSRC375 EHTONLP(((uint8_t *) _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 4, ssrc); //SSRC 376 376 377 377 … … 393 393 //octet count 394 394 EHTONLP(_pRTCPSOC, bytesCount); 395 // FINEST("\n%s", STR(IOBuffer::DumpBuffer(((uint8_t *) _rtcpMessage. msg_iov[0].iov_base),396 // _rtcpMessage. msg_iov[0].iov_len)));395 // FINEST("\n%s", STR(IOBuffer::DumpBuffer(((uint8_t *) _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE), 396 // _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_LEN))); 397 397 398 398 if (_rtpClient.isUdp) { 399 399 int32_t rtcpFd = isAudio ? _audioRTCPFd : _videoRTCPFd; 400 400 sockaddr_in &rtcpAddress = isAudio ? _rtpClient.audioRtcpAddress : _rtpClient.videoRtcpAddress; 401 _rtcpMessage. msg_name =&rtcpAddress;402 if ( sendmsg(rtcpFd, &_rtcpMessage, 0) <=0) {401 _rtcpMessage.MSGHDR_MSG_NAME = (sockaddr *)&rtcpAddress; 402 if (SENDMSG(rtcpFd, &_rtcpMessage, 0,&_dummyValue) < 0) { 403 403 FATAL("Unable to send message"); 404 404 return false; … … 407 407 if (_pRTSPProtocol != NULL) { 408 408 if (!_pRTSPProtocol->SendRaw(&_rtcpMessage, 409 _rtcpMessage. msg_iov[0].iov_len, &_rtpClient, isAudio, false)) {409 _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_LEN, &_rtpClient, isAudio, false)) { 410 410 FATAL("Unable to send raw rtcp audio data"); 411 411 return false; … … 419 419 int32_t dataFd = isAudio ? _audioDataFd : _videoDataFd; 420 420 sockaddr_in &dataAddress = isAudio ? _rtpClient.audioDataAddress : _rtpClient.videoDataAddress; 421 message. msg_name =&dataAddress;422 if ( sendmsg(dataFd, &message, 0) < 0) {421 message.MSGHDR_MSG_NAME = (sockaddr *)&dataAddress; 422 if (SENDMSG(dataFd, &message, 0,&_dummyValue) < 0) { 423 423 int err = errno; 424 424 FATAL("Unable to send message: %d; %s", err, strerror(errno)); -
branches/1.0/sources/thelib/src/protocols/rtp/rtspprotocol.cpp
r698 r699 411 411 } 412 412 413 bool RTSPProtocol::SendRaw( msghdr*pMessage, uint16_t length, RTPClient *pClient, bool isAudio,413 bool RTSPProtocol::SendRaw(MSGHDR *pMessage, uint16_t length, RTPClient *pClient, bool isAudio, 414 414 bool isData) { 415 415 _outputBuffer.ReadFromByte((uint8_t) '$'); … … 429 429 length = EHTONS(length); 430 430 _outputBuffer.ReadFromBuffer((uint8_t *) & length, 2); 431 for (int i = 0; i < (int)pMessage-> msg_iovlen; i++) {432 _outputBuffer.ReadFromBuffer((uint8_t*) pMessage-> msg_iov[i].iov_base,433 pMessage-> msg_iov[i].iov_len);431 for (int i = 0; i < (int)pMessage->MSGHDR_MSG_IOVLEN; i++) { 432 _outputBuffer.ReadFromBuffer((uint8_t*) pMessage->MSGHDR_MSG_IOV[i].IOVEC_IOV_BASE, 433 pMessage->MSGHDR_MSG_IOV[i].IOVEC_IOV_LEN); 434 434 } 435 435 return EnqueueForOutbound(); -
branches/1.0/sources/thelib/src/protocols/rtp/streaming/outnetrtpudph264stream.cpp
r694 r699 38 38 39 39 memset(&_videoData, 0, sizeof (_videoData)); 40 _videoData. msg_iov = new iovec[2];41 _videoData. msg_iovlen= 2;42 _videoData. msg_namelen= sizeof (sockaddr_in);43 _videoData. msg_iov[0].iov_base = new uint8_t[14];44 ((uint8_t *) _videoData. msg_iov[0].iov_base)[0] = 0x80;45 EHTONLP(((uint8_t *) _videoData. msg_iov[0].iov_base) + 8, _videoSsrc);40 _videoData.MSGHDR_MSG_IOV = new IOVEC[2]; 41 _videoData.MSGHDR_MSG_IOVLEN = 2; 42 _videoData.MSGHDR_MSG_NAMELEN = sizeof (sockaddr_in); 43 _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE = new IOVEC_IOV_BASE_TYPE[14]; 44 ((uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[0] = 0x80; 45 EHTONLP(((uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 8, _videoSsrc); 46 46 _pSPS = NULL; 47 47 _SPSLen = 0; … … 50 50 51 51 memset(&_audioData, 0, sizeof (_audioData)); 52 _audioData. msg_iov = new iovec[3];53 _audioData. msg_iovlen= 3;54 _audioData. msg_namelen= sizeof (sockaddr_in);55 _audioData. msg_iov[0].iov_len= 14;56 _audioData. msg_iov[0].iov_base = new uint8_t[14];57 ((uint8_t *) _audioData. msg_iov[0].iov_base)[0] = 0x80;58 ((uint8_t *) _audioData. msg_iov[0].iov_base)[1] = 0xe0;59 EHTONLP(((uint8_t *) _audioData. msg_iov[0].iov_base) + 8, _audioSsrc);60 _audioData. msg_iov[1].iov_len= 0;61 _audioData. msg_iov[1].iov_base = new uint8_t[16];52 _audioData.MSGHDR_MSG_IOV = new IOVEC[3]; 53 _audioData.MSGHDR_MSG_IOVLEN = 3; 54 _audioData.MSGHDR_MSG_NAMELEN = sizeof (sockaddr_in); 55 _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_LEN = 14; 56 _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE = new IOVEC_IOV_BASE_TYPE[14]; 57 ((uint8_t *) _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[0] = 0x80; 58 ((uint8_t *) _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[1] = 0xe0; 59 EHTONLP(((uint8_t *) _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 8, _audioSsrc); 60 _audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN = 0; 61 _audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_BASE = new IOVEC_IOV_BASE_TYPE[16]; 62 62 63 63 … … 71 71 72 72 OutNetRTPUDPH264Stream::~OutNetRTPUDPH264Stream() { 73 delete[] (uint8_t *) _videoData. msg_iov[0].iov_base;74 delete[] _videoData. msg_iov;73 delete[] (uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE; 74 delete[] _videoData.MSGHDR_MSG_IOV; 75 75 memset(&_videoData, 0, sizeof (_videoData)); 76 76 if (_pSPS != NULL) … … 79 79 delete[] _pPPS; 80 80 81 delete[] (uint8_t *) _audioData. msg_iov[0].iov_base;82 delete[] (uint8_t *) _audioData. msg_iov[1].iov_base;83 delete[] _audioData. msg_iov;81 delete[] (uint8_t *) _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE; 82 delete[] (uint8_t *) _audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_BASE; 83 delete[] _audioData.MSGHDR_MSG_IOV; 84 84 memset(&_audioData, 0, sizeof (_audioData)); 85 85 } … … 226 226 //1. Flags 227 227 if (processedLength + sentAmount + chunkSize == totalLength) { 228 ((uint8_t *) _videoData. msg_iov[0].iov_base)[1] = 0xe1;228 ((uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[1] = 0xe1; 229 229 } else { 230 ((uint8_t *) _videoData. msg_iov[0].iov_base)[1] = 0x61;230 ((uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[1] = 0x61; 231 231 } 232 232 233 233 //2. counter 234 EHTONSP(((uint8_t *) _videoData. msg_iov[0].iov_base) + 2, _videoCounter);234 EHTONSP(((uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 2, _videoCounter); 235 235 _videoCounter++; 236 236 237 237 //3. Timestamp 238 EHTONLP(((uint8_t *) _videoData. msg_iov[0].iov_base) + 4,238 EHTONLP(((uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 4, 239 239 BaseConnectivity::ToRTPTS(absoluteTimestamp, 90000)); 240 240 241 241 if (chunkSize == totalLength) { 242 242 //4. No chunking 243 _videoData. msg_iov[0].iov_len= 12;244 _videoData. msg_iov[1].iov_base =pData;245 _videoData. msg_iov[1].iov_len= chunkSize;243 _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_LEN = 12; 244 _videoData.MSGHDR_MSG_IOV[1].IOVEC_IOV_BASE = (IOVEC_IOV_BASE_TYPE *)pData; 245 _videoData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN = chunkSize; 246 246 } else { 247 247 //5. Chunking 248 _videoData. msg_iov[0].iov_len= 14;248 _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_LEN = 14; 249 249 250 250 if (processedLength + sentAmount == 0) { 251 251 //6. First chunk 252 ((uint8_t *) _videoData. msg_iov[0].iov_base)[12] = (pData[0]&0xe0) | NALU_TYPE_FUA;253 ((uint8_t *) _videoData. msg_iov[0].iov_base)[13] = (pData[0]&0x1f) | 0x80;254 _videoData. msg_iov[1].iov_base = pData + 1;255 _videoData. msg_iov[1].iov_len= chunkSize - 1;252 ((uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[12] = (pData[0]&0xe0) | NALU_TYPE_FUA; 253 ((uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[13] = (pData[0]&0x1f) | 0x80; 254 _videoData.MSGHDR_MSG_IOV[1].IOVEC_IOV_BASE = (IOVEC_IOV_BASE_TYPE *)(pData + 1); 255 _videoData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN = chunkSize - 1; 256 256 } else { 257 257 if (processedLength + sentAmount + chunkSize == totalLength) { 258 258 //7. Last chunk 259 ((uint8_t *) _videoData. msg_iov[0].iov_base)[13] &= 0x1f;260 ((uint8_t *) _videoData. msg_iov[0].iov_base)[13] |= 0x40;259 ((uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[13] &= 0x1f; 260 ((uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[13] |= 0x40; 261 261 } else { 262 262 //8. Middle chunk 263 ((uint8_t *) _videoData. msg_iov[0].iov_base)[13] &= 0x1f;264 } 265 _videoData. msg_iov[1].iov_base =pData;266 _videoData. msg_iov[1].iov_len= chunkSize;263 ((uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[13] &= 0x1f; 264 } 265 _videoData.MSGHDR_MSG_IOV[1].IOVEC_IOV_BASE = (IOVEC_IOV_BASE_TYPE *)pData; 266 _videoData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN = chunkSize; 267 267 } 268 268 } … … 286 286 287 287 //2. Test if we need to send what we have so far 288 if (((14 + _audioData. msg_iov[1].iov_len+ GETAVAILABLEBYTESCOUNT(_audioBuffer) + 2 + dataLength - 7) > _maxRTPPacketSize)289 || (_audioData. msg_iov[1].iov_len== 16)) {288 if (((14 + _audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN + GETAVAILABLEBYTESCOUNT(_audioBuffer) + 2 + dataLength - 7) > _maxRTPPacketSize) 289 || (_audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN == 16)) { 290 290 //3. counter 291 EHTONSP(((uint8_t *) _audioData. msg_iov[0].iov_base) + 2, _audioCounter);291 EHTONSP(((uint8_t *) _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 2, _audioCounter); 292 292 _audioCounter++; 293 293 294 294 //4. Timestamp 295 EHTONLP(((uint8_t *) _audioData. msg_iov[0].iov_base) + 4,295 EHTONLP(((uint8_t *) _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 4, 296 296 BaseConnectivity::ToRTPTS(absoluteTimestamp, 297 297 GetCapabilities()->aac._sampleRate)); 298 298 299 299 //6. put the actual buffer 300 _audioData. msg_iov[2].iov_len= GETAVAILABLEBYTESCOUNT(_audioBuffer);301 _audioData. msg_iov[2].iov_base =GETIBPOINTER(_audioBuffer);302 303 EHTONSP(((uint8_t *) _audioData. msg_iov[0].iov_base) + 12,304 _audioData. msg_iov[1].iov_len* 8);300 _audioData.MSGHDR_MSG_IOV[2].IOVEC_IOV_LEN = GETAVAILABLEBYTESCOUNT(_audioBuffer); 301 _audioData.MSGHDR_MSG_IOV[2].IOVEC_IOV_BASE =(IOVEC_IOV_BASE_TYPE *) GETIBPOINTER(_audioBuffer); 302 303 EHTONSP(((uint8_t *) _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 12, 304 _audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN * 8); 305 305 306 306 _pConnectivity->FeedAudioData(_audioData, absoluteTimestamp); 307 307 308 308 _audioBuffer.IgnoreAll(); 309 _audioData. msg_iov[1].iov_len= 0;309 _audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN = 0; 310 310 } 311 311 312 312 //3. AU-Header 313 313 uint16_t auHeader = (uint16_t) ((dataLength - 7) << 3); 314 auHeader = auHeader | ((uint8_t) (_audioData. msg_iov[1].iov_len/ 2));315 EHTONSP(((uint8_t *) _audioData. msg_iov[1].iov_base) + _audioData.msg_iov[1].iov_len, auHeader);316 _audioData. msg_iov[1].iov_len+= 2;314 auHeader = auHeader | ((uint8_t) (_audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN / 2)); 315 EHTONSP(((uint8_t *) _audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_BASE) + _audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN, auHeader); 316 _audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN += 2; 317 317 318 318 … … 440 440 441 441 //5. counter 442 EHTONSP(((uint8_t *) _audioData. msg_iov[0].iov_base) + 2, _audioCounter);442 EHTONSP(((uint8_t *) _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 2, _audioCounter); 443 443 _audioCounter++; 444 444 445 445 //6. Timestamp 446 EHTONLP(((uint8_t *) _audioData. msg_iov[0].iov_base) + 4,446 EHTONLP(((uint8_t *) _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 4, 447 447 (uint32_t) (absoluteTimestamp 448 448 * (double) GetCapabilities()->aac._sampleRate / 1000.000)); 449 449 450 EHTONSP(((uint8_t *) _audioData. msg_iov[0].iov_base) + 12, 16);450 EHTONSP(((uint8_t *) _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 12, 16); 451 451 452 452 uint16_t auHeader = (uint16_t) ((dataLength - adtsHeaderLength) << 3); 453 EHTONSP(((uint8_t *) _audioData. msg_iov[1].iov_base), auHeader);454 _audioData. msg_iov[1].iov_len= 2;453 EHTONSP(((uint8_t *) _audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_BASE), auHeader); 454 _audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN = 2; 455 455 456 456 //7. put the actual buffer 457 _audioData. msg_iov[2].iov_len= dataLength - adtsHeaderLength;458 _audioData. msg_iov[2].iov_base = pData + adtsHeaderLength;457 _audioData.MSGHDR_MSG_IOV[2].IOVEC_IOV_LEN = dataLength - adtsHeaderLength; 458 _audioData.MSGHDR_MSG_IOV[2].IOVEC_IOV_BASE =(IOVEC_IOV_BASE_TYPE *)(pData + adtsHeaderLength); 459 459 460 460 if (!_pConnectivity->FeedAudioData(_audioData, absoluteTimestamp)) { -
trunk/sources/common/include/platform/android/androidplatform.h
r681 r699 138 138 } select_event; 139 139 140 #define MSGHDR struct msghdr 141 #define IOVEC iovec 142 #define MSGHDR_MSG_IOV msg_iov 143 #define MSGHDR_MSG_IOVLEN msg_iovlen 144 #define MSGHDR_MSG_NAME msg_name 145 #define MSGHDR_MSG_NAMELEN msg_namelen 146 #define IOVEC_IOV_BASE iov_base 147 #define IOVEC_IOV_LEN iov_len 148 #define IOVEC_IOV_BASE_TYPE uint8_t 149 #define SENDMSG(s,msg,flags,sent) sendmsg(s,msg,flags) 150 140 151 string format(string fmt, ...); 141 152 string vFormat(string fmt, va_list args); -
trunk/sources/common/include/platform/dfreebsd/dfreebsdplatform.h
r681 r699 143 143 } select_event; 144 144 145 #define MSGHDR struct msghdr 146 #define IOVEC iovec 147 #define MSGHDR_MSG_IOV msg_iov 148 #define MSGHDR_MSG_IOVLEN msg_iovlen 149 #define MSGHDR_MSG_NAME msg_name 150 #define MSGHDR_MSG_NAMELEN msg_namelen 151 #define IOVEC_IOV_BASE iov_base 152 #define IOVEC_IOV_LEN iov_len 153 #define IOVEC_IOV_BASE_TYPE uint8_t 154 #define SENDMSG(s,msg,flags,sent) sendmsg(s,msg,flags) 145 155 146 156 string format(string fmt, ...); -
trunk/sources/common/include/platform/freebsd/freebsdplatform.h
r681 r699 142 142 } select_event; 143 143 144 #define MSGHDR struct msghdr 145 #define IOVEC iovec 146 #define MSGHDR_MSG_IOV msg_iov 147 #define MSGHDR_MSG_IOVLEN msg_iovlen 148 #define MSGHDR_MSG_NAME msg_name 149 #define MSGHDR_MSG_NAMELEN msg_namelen 150 #define IOVEC_IOV_BASE iov_base 151 #define IOVEC_IOV_LEN iov_len 152 #define IOVEC_IOV_BASE_TYPE uint8_t 153 #define SENDMSG(s,msg,flags,sent) sendmsg(s,msg,flags) 144 154 145 155 string format(string fmt, ...); -
trunk/sources/common/include/platform/linux/linuxplatform.h
r681 r699 146 146 } select_event; 147 147 148 #define MSGHDR struct msghdr 149 #define IOVEC iovec 150 #define MSGHDR_MSG_IOV msg_iov 151 #define MSGHDR_MSG_IOVLEN msg_iovlen 152 #define MSGHDR_MSG_NAME msg_name 153 #define MSGHDR_MSG_NAMELEN msg_namelen 154 #define IOVEC_IOV_BASE iov_base 155 #define IOVEC_IOV_LEN iov_len 156 #define IOVEC_IOV_BASE_TYPE uint8_t 157 #define SENDMSG(s,msg,flags,sent) sendmsg(s,msg,flags) 158 148 159 string format(string fmt, ...); 149 160 string vFormat(string fmt, va_list args); -
trunk/sources/common/include/platform/openbsd/openbsdplatform.h
r681 r699 144 144 } select_event; 145 145 146 #define MSGHDR struct msghdr 147 #define IOVEC iovec 148 #define MSGHDR_MSG_IOV msg_iov 149 #define MSGHDR_MSG_IOVLEN msg_iovlen 150 #define MSGHDR_MSG_NAME msg_name 151 #define MSGHDR_MSG_NAMELEN msg_namelen 152 #define IOVEC_IOV_BASE iov_base 153 #define IOVEC_IOV_LEN iov_len 154 #define IOVEC_IOV_BASE_TYPE uint8_t 155 #define SENDMSG(s,msg,flags,sent) sendmsg(s,msg,flags) 146 156 147 157 string format(string fmt, ...); -
trunk/sources/common/include/platform/osx/osxplatform.h
r681 r699 142 142 } select_event; 143 143 144 #define MSGHDR struct msghdr 145 #define IOVEC iovec 146 #define MSGHDR_MSG_IOV msg_iov 147 #define MSGHDR_MSG_IOVLEN msg_iovlen 148 #define MSGHDR_MSG_NAME msg_name 149 #define MSGHDR_MSG_NAMELEN msg_namelen 150 #define IOVEC_IOV_BASE iov_base 151 #define IOVEC_IOV_LEN iov_len 152 #define IOVEC_IOV_BASE_TYPE uint8_t 153 #define SENDMSG(s,msg,flags,sent) sendmsg(s,msg,flags) 154 144 155 string format(string fmt, ...); 145 156 string vFormat(string fmt, va_list args); -
trunk/sources/common/include/platform/solaris/solarisplatform.h
r681 r699 144 144 } select_event; 145 145 146 #define MSGHDR struct msghdr 147 #define IOVEC iovec 148 #define MSGHDR_MSG_IOV msg_iov 149 #define MSGHDR_MSG_IOVLEN msg_iovlen 150 #define MSGHDR_MSG_NAME msg_name 151 #define MSGHDR_MSG_NAMELEN msg_namelen 152 #define IOVEC_IOV_BASE iov_base 153 #define IOVEC_IOV_LEN iov_len 154 #define IOVEC_IOV_BASE_TYPE uint8_t 155 #define SENDMSG(s,msg,flags,sent) sendmsg(s,msg,flags) 156 146 157 string format(string fmt, ...); 147 158 string vFormat(string fmt, va_list args); -
trunk/sources/thelib/include/protocols/rtp/connectivity/outboundconnectivity.h
r696 r699 84 84 RTSPProtocol *_pRTSPProtocol; 85 85 BaseOutNetRTPUDPStream *_pOutStream; 86 msghdr_dataMessage;87 msghdr_rtcpMessage;86 MSGHDR _dataMessage; 87 MSGHDR _rtcpMessage; 88 88 uint8_t *_pRTCPNTP; 89 89 uint8_t *_pRTCPRTP; … … 108 108 NATTraversalProtocol *_pAudioNATData; 109 109 NATTraversalProtocol *_pAudioNATRTCP; 110 111 uint32_t _dummyValue; 110 112 public: 111 113 OutboundConnectivity(bool forceTcp, RTSPProtocol *pRTSPProtocol); … … 130 132 bool RegisterTCPAudioClient(uint32_t rtspProtocolId, uint8_t data, uint8_t rtcp); 131 133 void SignalDetachedFromInStream(); 132 bool FeedVideoData( msghdr&message, double absoluteTimestamp);133 bool FeedAudioData( msghdr&message, double absoluteTimestamp);134 bool FeedVideoData(MSGHDR &message, double absoluteTimestamp); 135 bool FeedAudioData(MSGHDR &message, double absoluteTimestamp); 134 136 private: 135 137 bool InitializePorts(int32_t &dataFd, uint16_t &dataPort, 136 138 NATTraversalProtocol **ppNATData, int32_t &RTCPFd, uint16_t &RTCPPort, 137 139 NATTraversalProtocol **ppNATRTCP); 138 bool FeedData( msghdr&message, double absoluteTimestamp, bool isAudio);140 bool FeedData(MSGHDR &message, double absoluteTimestamp, bool isAudio); 139 141 }; 140 142 -
trunk/sources/thelib/include/protocols/rtp/rtspprotocol.h
r694 r699 133 133 134 134 bool SendRaw(uint8_t *pBuffer, uint32_t length); 135 bool SendRaw( msghdr*pMessage, uint16_t length, RTPClient *pClient,135 bool SendRaw(MSGHDR *pMessage, uint16_t length, RTPClient *pClient, 136 136 bool isAudio, bool isData); 137 137 -
trunk/sources/thelib/include/protocols/rtp/streaming/outnetrtpudph264stream.h
r694 r699 29 29 bool _forceTcp; 30 30 IOBuffer _videoBuffer; 31 msghdr_videoData;31 MSGHDR _videoData; 32 32 uint8_t *_pSPS; 33 33 uint32_t _SPSLen; … … 36 36 37 37 IOBuffer _audioBuffer; 38 msghdr_audioData;38 MSGHDR _audioData; 39 39 40 40 uint64_t _audioPacketsCount; -
trunk/sources/thelib/src/protocols/rtp/connectivity/outboundconnectivity.cpp
r696 r699 36 36 37 37 memset(&_dataMessage, 0, sizeof (_dataMessage)); 38 _dataMessage. msg_iov = new iovec[1];39 _dataMessage. msg_iovlen= 1;40 _dataMessage. msg_namelen= sizeof (sockaddr_in);38 _dataMessage.MSGHDR_MSG_IOV = new IOVEC[1]; 39 _dataMessage.MSGHDR_MSG_IOVLEN = 1; 40 _dataMessage.MSGHDR_MSG_NAMELEN = sizeof (sockaddr_in); 41 41 42 42 memset(&_rtcpMessage, 0, sizeof (_rtcpMessage)); 43 _rtcpMessage. msg_iov = new iovec[1];44 _rtcpMessage. msg_iovlen= 1;45 _rtcpMessage. msg_namelen= sizeof (sockaddr_in);46 _rtcpMessage. msg_iov[0].iov_len= 28;47 _rtcpMessage. msg_iov[0].iov_base = new uint8_t[_rtcpMessage.msg_iov[0].iov_len];48 ((uint8_t *) _rtcpMessage. msg_iov[0].iov_base)[0] = 0x80; //V,P,RC49 ((uint8_t *) _rtcpMessage. msg_iov[0].iov_base)[1] = 0xc8; //PT=SR=20050 EHTONSP(((uint8_t *) _rtcpMessage. msg_iov[0].iov_base) + 2, 6); //length51 EHTONLP(((uint8_t *) _rtcpMessage. msg_iov[0].iov_base) + 4, 0); //SSRC52 _pRTCPNTP = ((uint8_t *) _rtcpMessage. msg_iov[0].iov_base) + 8;53 _pRTCPRTP = ((uint8_t *) _rtcpMessage. msg_iov[0].iov_base) + 16;54 _pRTCPSPC = ((uint8_t *) _rtcpMessage. msg_iov[0].iov_base) + 20;55 _pRTCPSOC = ((uint8_t *) _rtcpMessage. msg_iov[0].iov_base) + 24;43 _rtcpMessage.MSGHDR_MSG_IOV = new IOVEC[1]; 44 _rtcpMessage.MSGHDR_MSG_IOVLEN = 1; 45 _rtcpMessage.MSGHDR_MSG_NAMELEN = sizeof (sockaddr_in); 46 _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_LEN = 28; 47 _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE = new IOVEC_IOV_BASE_TYPE[_rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_LEN]; 48 ((uint8_t *) _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[0] = 0x80; //V,P,RC 49 ((uint8_t *) _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[1] = 0xc8; //PT=SR=200 50 EHTONSP(((uint8_t *) _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 2, 6); //length 51 EHTONLP(((uint8_t *) _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 4, 0); //SSRC 52 _pRTCPNTP = ((uint8_t *) _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 8; 53 _pRTCPRTP = ((uint8_t *) _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 16; 54 _pRTCPSPC = ((uint8_t *) _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 20; 55 _pRTCPSOC = ((uint8_t *) _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 24; 56 56 57 57 _hasVideo = false; … … 75 75 76 76 OutboundConnectivity::~OutboundConnectivity() { 77 delete[] _dataMessage. msg_iov;78 delete[] ((uint8_t *) _rtcpMessage. msg_iov[0].iov_base);79 delete[] _rtcpMessage. msg_iov;77 delete[] _dataMessage.MSGHDR_MSG_IOV; 78 delete[] ((uint8_t *) _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE); 79 delete[] _rtcpMessage.MSGHDR_MSG_IOV; 80 80 if (_pOutStream != NULL) { 81 81 delete _pOutStream; … … 242 242 } 243 243 244 bool OutboundConnectivity::FeedVideoData( msghdr&message,244 bool OutboundConnectivity::FeedVideoData(MSGHDR &message, 245 245 double absoluteTimestamp) { 246 246 if (!FeedData(message, absoluteTimestamp, false)) { … … 251 251 } 252 252 253 bool OutboundConnectivity::FeedAudioData( msghdr&message,253 bool OutboundConnectivity::FeedAudioData(MSGHDR &message, 254 254 double absoluteTimestamp) { 255 255 if (!FeedData(message, absoluteTimestamp, true)) { … … 345 345 } 346 346 347 bool OutboundConnectivity::FeedData( msghdr&message, double absoluteTimestamp,347 bool OutboundConnectivity::FeedData(MSGHDR &message, double absoluteTimestamp, 348 348 bool isAudio) { 349 349 if (absoluteTimestamp == 0) … … 353 353 uint32_t ssrc = isAudio ? _pOutStream->AudioSSRC() : _pOutStream->VideoSSRC(); 354 354 uint16_t messageLength = 0; 355 for (uint32_t i = 0; i < (uint32_t) message. msg_iovlen; i++) {356 messageLength += message. msg_iov[i].iov_len;355 for (uint32_t i = 0; i < (uint32_t) message.MSGHDR_MSG_IOVLEN; i++) { 356 messageLength += message.MSGHDR_MSG_IOV[i].IOVEC_IOV_LEN; 357 357 } 358 358 … … 367 367 368 368 if (startRTP == 0xffffffff) { 369 startRTP = ENTOHLP(((uint8_t *) message. msg_iov[0].iov_base) + 4);369 startRTP = ENTOHLP(((uint8_t *) message.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 4); 370 370 startTS = absoluteTimestamp; 371 371 } … … 373 373 if ((packetsCount % 500) == 0) { 374 374 //FINEST("Send %c RTCP: %u", isAudio ? 'A' : 'V', packetsCount); 375 EHTONLP(((uint8_t *) _rtcpMessage. msg_iov[0].iov_base) + 4, ssrc); //SSRC375 EHTONLP(((uint8_t *) _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 4, ssrc); //SSRC 376 376 377 377 … … 393 393 //octet count 394 394 EHTONLP(_pRTCPSOC, bytesCount); 395 // FINEST("\n%s", STR(IOBuffer::DumpBuffer(((uint8_t *) _rtcpMessage. msg_iov[0].iov_base),396 // _rtcpMessage. msg_iov[0].iov_len)));395 // FINEST("\n%s", STR(IOBuffer::DumpBuffer(((uint8_t *) _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE), 396 // _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_LEN))); 397 397 398 398 if (_rtpClient.isUdp) { 399 399 int32_t rtcpFd = isAudio ? _audioRTCPFd : _videoRTCPFd; 400 400 sockaddr_in &rtcpAddress = isAudio ? _rtpClient.audioRtcpAddress : _rtpClient.videoRtcpAddress; 401 _rtcpMessage. msg_name =&rtcpAddress;402 if ( sendmsg(rtcpFd, &_rtcpMessage, 0) <=0) {401 _rtcpMessage.MSGHDR_MSG_NAME = (sockaddr *)&rtcpAddress; 402 if (SENDMSG(rtcpFd, &_rtcpMessage, 0,&_dummyValue) < 0) { 403 403 FATAL("Unable to send message"); 404 404 return false; … … 407 407 if (_pRTSPProtocol != NULL) { 408 408 if (!_pRTSPProtocol->SendRaw(&_rtcpMessage, 409 _rtcpMessage. msg_iov[0].iov_len, &_rtpClient, isAudio, false)) {409 _rtcpMessage.MSGHDR_MSG_IOV[0].IOVEC_IOV_LEN, &_rtpClient, isAudio, false)) { 410 410 FATAL("Unable to send raw rtcp audio data"); 411 411 return false; … … 419 419 int32_t dataFd = isAudio ? _audioDataFd : _videoDataFd; 420 420 sockaddr_in &dataAddress = isAudio ? _rtpClient.audioDataAddress : _rtpClient.videoDataAddress; 421 message. msg_name =&dataAddress;422 if ( sendmsg(dataFd, &message, 0) < 0) {421 message.MSGHDR_MSG_NAME = (sockaddr *)&dataAddress; 422 if (SENDMSG(dataFd, &message, 0,&_dummyValue) < 0) { 423 423 int err = errno; 424 424 FATAL("Unable to send message: %d; %s", err, strerror(errno)); -
trunk/sources/thelib/src/protocols/rtp/rtspprotocol.cpp
r698 r699 411 411 } 412 412 413 bool RTSPProtocol::SendRaw( msghdr*pMessage, uint16_t length, RTPClient *pClient, bool isAudio,413 bool RTSPProtocol::SendRaw(MSGHDR *pMessage, uint16_t length, RTPClient *pClient, bool isAudio, 414 414 bool isData) { 415 415 _outputBuffer.ReadFromByte((uint8_t) '$'); … … 429 429 length = EHTONS(length); 430 430 _outputBuffer.ReadFromBuffer((uint8_t *) & length, 2); 431 for (int i = 0; i < (int)pMessage-> msg_iovlen; i++) {432 _outputBuffer.ReadFromBuffer((uint8_t*) pMessage-> msg_iov[i].iov_base,433 pMessage-> msg_iov[i].iov_len);431 for (int i = 0; i < (int)pMessage->MSGHDR_MSG_IOVLEN; i++) { 432 _outputBuffer.ReadFromBuffer((uint8_t*) pMessage->MSGHDR_MSG_IOV[i].IOVEC_IOV_BASE, 433 pMessage->MSGHDR_MSG_IOV[i].IOVEC_IOV_LEN); 434 434 } 435 435 return EnqueueForOutbound(); -
trunk/sources/thelib/src/protocols/rtp/streaming/outnetrtpudph264stream.cpp
r694 r699 38 38 39 39 memset(&_videoData, 0, sizeof (_videoData)); 40 _videoData. msg_iov = new iovec[2];41 _videoData. msg_iovlen= 2;42 _videoData. msg_namelen= sizeof (sockaddr_in);43 _videoData. msg_iov[0].iov_base = new uint8_t[14];44 ((uint8_t *) _videoData. msg_iov[0].iov_base)[0] = 0x80;45 EHTONLP(((uint8_t *) _videoData. msg_iov[0].iov_base) + 8, _videoSsrc);40 _videoData.MSGHDR_MSG_IOV = new IOVEC[2]; 41 _videoData.MSGHDR_MSG_IOVLEN = 2; 42 _videoData.MSGHDR_MSG_NAMELEN = sizeof (sockaddr_in); 43 _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE = new IOVEC_IOV_BASE_TYPE[14]; 44 ((uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[0] = 0x80; 45 EHTONLP(((uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 8, _videoSsrc); 46 46 _pSPS = NULL; 47 47 _SPSLen = 0; … … 50 50 51 51 memset(&_audioData, 0, sizeof (_audioData)); 52 _audioData. msg_iov = new iovec[3];53 _audioData. msg_iovlen= 3;54 _audioData. msg_namelen= sizeof (sockaddr_in);55 _audioData. msg_iov[0].iov_len= 14;56 _audioData. msg_iov[0].iov_base = new uint8_t[14];57 ((uint8_t *) _audioData. msg_iov[0].iov_base)[0] = 0x80;58 ((uint8_t *) _audioData. msg_iov[0].iov_base)[1] = 0xe0;59 EHTONLP(((uint8_t *) _audioData. msg_iov[0].iov_base) + 8, _audioSsrc);60 _audioData. msg_iov[1].iov_len= 0;61 _audioData. msg_iov[1].iov_base = new uint8_t[16];52 _audioData.MSGHDR_MSG_IOV = new IOVEC[3]; 53 _audioData.MSGHDR_MSG_IOVLEN = 3; 54 _audioData.MSGHDR_MSG_NAMELEN = sizeof (sockaddr_in); 55 _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_LEN = 14; 56 _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE = new IOVEC_IOV_BASE_TYPE[14]; 57 ((uint8_t *) _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[0] = 0x80; 58 ((uint8_t *) _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[1] = 0xe0; 59 EHTONLP(((uint8_t *) _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 8, _audioSsrc); 60 _audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN = 0; 61 _audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_BASE = new IOVEC_IOV_BASE_TYPE[16]; 62 62 63 63 … … 71 71 72 72 OutNetRTPUDPH264Stream::~OutNetRTPUDPH264Stream() { 73 delete[] (uint8_t *) _videoData. msg_iov[0].iov_base;74 delete[] _videoData. msg_iov;73 delete[] (uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE; 74 delete[] _videoData.MSGHDR_MSG_IOV; 75 75 memset(&_videoData, 0, sizeof (_videoData)); 76 76 if (_pSPS != NULL) … … 79 79 delete[] _pPPS; 80 80 81 delete[] (uint8_t *) _audioData. msg_iov[0].iov_base;82 delete[] (uint8_t *) _audioData. msg_iov[1].iov_base;83 delete[] _audioData. msg_iov;81 delete[] (uint8_t *) _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE; 82 delete[] (uint8_t *) _audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_BASE; 83 delete[] _audioData.MSGHDR_MSG_IOV; 84 84 memset(&_audioData, 0, sizeof (_audioData)); 85 85 } … … 226 226 //1. Flags 227 227 if (processedLength + sentAmount + chunkSize == totalLength) { 228 ((uint8_t *) _videoData. msg_iov[0].iov_base)[1] = 0xe1;228 ((uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[1] = 0xe1; 229 229 } else { 230 ((uint8_t *) _videoData. msg_iov[0].iov_base)[1] = 0x61;230 ((uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[1] = 0x61; 231 231 } 232 232 233 233 //2. counter 234 EHTONSP(((uint8_t *) _videoData. msg_iov[0].iov_base) + 2, _videoCounter);234 EHTONSP(((uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 2, _videoCounter); 235 235 _videoCounter++; 236 236 237 237 //3. Timestamp 238 EHTONLP(((uint8_t *) _videoData. msg_iov[0].iov_base) + 4,238 EHTONLP(((uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 4, 239 239 BaseConnectivity::ToRTPTS(absoluteTimestamp, 90000)); 240 240 241 241 if (chunkSize == totalLength) { 242 242 //4. No chunking 243 _videoData. msg_iov[0].iov_len= 12;244 _videoData. msg_iov[1].iov_base =pData;245 _videoData. msg_iov[1].iov_len= chunkSize;243 _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_LEN = 12; 244 _videoData.MSGHDR_MSG_IOV[1].IOVEC_IOV_BASE = (IOVEC_IOV_BASE_TYPE *)pData; 245 _videoData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN = chunkSize; 246 246 } else { 247 247 //5. Chunking 248 _videoData. msg_iov[0].iov_len= 14;248 _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_LEN = 14; 249 249 250 250 if (processedLength + sentAmount == 0) { 251 251 //6. First chunk 252 ((uint8_t *) _videoData. msg_iov[0].iov_base)[12] = (pData[0]&0xe0) | NALU_TYPE_FUA;253 ((uint8_t *) _videoData. msg_iov[0].iov_base)[13] = (pData[0]&0x1f) | 0x80;254 _videoData. msg_iov[1].iov_base = pData + 1;255 _videoData. msg_iov[1].iov_len= chunkSize - 1;252 ((uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[12] = (pData[0]&0xe0) | NALU_TYPE_FUA; 253 ((uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[13] = (pData[0]&0x1f) | 0x80; 254 _videoData.MSGHDR_MSG_IOV[1].IOVEC_IOV_BASE = (IOVEC_IOV_BASE_TYPE *)(pData + 1); 255 _videoData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN = chunkSize - 1; 256 256 } else { 257 257 if (processedLength + sentAmount + chunkSize == totalLength) { 258 258 //7. Last chunk 259 ((uint8_t *) _videoData. msg_iov[0].iov_base)[13] &= 0x1f;260 ((uint8_t *) _videoData. msg_iov[0].iov_base)[13] |= 0x40;259 ((uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[13] &= 0x1f; 260 ((uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[13] |= 0x40; 261 261 } else { 262 262 //8. Middle chunk 263 ((uint8_t *) _videoData. msg_iov[0].iov_base)[13] &= 0x1f;264 } 265 _videoData. msg_iov[1].iov_base =pData;266 _videoData. msg_iov[1].iov_len= chunkSize;263 ((uint8_t *) _videoData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE)[13] &= 0x1f; 264 } 265 _videoData.MSGHDR_MSG_IOV[1].IOVEC_IOV_BASE = (IOVEC_IOV_BASE_TYPE *)pData; 266 _videoData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN = chunkSize; 267 267 } 268 268 } … … 286 286 287 287 //2. Test if we need to send what we have so far 288 if (((14 + _audioData. msg_iov[1].iov_len+ GETAVAILABLEBYTESCOUNT(_audioBuffer) + 2 + dataLength - 7) > _maxRTPPacketSize)289 || (_audioData. msg_iov[1].iov_len== 16)) {288 if (((14 + _audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN + GETAVAILABLEBYTESCOUNT(_audioBuffer) + 2 + dataLength - 7) > _maxRTPPacketSize) 289 || (_audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN == 16)) { 290 290 //3. counter 291 EHTONSP(((uint8_t *) _audioData. msg_iov[0].iov_base) + 2, _audioCounter);291 EHTONSP(((uint8_t *) _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 2, _audioCounter); 292 292 _audioCounter++; 293 293 294 294 //4. Timestamp 295 EHTONLP(((uint8_t *) _audioData. msg_iov[0].iov_base) + 4,295 EHTONLP(((uint8_t *) _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 4, 296 296 BaseConnectivity::ToRTPTS(absoluteTimestamp, 297 297 GetCapabilities()->aac._sampleRate)); 298 298 299 299 //6. put the actual buffer 300 _audioData. msg_iov[2].iov_len= GETAVAILABLEBYTESCOUNT(_audioBuffer);301 _audioData. msg_iov[2].iov_base =GETIBPOINTER(_audioBuffer);302 303 EHTONSP(((uint8_t *) _audioData. msg_iov[0].iov_base) + 12,304 _audioData. msg_iov[1].iov_len* 8);300 _audioData.MSGHDR_MSG_IOV[2].IOVEC_IOV_LEN = GETAVAILABLEBYTESCOUNT(_audioBuffer); 301 _audioData.MSGHDR_MSG_IOV[2].IOVEC_IOV_BASE =(IOVEC_IOV_BASE_TYPE *) GETIBPOINTER(_audioBuffer); 302 303 EHTONSP(((uint8_t *) _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 12, 304 _audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN * 8); 305 305 306 306 _pConnectivity->FeedAudioData(_audioData, absoluteTimestamp); 307 307 308 308 _audioBuffer.IgnoreAll(); 309 _audioData. msg_iov[1].iov_len= 0;309 _audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN = 0; 310 310 } 311 311 312 312 //3. AU-Header 313 313 uint16_t auHeader = (uint16_t) ((dataLength - 7) << 3); 314 auHeader = auHeader | ((uint8_t) (_audioData. msg_iov[1].iov_len/ 2));315 EHTONSP(((uint8_t *) _audioData. msg_iov[1].iov_base) + _audioData.msg_iov[1].iov_len, auHeader);316 _audioData. msg_iov[1].iov_len+= 2;314 auHeader = auHeader | ((uint8_t) (_audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN / 2)); 315 EHTONSP(((uint8_t *) _audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_BASE) + _audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN, auHeader); 316 _audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN += 2; 317 317 318 318 … … 440 440 441 441 //5. counter 442 EHTONSP(((uint8_t *) _audioData. msg_iov[0].iov_base) + 2, _audioCounter);442 EHTONSP(((uint8_t *) _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 2, _audioCounter); 443 443 _audioCounter++; 444 444 445 445 //6. Timestamp 446 EHTONLP(((uint8_t *) _audioData. msg_iov[0].iov_base) + 4,446 EHTONLP(((uint8_t *) _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 4, 447 447 (uint32_t) (absoluteTimestamp 448 448 * (double) GetCapabilities()->aac._sampleRate / 1000.000)); 449 449 450 EHTONSP(((uint8_t *) _audioData. msg_iov[0].iov_base) + 12, 16);450 EHTONSP(((uint8_t *) _audioData.MSGHDR_MSG_IOV[0].IOVEC_IOV_BASE) + 12, 16); 451 451 452 452 uint16_t auHeader = (uint16_t) ((dataLength - adtsHeaderLength) << 3); 453 EHTONSP(((uint8_t *) _audioData. msg_iov[1].iov_base), auHeader);454 _audioData. msg_iov[1].iov_len= 2;453 EHTONSP(((uint8_t *) _audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_BASE), auHeader); 454 _audioData.MSGHDR_MSG_IOV[1].IOVEC_IOV_LEN = 2; 455 455 456 456 //7. put the actual buffer 457 _audioData. msg_iov[2].iov_len= dataLength - adtsHeaderLength;458 _audioData. msg_iov[2].iov_base = pData + adtsHeaderLength;457 _audioData.MSGHDR_MSG_IOV[2].IOVEC_IOV_LEN = dataLength - adtsHeaderLength; 458 _audioData.MSGHDR_MSG_IOV[2].IOVEC_IOV_BASE =(IOVEC_IOV_BASE_TYPE *)(pData + adtsHeaderLength); 459 459 460 460 if (!_pConnectivity->FeedAudioData(_audioData, absoluteTimestamp)) {
Note: See TracChangeset
for help on using the changeset viewer.
