Changeset 96
- Timestamp:
- 08/24/10 06:51:02 (18 months ago)
- Location:
- trunk/sources
- Files:
-
- 2 added
- 22 edited
-
androidapplestreaming/src/api.cpp (modified) (4 diffs)
-
androidapplestreaming/src/main.cpp (modified) (3 diffs)
-
applications/applestreamingclient/include/applestreamingclientapplication.h (modified) (3 diffs)
-
applications/applestreamingclient/include/clientcontext.h (modified) (1 diff)
-
applications/applestreamingclient/include/protocols/m3u8/basem3u8protocol.h (modified) (1 diff)
-
applications/applestreamingclient/include/protocols/m3u8/childm3u8protocol.h (modified) (1 diff)
-
applications/applestreamingclient/include/protocols/m3u8/masterm3u8protocol.h (modified) (1 diff)
-
applications/applestreamingclient/include/protocols/protocolfactory.h (modified) (1 diff)
-
applications/applestreamingclient/include/protocols/timer/finetimer.h (added)
-
applications/applestreamingclient/src/applestreamingclientapplication.cpp (modified) (2 diffs)
-
applications/applestreamingclient/src/clientcontext.cpp (modified) (8 diffs)
-
applications/applestreamingclient/src/protocols/m3u8/basem3u8protocol.cpp (modified) (1 diff)
-
applications/applestreamingclient/src/protocols/m3u8/childm3u8protocol.cpp (modified) (1 diff)
-
applications/applestreamingclient/src/protocols/m3u8/masterm3u8protocol.cpp (modified) (1 diff)
-
applications/applestreamingclient/src/protocols/protocolfactory.cpp (modified) (5 diffs)
-
applications/applestreamingclient/src/protocols/timer/finetimer.cpp (added)
-
common/include/platform/android/androidplatform.h (modified) (1 diff)
-
common/include/platform/freebsd/freebsdplatform.h (modified) (1 diff)
-
common/include/platform/linux/linuxplatform.h (modified) (1 diff)
-
common/include/platform/osx/osxplatform.h (modified) (1 diff)
-
common/include/platform/solaris/solarisplatform.h (modified) (1 diff)
-
common/include/platform/windows/win32platform.h (modified) (1 diff)
-
thelib/include/protocols/rtp/connectivity/outboundconnectivity.h (modified) (1 diff)
-
thelib/src/protocols/rtp/connectivity/outboundconnectivity.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/androidapplestreaming/src/api.cpp
r91 r96 99 99 //7. Create the RTSP acceptor 100 100 Variant acceptorConfig; 101 acceptorConfig[CONF_IP] = "127.0.0.1";101 acceptorConfig[CONF_IP] = ip; 102 102 acceptorConfig[CONF_PORT] = (uint16_t) port; 103 103 acceptorConfig[CONF_PROTOCOL] = CONF_PROTOCOL_INBOUND_RTSP; 104 104 vector<uint64_t> chain; 105 chain = ProtocolFactoryManager::ResolveProtocolChain( CONF_PROTOCOL_INBOUND_RTSP);106 if (chain.size() == 0) { 107 ASSERT("Invalid protocol chain: %s", CONF_PROTOCOL_INBOUND_RTSP);108 } 109 TCPAcceptor *pAcceptor = new TCPAcceptor( ip,105 chain = ProtocolFactoryManager::ResolveProtocolChain(acceptorConfig[CONF_PROTOCOL]); 106 if (chain.size() == 0) { 107 ASSERT("Invalid protocol chain: %s", STR(acceptorConfig[CONF_PROTOCOL])); 108 } 109 TCPAcceptor *pAcceptor = new TCPAcceptor(acceptorConfig[CONF_IP], 110 110 (uint16_t) acceptorConfig[CONF_PORT], acceptorConfig, chain); 111 111 if (!pAcceptor->StartAccept(pApp)) { … … 116 116 acceptorConfig[CONF_PORT] = (uint16_t) (port + 1); 117 117 acceptorConfig[CONF_PROTOCOL] = CONF_PROTOCOL_INBOUND_BIN_VARIANT; 118 chain = ProtocolFactoryManager::ResolveProtocolChain( CONF_PROTOCOL_INBOUND_BIN_VARIANT);119 if (chain.size() == 0) { 120 ASSERT("Invalid protocol chain: %s", CONF_PROTOCOL_INBOUND_BIN_VARIANT);121 } 122 pAcceptor = new TCPAcceptor( ip, (uint16_t) acceptorConfig[CONF_PORT],118 chain = ProtocolFactoryManager::ResolveProtocolChain(acceptorConfig[CONF_PROTOCOL]); 119 if (chain.size() == 0) { 120 ASSERT("Invalid protocol chain: %s", STR(acceptorConfig[CONF_PROTOCOL])); 121 } 122 pAcceptor = new TCPAcceptor(acceptorConfig[CONF_IP], (uint16_t) acceptorConfig[CONF_PORT], 123 123 acceptorConfig, chain); 124 124 if (!pAcceptor->StartAccept(pApp)) { … … 129 129 acceptorConfig[CONF_PORT] = (uint16_t) (port + 2); 130 130 acceptorConfig[CONF_PROTOCOL] = CONF_PROTOCOL_INBOUND_XML_VARIANT; 131 chain = ProtocolFactoryManager::ResolveProtocolChain( CONF_PROTOCOL_INBOUND_XML_VARIANT);132 if (chain.size() == 0) { 133 ASSERT("Invalid protocol chain: %s", CONF_PROTOCOL_INBOUND_XML_VARIANT);134 } 135 pAcceptor = new TCPAcceptor( ip, (uint16_t) acceptorConfig[CONF_PORT],131 chain = ProtocolFactoryManager::ResolveProtocolChain(acceptorConfig[CONF_PROTOCOL]); 132 if (chain.size() == 0) { 133 ASSERT("Invalid protocol chain: %s", STR(acceptorConfig[CONF_PROTOCOL])); 134 } 135 pAcceptor = new TCPAcceptor(acceptorConfig[CONF_IP], (uint16_t) acceptorConfig[CONF_PORT], 136 136 acceptorConfig, chain); 137 137 if (!pAcceptor->StartAccept(pApp)) { … … 142 142 acceptorConfig[CONF_PORT] = (uint16_t) (1935); 143 143 acceptorConfig[CONF_PROTOCOL] = CONF_PROTOCOL_INBOUND_RTMP; 144 chain = ProtocolFactoryManager::ResolveProtocolChain( CONF_PROTOCOL_INBOUND_RTMP);145 if (chain.size() == 0) { 146 ASSERT("Invalid protocol chain: %s", CONF_PROTOCOL_INBOUND_RTMP);147 } 148 pAcceptor = new TCPAcceptor( ip, (uint16_t) acceptorConfig[CONF_PORT],144 chain = ProtocolFactoryManager::ResolveProtocolChain(acceptorConfig[CONF_PROTOCOL]); 145 if (chain.size() == 0) { 146 ASSERT("Invalid protocol chain: %s", STR(acceptorConfig[CONF_PROTOCOL])); 147 } 148 pAcceptor = new TCPAcceptor(acceptorConfig[CONF_IP], (uint16_t) acceptorConfig[CONF_PORT], 149 149 acceptorConfig, chain); 150 150 if (!pAcceptor->StartAccept(pApp)) { 151 151 ASSERT("Unable to fire up acceptor"); 152 152 } 153 154 //10. Create the timer UDP protocol 155 #ifdef HAS_MS_TIMER 156 acceptorConfig[CONF_PORT] = (uint16_t) (port + 3); 157 acceptorConfig[CONF_PROTOCOL] = "fineTimer"; 158 acceptorConfig["FineTimerPeriod"] = 0.2; 159 chain = ProtocolFactoryManager::ResolveProtocolChain(acceptorConfig[CONF_PROTOCOL]); 160 if (chain.size() == 0) { 161 ASSERT("Invalid protocol chain: %s", STR(acceptorConfig[CONF_PROTOCOL])); 162 } 163 UDPCarrier *pUDPCarrier = UDPCarrier::Create(acceptorConfig[CONF_IP], (uint16_t) acceptorConfig[CONF_PORT]); 164 if (pUDPCarrier == NULL) { 165 ASSERT("Unable to bind on udp://%s:%d", STR(acceptorConfig[CONF_IP]), (uint16_t) acceptorConfig[CONF_PORT]); 166 } 167 BaseProtocol *pTimer = ProtocolFactoryManager::CreateProtocolChain(chain, acceptorConfig); 168 pTimer->GetFarEndpoint()->SetIOHandler(pUDPCarrier); 169 pUDPCarrier->SetProtocol(pTimer->GetFarEndpoint()); 170 pApp->SetFineTimerId(pTimer->GetId()); 171 #endif /* HAS_MS_TIMER */ 153 172 154 173 inet_aton("127.0.0.1", &gAddress.sin_addr); -
trunk/sources/androidapplestreaming/src/main.cpp
r88 r96 83 83 } 84 84 85 #define MY_URL "http://mediadownloads.mlb.com/mlbam/2010/06/29/9505835_m3u8/128/dropf_9505835_100m_128K.m3u8"86 #define MY_SESSION_ID ""87 #define MY_KEY ""85 //#define MY_URL "http://mediadownloads.mlb.com/mlbam/2010/06/29/9505835_m3u8/128/dropf_9505835_100m_128K.m3u8" 86 //#define MY_SESSION_ID "" 87 //#define MY_KEY "" 88 88 89 89 //#define MY_URL "http://mlbvod-akc.mlb.com/mlbam/2010/04/08/MLB_GAME_VIDEO_LANPIT_HOME_20100408/master_wired.m3u8" … … 108 108 109 109 110 //#define MY_URL "http://mlbsegqa.mlb.com/mlbam/2010/08/23/MLB_GAME_VIDEO_TBAANA_HOME_20100823/master_mobile.m3u8" 111 //#define MY_KEY "adCJvZ98pHD+RtwZXu5DAnud3zk=" 112 //#define MY_SESSION_ID "playback=HTTP_CLOUD_MOBILE&contentId=100000000001&appAccountName=mlb&eventId=14-265677-2010-08-23&ipid=23272205&sessionKey=1Mdu%2B0CADyV4ewOJTgKsPSqMPQE%3D&deviceId=ANDROID_354957033071773&country=us&postalCode=10011&platform=ANDROID" 110 113 114 #define MY_URL "http://mlbsegqa.mlb.com/mlbam/2010/08/17/MLB_GAME_VIDEO_DETNYA_HOME_20100817/master_mobile.m3u8" 115 #define MY_KEY "pFD3++v0LKfm38F2mCgIu0sXzn4=" 116 #define MY_SESSION_ID "playback=HTTP_CLOUD_MOBILE&contentId=10111969&appAccountName=mlb&eventId=14-265611-2010-08-18&ipid=23272205&sessionKey=6bdsqzUU7oBI4gixJxFFON2QHwA%3D&deviceId=ANDROID_354957033071773&country=us&postalCode=10011&platform=ANDROID" 111 117 112 118 //#define CONDENSED_CONN_STRING "base64:aHR0cDovL21sYnZvZC1ha2MubWxiLmNvbS9tbGJhbS8yMDEwLzA0LzA4L01MQl9HQU1FX1ZJREVPX0xBTlBJVF9IT01FXzIwMTAwNDA4L21hc3Rlcl93aXJlZC5tM3U4fHlNQmVFcEl6OEJEaUFYV0k0dUdIUm1UaHdIRT18cGxheWJhY2s9SFRUUF9DTE9VRF9XSVJFRCZjb250ZW50SWQ9NzMyMDA4NSZhcHBBY2NvdW50TmFtZT1tbGImZXZlbnRJZD0xNC0yNjM4NDktMjAxMC0wNC0wOCZpcGlkPTExNjI3NzA2JnNlc3Npb25LZXk9cUNveGRIaUlOY3FDbHlEcEZoU2dma3dJSWc0JTNE" … … 120 126 result = CommandPlay(contextId, MY_URL, MY_SESSION_ID, MY_KEY); 121 127 FINEST("result:\n%s", STR(result.ToString())); 128 129 // sleep(30); 130 // 131 // ContextCloseAll(); 122 132 // result = CommandPlay(contextId, CONDENSED_CONN_STRING); 123 133 // FINEST("result:\n%s", STR(result.ToString())); -
trunk/sources/applications/applestreamingclient/include/applestreamingclientapplication.h
r85 r96 36 36 class VariantAppProtocolHandler; 37 37 class ProtocolFactory; 38 #ifdef HAS_MS_TIMER 39 class FineTimer; 40 #endif /* HAS_MS_TIMER */ 38 41 39 42 class AppleStreamingClientApplication … … 51 54 VariantAppProtocolHandler *_pVariantHandler; 52 55 ProtocolFactory *_pFactory; 56 #ifdef HAS_MS_TIMER 57 uint32_t _fineTimerId; 58 #endif /* HAS_MS_TIMER */ 53 59 #ifdef ANDROID 54 60 CallBackInfo _ci; … … 61 67 62 68 virtual bool Initialize(); 63 69 #ifdef HAS_MS_TIMER 70 void SetFineTimerId(uint32_t fineTimerId); 71 FineTimer *GetFineTimer(); 72 #endif /* HAS_MS_TIMER */ 64 73 #ifdef ANDROID 65 74 void SetJavaCallBackInterface(CallBackInfo ci); -
trunk/sources/applications/applestreamingclient/include/clientcontext.h
r88 r96 109 109 bool SignalMasterPlaylistAvailable(); 110 110 bool SignalChildPlaylistAvailable(uint32_t bw); 111 bool SignalChildPlaylistNotAvailable(uint32_t bw); 111 112 bool SignalAESKeyAvailable(Variant ¶meters); 112 113 bool SignalTSProtocolAvailable(uint32_t protocolId, uint32_t bw); -
trunk/sources/applications/applestreamingclient/include/protocols/m3u8/basem3u8protocol.h
r2 r96 40 40 virtual Playlist *GetPlaylist() = 0; 41 41 virtual bool SignalPlaylistAvailable() = 0; 42 virtual bool SignalPlaylistFailed() = 0; 42 43 }; 43 44 -
trunk/sources/applications/applestreamingclient/include/protocols/m3u8/childm3u8protocol.h
r56 r96 36 36 virtual Playlist *GetPlaylist(); 37 37 virtual bool SignalPlaylistAvailable(); 38 virtual bool SignalPlaylistFailed(); 38 39 }; 39 40 -
trunk/sources/applications/applestreamingclient/include/protocols/m3u8/masterm3u8protocol.h
r56 r96 33 33 virtual Playlist *GetPlaylist(); 34 34 virtual bool SignalPlaylistAvailable(); 35 virtual bool SignalPlaylistFailed(); 35 36 }; 36 37 -
trunk/sources/applications/applestreamingclient/include/protocols/protocolfactory.h
r7 r96 39 39 #define PC_ITEM "bufferedHttp" 40 40 41 #ifdef HAS_MS_TIMER 42 #define PT_FINE_TIMER MAKE_TAG4('F','T','M','R') 43 #define PC_FINE_TIMER "fineTimer" 44 #endif /* HAS_MS_TIMER */ 45 41 46 class DLLEXP ProtocolFactory 42 47 : public BaseProtocolFactory { -
trunk/sources/applications/applestreamingclient/src/applestreamingclientapplication.cpp
r89 r96 27 27 #include "protocols/ts/tsappprotocolhandler.h" 28 28 #include "protocols/aes/aesappprotocolhandler.h" 29 #include "protocols/protocolmanager.h" 29 30 #include "streaming/basestream.h" 30 31 #include "streaming/streamstypes.h" … … 161 162 } 162 163 164 #ifdef HAS_MS_TIMER 165 166 void AppleStreamingClientApplication::SetFineTimerId(uint32_t fineTimerId) { 167 _fineTimerId = fineTimerId; 168 } 169 170 FineTimer *AppleStreamingClientApplication::GetFineTimer() { 171 return (FineTimer *) ProtocolManager::GetProtocol(_fineTimerId); 172 } 173 #endif /* HAS_MS_TIMER */ 174 163 175 #ifdef ANDROID 164 176 -
trunk/sources/applications/applestreamingclient/src/clientcontext.cpp
r95 r96 33 33 #include "streaming/streamsmanager.h" 34 34 #include "protocols/ts/innettsstream.h" 35 #include "applestreamingclientapplication.h" 36 #include "protocols/timer/finetimer.h" 35 37 36 38 uint32_t ClientContext::_idGenerator = 0; … … 86 88 _pEventSink = NULL; 87 89 } 90 #ifdef HAS_MS_TIMER 91 AppleStreamingClientApplication *pApp = GetApplication(); 92 if (pApp != NULL) { 93 FineTimer *pFineTimer = pApp->GetFineTimer(); 94 if (pFineTimer != NULL) { 95 pFineTimer->UnRegisterContextId(_id); 96 } 97 } 98 #endif /* HAS_MS_TIMER */ 88 99 } 89 100 … … 227 238 228 239 //5. Add the recurring job for consuming the A/V data buffer 240 #ifdef HAS_MS_TIMER 241 AppleStreamingClientApplication *pApp = GetApplication(); 242 if (pApp != NULL) { 243 FineTimer *pFineTimer = pApp->GetFineTimer(); 244 if (pFineTimer != NULL) { 245 pFineTimer->RegisterContextId(_id); 246 } else { 247 ASSERT("Unable to find fine timer"); 248 } 249 } else { 250 ASSERT("Unable to find application"); 251 } 252 #else 229 253 Variant job; 230 254 job["type"] = "consumeAVBuffer"; 231 255 pScheduleTimer->AddJob(job, true); 256 #endif /* HAS_MS_TIMER */ 232 257 233 258 // job["type"] = "testJNICallback"; … … 339 364 } 340 365 341 //5. Does it have any registered consumers AND sps/pps? Return if not366 //5. Does it have any registered consumers? 342 367 if (pStream->GetOutStreams().size() <= 0) { 343 368 WARN("No registered consumers or stream capabilities not yet known. Take a break..."); … … 349 374 350 375 //6. Feed 351 while ((wallClockDelta + 2000 > pStream->GetFeedTime()) && 376 // FINEST("BEFORE: wallClockDelta: %.2f; GetFeedTime: %.2f", 377 // wallClockDelta, pStream->GetFeedTime()); 378 while ((wallClockDelta > (pStream->GetFeedTime())) && 352 379 (GETAVAILABLEBYTESCOUNT(_avData) > 8192)) { 353 380 if (!pTS->SignalInputData(_avData)) { … … 356 383 } 357 384 } 385 // FINEST(" AFTER: wallClockDelta: %.2f; GetFeedTime: %.2f", 386 // wallClockDelta, pStream->GetFeedTime()); 358 387 359 388 //7. Done … … 462 491 bool ClientContext::SignalChildPlaylistAvailable(uint32_t bw) { 463 492 _parsedChildPlaylistsCount++; 493 return StartFeeding(); 494 } 495 496 bool ClientContext::SignalChildPlaylistNotAvailable(uint32_t bw) { 497 if (!MAP_HAS1(_childPlaylists, bw)) 498 return true; 499 Playlist *pPl = _childPlaylists[bw]; 500 delete pPl; 501 _childPlaylists.erase(bw); 502 WARN("bw %d removed", bw); 464 503 return StartFeeding(); 465 504 } … … 614 653 if (_pEventSink->GetType() == EVENT_SYNC_VARIANT) { 615 654 _avData.IgnoreAll(); 655 InNetTSStream *pStream = (InNetTSStream *) _pStreamsManager->FindByUniqueId( 656 _streamId); 657 if (pStream == NULL) { 658 FATAL("Unable to get the inbound stream"); 659 return false; 660 } 661 StreamCapabilities *pSC = pStream->GetCapabilities(); 662 pSC->Clear(); 663 _pEventSink->SignalStreamUnRegistered(_streamName); 616 664 } 617 665 if (_lastUsedBw < bw) { -
trunk/sources/applications/applestreamingclient/src/protocols/m3u8/basem3u8protocol.cpp
r81 r96 58 58 STR(pHttpProtocol->GetHeaders().ToString())); 59 59 FATAL("Additional data:\n%s", STR(GetCustomParameters().ToString())); 60 return false; 60 if (!SignalPlaylistFailed()) { 61 FATAL("Unable to signal playlist available"); 62 return false; 63 } 64 buffer.IgnoreAll(); 65 EnqueueForDelete(); 66 return true; 61 67 } 62 68 -
trunk/sources/applications/applestreamingclient/src/protocols/m3u8/childm3u8protocol.cpp
r56 r96 68 68 return true; 69 69 } 70 71 bool ChildM3U8Protocol::SignalPlaylistFailed() { 72 //1. Get the context 73 ClientContext *pContext = GetContext(); 74 if (pContext == NULL) { 75 FATAL("Unable to get the context"); 76 return false; 77 } 78 79 //2. Signal the context about the new playlist 80 if (!pContext->SignalChildPlaylistNotAvailable(_bw)) { 81 FATAL("Unable to signal master M3U8 playlist available"); 82 return false; 83 } 84 85 //3. Done 86 return true; 87 } -
trunk/sources/applications/applestreamingclient/src/protocols/m3u8/masterm3u8protocol.cpp
r56 r96 70 70 return true; 71 71 } 72 73 bool MasterM3U8Protocol::SignalPlaylistFailed() { 74 NYIR; 75 } -
trunk/sources/applications/applestreamingclient/src/protocols/protocolfactory.cpp
r7 r96 26 26 #include "protocols/aes/inboundaesprotocol.h" 27 27 #include "protocols/httpbuff/httpbufferprotocol.h" 28 #include "protocols/timer/finetimer.h" 28 29 29 30 ProtocolFactory::ProtocolFactory() { … … 41 42 ADD_VECTOR_END(result, PT_HTTP_BUFF); 42 43 ADD_VECTOR_END(result, PT_INBOUND_AES); 44 #ifdef HAS_MS_TIMER 45 ADD_VECTOR_END(result, PT_FINE_TIMER); 46 #endif /* HAS_MS_TIMER */ 43 47 return result; 44 48 } … … 46 50 vector<string> ProtocolFactory::HandledProtocolChains() { 47 51 vector<string> result; 52 #ifdef HAS_MS_TIMER 53 ADD_VECTOR_END(result, PC_FINE_TIMER); 54 #endif /* HAS_MS_TIMER */ 55 48 56 ADD_VECTOR_END(result, PC_MASTER_PLAYLIST); 49 57 ADD_VECTOR_END(result, PC_CHILD_PLAYLIST); … … 58 66 vector<uint64_t> ProtocolFactory::ResolveProtocolChain(string name) { 59 67 vector<uint64_t> result; 60 if (name == PC_MASTER_PLAYLIST) { 68 if (false) { 69 70 } 71 #ifdef HAS_MS_TIMER 72 else if (name == PC_FINE_TIMER) { 73 ADD_VECTOR_END(result, PT_UDP); 74 ADD_VECTOR_END(result, PT_FINE_TIMER); 75 } 76 #endif /* HAS_MS_TIMER */ 77 else if (name == PC_MASTER_PLAYLIST) { 61 78 ADD_VECTOR_END(result, PT_TCP); 62 79 ADD_VECTOR_END(result, PT_OUTBOUND_HTTP); … … 99 116 BaseProtocol *pResult = NULL; 100 117 switch (type) { 118 #ifdef HAS_MS_TIMER 119 case PT_FINE_TIMER: 120 pResult = new FineTimer(); 121 break; 122 #endif /* HAS_MS_TIMER */ 101 123 case PT_INBOUND_MASTER_M3U8: 102 124 pResult = new MasterM3U8Protocol(); -
trunk/sources/common/include/platform/android/androidplatform.h
r58 r96 108 108 }while (0); 109 109 110 #define GETCUSTOMNTP(result,value) \ 111 do { \ 112 struct timeval tv; \ 113 tv.tv_sec=value/CLOCKS_PER_SECOND; \ 114 tv.tv_usec=value-tv.tv_sec*CLOCKS_PER_SECOND; \ 115 result=(((uint64_t)tv.tv_sec + 2208988800U)<<32)|((((uint32_t)tv.tv_usec) << 12) + (((uint32_t)tv.tv_usec) << 8) - ((((uint32_t)tv.tv_usec) * 1825) >> 5)); \ 116 }while (0); 117 110 118 class AndroidPlatform 111 119 : public BasePlatform { -
trunk/sources/common/include/platform/freebsd/freebsdplatform.h
r58 r96 112 112 }while (0); 113 113 114 #define GETCUSTOMNTP(result,value) \ 115 do { \ 116 struct timeval tv; \ 117 tv.tv_sec=value/CLOCKS_PER_SECOND; \ 118 tv.tv_usec=value-tv.tv_sec*CLOCKS_PER_SECOND; \ 119 result=(((uint64_t)tv.tv_sec + 2208988800U)<<32)|((((uint32_t)tv.tv_usec) << 12) + (((uint32_t)tv.tv_usec) << 8) - ((((uint32_t)tv.tv_usec) * 1825) >> 5)); \ 120 }while (0); 121 114 122 class FreeBSDPlatform 115 123 : public BasePlatform { -
trunk/sources/common/include/platform/linux/linuxplatform.h
r58 r96 112 112 }while (0); 113 113 114 #define GETCUSTOMNTP(result,value) \ 115 do { \ 116 struct timeval tv; \ 117 tv.tv_sec=value/CLOCKS_PER_SECOND; \ 118 tv.tv_usec=value-tv.tv_sec*CLOCKS_PER_SECOND; \ 119 result=(((uint64_t)tv.tv_sec + 2208988800U)<<32)|((((uint32_t)tv.tv_usec) << 12) + (((uint32_t)tv.tv_usec) << 8) - ((((uint32_t)tv.tv_usec) * 1825) >> 5)); \ 120 }while (0); 121 114 122 class LinuxPlatform 115 123 : public BasePlatform { -
trunk/sources/common/include/platform/osx/osxplatform.h
r58 r96 111 111 }while (0); 112 112 113 #define GETCUSTOMNTP(result,value) \ 114 do { \ 115 struct timeval tv; \ 116 tv.tv_sec=value/CLOCKS_PER_SECOND; \ 117 tv.tv_usec=value-tv.tv_sec*CLOCKS_PER_SECOND; \ 118 result=(((uint64_t)tv.tv_sec + 2208988800U)<<32)|((((uint32_t)tv.tv_usec) << 12) + (((uint32_t)tv.tv_usec) << 8) - ((((uint32_t)tv.tv_usec) * 1825) >> 5)); \ 119 }while (0); 120 113 121 class OSXPlatform 114 122 : public BasePlatform { -
trunk/sources/common/include/platform/solaris/solarisplatform.h
r58 r96 113 113 }while (0); 114 114 115 #define GETCUSTOMNTP(result,value) \ 116 do { \ 117 struct timeval tv; \ 118 tv.tv_sec=value/CLOCKS_PER_SECOND; \ 119 tv.tv_usec=value-tv.tv_sec*CLOCKS_PER_SECOND; \ 120 result=(((uint64_t)tv.tv_sec + 2208988800U)<<32)|((((uint32_t)tv.tv_usec) << 12) + (((uint32_t)tv.tv_usec) << 8) - ((((uint32_t)tv.tv_usec) * 1825) >> 5)); \ 121 }while (0); 122 115 123 class SolarisPlatform 116 124 : public BasePlatform { -
trunk/sources/common/include/platform/windows/win32platform.h
r58 r96 103 103 }while (0); 104 104 105 #define GETCUSTOMNTP(result,value) \ 106 do { \ 107 struct timeval tv; \ 108 tv.tv_sec=value/CLOCKS_PER_SECOND; \ 109 tv.tv_usec=value-tv.tv_sec*CLOCKS_PER_SECOND; \ 110 result=(((uint64_t)tv.tv_sec + 2208988800U)<<32)|((((uint32_t)tv.tv_usec) << 12) + (((uint32_t)tv.tv_usec) << 8) - ((((uint32_t)tv.tv_usec) * 1825) >> 5)); \ 111 }while (0); 112 105 113 typedef void (*SignalFnc)(void); 106 114 -
trunk/sources/thelib/include/protocols/rtp/connectivity/outboundconnectivity.h
r87 r96 50 50 BaseOutNetRTPUDPStream *_pOutStream; 51 51 msghdr _message; 52 double _startupTime; 52 53 public: 53 54 OutboundConnectivity(); -
trunk/sources/thelib/src/protocols/rtp/connectivity/outboundconnectivity.cpp
r88 r96 69 69 sent = sendmsg(fd, &vd, 0); \ 70 70 } \ 71 RTP_DEBUG_MESSAGE(sent); \ 72 } while(0) 71 /*FATAL("TS: %02x%02x%02x%02x", \ 72 ((uint8_t *)vd.msg_iov[0].iov_base)[4], \ 73 ((uint8_t *)vd.msg_iov[0].iov_base)[5], \ 74 ((uint8_t *)vd.msg_iov[0].iov_base)[6], \ 75 ((uint8_t *)vd.msg_iov[0].iov_base)[7]); */\ 76 RTP_DEBUG_MESSAGE(sent); \ 77 } \ 78 while (0) 73 79 74 80 OutboundConnectivity::OutboundConnectivity() … … 93 99 _message.msg_iovlen = 1; 94 100 _message.msg_namelen = sizeof (sockaddr_in); 101 102 _startupTime = 0; 95 103 WARN("OC created: %p", this); 96 104 } … … 396 404 put_htonl(pDest + 4, ssrc); //SSRC 397 405 398 //5. NTP 406 FINEST("-----%s-----", isAudio ? "AUDIO" : "VIDEO"); 407 408 //5. setup the startup time 409 if (_startupTime == 0) { 410 GETCLOCKS(_startupTime); 411 } 412 FINEST("_startupTime: %.2f", _startupTime); 413 414 //6. Get the current time 415 double currentTime; 416 GETCLOCKS(currentTime); 417 FINEST("currentTime: %.2f", currentTime); 418 419 //7. NTP 399 420 uint64_t ntp; 400 //GETCUSTOMNTP(ntp, (ntohlp(pSrc + 4) / rate)*1000); 401 GETNTP(ntp); 421 GETCUSTOMNTP(ntp, currentTime); 402 422 put_htonll(pDest + 8, ntp); 403 423 404 424 //6. RTP 405 // double rtpDouble; 406 // GETCLOCKS(rtpDouble); 407 // rtpDouble = (rtpDouble / CLOCKS_PER_SEC) * rate; 408 // uint32_t rtp = (uint32_t) rtpDouble; 409 // put_htonl(pDest + 16, rtp); 410 memcpy(pDest + 16, pSrc + 4, 4); 425 FINEST("rate: %d", rate); 426 double rtpDouble = ((currentTime - _startupTime) / (double) CLOCKS_PER_SEC) * rate; 427 FINEST("rtpDouble: %.2f", rtpDouble); 428 uint32_t rtp = (uint32_t) rtpDouble; 429 FINEST("rtp: %d", rtp); 430 put_htonl(pDest + 16, rtp); 431 //memcpy(pDest + 16, pSrc + 4, 4); 411 432 412 433 //7. sender's packet count
Note: See TracChangeset
for help on using the changeset viewer.
