Changeset 118
- Timestamp:
- 09/02/10 21:32:44 (17 months ago)
- Location:
- trunk
- Files:
-
- 12 edited
-
builders/androidapplestreaming/jni/Android.mk (modified) (1 diff)
-
constants/constants.lua (modified) (1 diff)
-
sources/androidapplestreaming/src/main.cpp (modified) (1 diff)
-
sources/common/include/defines.h (modified) (1 diff)
-
sources/thelib/include/protocols/rtp/connectivity/outboundconnectivity.h (modified) (5 diffs)
-
sources/thelib/include/protocols/rtp/streaming/baseoutnetrtpudpstream.h (modified) (2 diffs)
-
sources/thelib/include/protocols/rtp/streaming/outnetrtpudph264stream.h (modified) (2 diffs)
-
sources/thelib/src/protocols/rtp/basertspappprotocolhandler.cpp (modified) (2 diffs)
-
sources/thelib/src/protocols/rtp/connectivity/outboundconnectivity.cpp (modified) (9 diffs)
-
sources/thelib/src/protocols/rtp/rtspprotocol.cpp (modified) (2 diffs)
-
sources/thelib/src/protocols/rtp/streaming/baseoutnetrtpudpstream.cpp (modified) (2 diffs)
-
sources/thelib/src/protocols/rtp/streaming/outnetrtpudph264stream.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/builders/androidapplestreaming/jni/Android.mk
r113 r118 33 33 34 34 #RTSP related defines 35 CreateRTCPPacket=CreateRTCPPacket_mystyle 35 #CreateRTCPPacket=CreateRTCPPacket_mystyle 36 CreateRTCPPacket=CreateRTCPPacket_mystyle_only_once 36 37 #CreateRTCPPacket=CreateRTCPPacket_live555style 37 38 #CreateRTCPPacket=CreateRTCPPacket_none -
trunk/constants/constants.lua
r81 r118 167 167 RTSP_HEADERS_X_POWERED_BY="X-Powered-By", 168 168 RTSP_HEADERS_X_POWERED_BY_US="C++ RTMP Server (http://www.rtmpd.com)", 169 RTSP_HEADERS_RANGE="Range", 170 RTSP_HEADERS_RANGE_NOW="now", 171 RTSP_HEADERS_RTP_INFO="RTP-Info", 169 172 RTSP_FIRST_LINE="firstLine", 170 173 RTSP_METHOD="method", -
trunk/sources/androidapplestreaming/src/main.cpp
r116 r118 100 100 101 101 uint32_t contextId = (uint32_t) ASC_RES_PARAM(result, "contextId"); 102 result = CommandSetBitrates(contextId, "[ 850000]");102 result = CommandSetBitrates(contextId, "[350000]"); 103 103 FINEST("result:\n%s", STR(result.ToString())); 104 104 -
trunk/sources/common/include/defines.h
r81 r118 675 675 #define RTSP_HEADERS_PUBLIC "Public" 676 676 #define RTSP_HEADERS_PUBLIC_LEN 6 677 #define RTSP_HEADERS_RANGE "Range" 678 #define RTSP_HEADERS_RANGE_LEN 5 679 #define RTSP_HEADERS_RANGE_NOW "now" 680 #define RTSP_HEADERS_RANGE_NOW_LEN 3 681 #define RTSP_HEADERS_RTP_INFO "RTP-Info" 682 #define RTSP_HEADERS_RTP_INFO_LEN 8 677 683 #define RTSP_HEADERS_SERVER "Server" 678 684 #define RTSP_HEADERS_SERVER_LEN 6 -
trunk/sources/thelib/include/protocols/rtp/connectivity/outboundconnectivity.h
r113 r118 36 36 uint32_t _videoBytesCount; 37 37 uint32_t _videoFirstRtp; 38 double _videoNextRTCPTs;38 uint32_t _videoRtpTs; 39 39 map<uint32_t, sockaddr_in> _udpVideoDataClients; 40 40 map<uint32_t, sockaddr_in> _udpVideoRTCPClients; 41 bool _videoRtcpSent; 41 42 42 43 int32_t _audioDataFd; … … 47 48 uint32_t _audioBytesCount; 48 49 uint32_t _audioFirstRtp; 49 double _audioNextRTCPTs;50 uint32_t _audioRtpTs; 50 51 map<uint32_t, sockaddr_in> _udpAudioDataClients; 51 52 map<uint32_t, sockaddr_in> _udpAudioRTCPClients; 53 bool _audioRtcpSent; 52 54 53 55 map<uint32_t, uint32_t> _tcpClients; … … 55 57 msghdr _message; 56 58 double _startupTime; 57 double _nextRTCPIncrement;58 59 public: 59 60 OutboundConnectivity(); … … 68 69 string GetAudioServerPorts(); 69 70 uint32_t GetSSRC(); 71 uint16_t GetLastVideoSequence(); 72 uint32_t GetLastVideoRTPTimestamp(); 73 uint16_t GetLastAudioSequence(); 74 uint32_t GetLastAudioRTPTimestamp(); 70 75 71 76 void RegisterUDPVideoClient(uint32_t protocolId, sockaddr_in &data, … … 93 98 uint32_t ssrc, uint32_t rate, uint32_t packetsCount, 94 99 uint32_t bytesCount, bool isAudio); 100 bool CreateRTCPPacket_mystyle_only_once(uint8_t *pDest, uint8_t *pSrc, 101 uint32_t ssrc, uint32_t rate, uint32_t packetsCount, 102 uint32_t bytesCount, bool isAudio); 95 103 bool CreateRTCPPacket_live555style(uint8_t *pDest, uint8_t *pSrc, 96 104 uint32_t ssrc, uint32_t rate, uint32_t packetsCount, -
trunk/sources/thelib/include/protocols/rtp/streaming/baseoutnetrtpudpstream.h
r56 r118 32 32 uint32_t _ssrc; 33 33 OutboundConnectivity *_pConnectivity; 34 uint16_t _videoCounter; 35 uint16_t _audioCounter; 34 36 public: 35 37 BaseOutNetRTPUDPStream(BaseProtocol *pProtocol, … … 41 43 42 44 uint32_t SSRC(); 45 uint16_t VideoCounter(); 46 uint16_t AudioCounter(); 43 47 44 48 virtual bool SignalPlay(double &absoluteTimestamp, double &length); -
trunk/sources/thelib/include/protocols/rtp/streaming/outnetrtpudph264stream.h
r106 r118 33 33 string _copy; 34 34 #endif 35 uint16_t _videoCounter;36 35 msghdr _videoData; 37 36 uint8_t *_pSPS; … … 40 39 uint32_t _PPSLen; 41 40 42 uint16_t _audioCounter;43 41 uint8_t _audioPacketsCount; 44 42 IOBuffer _audioBuffer; -
trunk/sources/thelib/src/protocols/rtp/basertspappprotocolhandler.cpp
r113 r118 279 279 pFrom->GetCustomParameters()["audioDataPortNumber"] = dataPortNumber; 280 280 pFrom->GetCustomParameters()["audioRtcpPortNumber"] = rtcpPortNumber; 281 pFrom->GetCustomParameters()["audioTrackUri"] = requestHeaders[RTSP_FIRST_LINE][RTSP_URL]; 281 282 } else { 282 283 pFrom->GetCustomParameters()["videoDataPortNumber"] = dataPortNumber; 283 284 pFrom->GetCustomParameters()["videoRtcpPortNumber"] = rtcpPortNumber; 285 pFrom->GetCustomParameters()["videoTrackUri"] = requestHeaders[RTSP_FIRST_LINE][RTSP_URL]; 284 286 } 285 287 … … 349 351 //6. prepare the response 350 352 pFrom->PushResponseFirstLine(RTSP_VERSION_1_0, 200, "OK"); 353 pFrom->PushResponseHeader(RTSP_HEADERS_RANGE, "npt=0.0-"); 354 355 string rtpInfoVideo = ""; 356 string rtpInfoAudio = ""; 357 if (pFrom->GetCustomParameters().HasKey("videoTrackId")) { 358 rtpInfoVideo = format("url=%s;seq=%u;rtptime=%u", 359 STR(pFrom->GetCustomParameters()["videoTrackUri"]), 360 pOutboundConnectivity->GetLastVideoSequence(), 361 0); 362 //pOutboundConnectivity->GetLastVideoRTPTimestamp()); 363 } 364 if (pFrom->GetCustomParameters().HasKey("audioTrackId")) { 365 rtpInfoAudio = format("url=%s;seq=%u;rtptime=%u", 366 STR(pFrom->GetCustomParameters()["audioTrackUri"]), 367 pOutboundConnectivity->GetLastAudioSequence(), 368 0); 369 //pOutboundConnectivity->GetLastAudioRTPTimestamp()); 370 } 371 string rtpInfo = rtpInfoVideo; 372 if (rtpInfo != "") { 373 if (rtpInfoAudio != "") { 374 rtpInfo += ", " + rtpInfoAudio; 375 } 376 } else { 377 rtpInfo = rtpInfoAudio; 378 } 379 //pFrom->PushResponseHeader(RTSP_HEADERS_RTP_INFO, rtpInfo); 351 380 352 381 //7. Done -
trunk/sources/thelib/src/protocols/rtp/connectivity/outboundconnectivity.cpp
r113 r118 80 80 OutboundConnectivity::OutboundConnectivity() 81 81 : BaseConnectivity() { 82 _nextRTCPIncrement = 1000.00;83 84 82 _videoDataFd = -1; 85 83 _videoDataPort = 0; … … 89 87 _videoBytesCount = 0; 90 88 _videoFirstRtp = 0; 91 _videoNextRTCPTs = _nextRTCPIncrement; 89 _videoRtpTs = 0; 90 _videoRtcpSent = false; 92 91 93 92 _audioDataFd = -1; … … 98 97 _audioBytesCount = 0; 99 98 _audioFirstRtp = 0; 100 _audioNextRTCPTs = _nextRTCPIncrement; 99 _videoRtpTs = 0; 100 _audioRtcpSent = false; 101 101 102 102 _pOutStream = NULL; … … 151 151 return _pOutStream->SSRC(); 152 152 return 0; 153 } 154 155 uint16_t OutboundConnectivity::GetLastVideoSequence() { 156 return _pOutStream->VideoCounter(); 157 } 158 159 uint32_t OutboundConnectivity::GetLastVideoRTPTimestamp() { 160 return _videoRtpTs; 161 } 162 163 uint16_t OutboundConnectivity::GetLastAudioSequence() { 164 return _pOutStream->AudioCounter(); 165 } 166 167 uint32_t OutboundConnectivity::GetLastAudioRTPTimestamp() { 168 return _audioRtpTs; 153 169 } 154 170 … … 231 247 232 248 bool OutboundConnectivity::FeedVideoData(msghdr &message) { 249 _videoRtpTs = ntohlp(((uint8_t *) message.msg_iov[0].iov_base) + 4); 233 250 if (!FeedVideoDataUDP(message)) { 234 251 FATAL("Unable to feed video UDP clients"); … … 244 261 245 262 bool OutboundConnectivity::FeedAudioData(msghdr &message) { 263 _audioRtpTs = ntohlp(((uint8_t *) message.msg_iov[0].iov_base) + 4); 246 264 if (!FeedAudioDataUDP(message)) { 247 265 FATAL("Unable to feed audio UDP clients"); … … 390 408 uint32_t ssrc, uint32_t rate, uint32_t packetsCount, uint32_t bytesCount, 391 409 bool isAudio) { 392 410 393 411 /* 394 412 0 1 2 3 … … 481 499 } 482 500 501 bool OutboundConnectivity::CreateRTCPPacket_mystyle_only_once(uint8_t *pDest, uint8_t *pSrc, 502 uint32_t ssrc, uint32_t rate, uint32_t packetsCount, 503 uint32_t bytesCount, bool isAudio) { 504 bool &rtcpSent = isAudio ? _audioRtcpSent : _videoRtcpSent; 505 if (rtcpSent) 506 return false; 507 508 rtcpSent = CreateRTCPPacket_mystyle(pDest, pSrc, ssrc, rate, packetsCount, 509 bytesCount, isAudio); 510 return rtcpSent; 511 } 512 483 513 bool OutboundConnectivity::CreateRTCPPacket_live555style(uint8_t *pDest, uint8_t *pSrc, 484 514 uint32_t ssrc, uint32_t rate, uint32_t packetsCount, uint32_t bytesCount, … … 536 566 return true; 537 567 } 568 538 569 bool OutboundConnectivity::CreateRTCPPacket_none(uint8_t *pDest, uint8_t *pSrc, 539 uint32_t ssrc, uint32_t rate, uint32_t packetsCount,540 uint32_t bytesCount, bool isAudio){570 uint32_t ssrc, uint32_t rate, uint32_t packetsCount, 571 uint32_t bytesCount, bool isAudio) { 541 572 return false; 542 573 } -
trunk/sources/thelib/src/protocols/rtp/rtspprotocol.cpp
r53 r118 313 313 headers[RTSP_HEADERS][RTSP_HEADERS_SERVER] = RTSP_HEADERS_SERVER_US; 314 314 headers[RTSP_HEADERS][RTSP_HEADERS_X_POWERED_BY] = RTSP_HEADERS_X_POWERED_BY_US; 315 headers[RTSP_HEADERS]["Buffersize"] = "1000000"; 315 316 316 317 //2. Add the content length if required … … 330 331 331 332 332 //string aaa = string((char *) GETIBPOINTER(_outputBuffer), GETAVAILABLEBYTESCOUNT(_outputBuffer));333 //FINEST("\n`%s`", STR(aaa));333 string aaa = string((char *) GETIBPOINTER(_outputBuffer), GETAVAILABLEBYTESCOUNT(_outputBuffer)); 334 FINEST("\n`%s`", STR(aaa)); 334 335 335 336 //5. Enqueue for outbound -
trunk/sources/thelib/src/protocols/rtp/streaming/baseoutnetrtpudpstream.cpp
r56 r118 32 32 srand((uint32_t) time(NULL)); 33 33 _pConnectivity = NULL; 34 _videoCounter = rand(); 35 _audioCounter = rand(); 34 36 } 35 37 … … 47 49 uint32_t BaseOutNetRTPUDPStream::SSRC() { 48 50 return _ssrc; 51 } 52 53 uint16_t BaseOutNetRTPUDPStream::VideoCounter() { 54 return _videoCounter; 55 } 56 57 uint16_t BaseOutNetRTPUDPStream::AudioCounter() { 58 return _audioCounter; 49 59 } 50 60 -
trunk/sources/thelib/src/protocols/rtp/streaming/outnetrtpudph264stream.cpp
r113 r118 33 33 StreamsManager *pStreamsManager, string name) 34 34 : BaseOutNetRTPUDPStream(pProtocol, pStreamsManager, name) { 35 _videoCounter = rand();36 35 memset(&_videoData, 0, sizeof (_videoData)); 37 36 _videoData.msg_iov = new iovec[2]; … … 46 45 _PPSLen = 0; 47 46 48 _audioCounter = rand();49 47 memset(&_audioData, 0, sizeof (_audioData)); 50 48 _audioData.msg_iov = new iovec[3];
Note: See TracChangeset
for help on using the changeset viewer.
