1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 #ifndef PVMF_JITTER_BUFFER_COMMON_TYPES_H_INCLUDED 19 #define PVMF_JITTER_BUFFER_COMMON_TYPES_H_INCLUDED 20 21 #include "oscl_base.h" 22 #include "oscl_string_containers.h" 23 #include "pvmf_sm_tunables.h" 24 25 //Jitter buffer node specific leave codes 26 #define JBPacketRegistrationConfigurationCorrupted 1000 27 28 29 enum PVMFJitterBufferDataState 30 { 31 PVMF_JITTER_BUFFER_STATE_UNKNOWN, 32 PVMF_JITTER_BUFFER_READY, 33 PVMF_JITTER_BUFFER_IN_TRANSITION 34 }; 35 36 /////////////////////////////////////////////////////////////////////////////// 37 //Specific to RTP streaming session 38 /////////////////////////////////////////////////////////////////////////////// 39 typedef struct tagPVMFRTPInfoParams 40 { tagPVMFRTPInfoParamstagPVMFRTPInfoParams41 tagPVMFRTPInfoParams() 42 { 43 seqNumBaseSet = false; 44 seqNum = 0; 45 rtpTimeBaseSet = false; 46 rtpTime = 0; 47 nptTimeBaseSet = false; 48 nptTimeInMS = 0; 49 rtpTimeScale = 0; 50 nptTimeInRTPTimeScale = 0; 51 isPlayAfterPause = false; 52 }; 53 54 bool seqNumBaseSet; 55 uint32 seqNum; 56 bool rtpTimeBaseSet; 57 uint32 rtpTime; 58 uint32 nptTimeInMS; 59 bool nptTimeBaseSet; 60 uint32 rtpTimeScale; 61 uint32 nptTimeInRTPTimeScale; 62 bool isPlayAfterPause; 63 } PVMFRTPInfoParams; 64 65 /////////////////////////////////////////////////////////////////////////////// 66 //RTSP based streaming specific data structures 67 /////////////////////////////////////////////////////////////////////////////// 68 enum PVMFJitterBufferFireWallPacketFormat 69 { 70 PVMF_JB_FW_PKT_FORMAT_RTP, 71 PVMF_JB_FW_PKT_FORMAT_PV 72 }; 73 74 class PVMFJitterBufferFireWallPacketInfo 75 { 76 public: PVMFJitterBufferFireWallPacketInfo()77 PVMFJitterBufferFireWallPacketInfo() 78 { 79 iServerRoundTripDelayInMS = 80 PVMF_JITTER_BUFFER_NODE_FIREWALL_PKT_DEFAULT_SERVER_RESPONSE_TIMEOUT_IN_MS; 81 iNumAttempts = 82 PVMF_JITTER_BUFFER_NODE_DEFAULT_FIREWALL_PKT_ATTEMPTS; 83 iFormat = PVMF_JB_FW_PKT_FORMAT_RTP; 84 }; 85 ~PVMFJitterBufferFireWallPacketInfo()86 virtual ~PVMFJitterBufferFireWallPacketInfo() 87 { 88 }; 89 90 uint32 iServerRoundTripDelayInMS; 91 uint32 iNumAttempts; 92 PVMFJitterBufferFireWallPacketFormat iFormat; 93 }; 94 95 96 typedef enum 97 { 98 PVMF_JB_REGISTER_MEDIA_MSG_ERR_UNKNOWN, 99 PVMF_JB_REGISTER_MEDIA_MSG_ERR_CORRUPT_PACKET, 100 PVMF_JB_REGISTER_MEDIA_MSG_ERR_LATE_MSG, 101 PVMF_JB_BUFFER_REGISTER_MEDIA_MSG_ERR_CONFIG_NOT_SUPPORTED, 102 PVMF_JB_REGISTER_MEDIA_MSG_FAILURE_JB_FULL, 103 PVMF_JB_REGISTER_MEDIA_MSG_FAILURE_INSUFFICIENT_MEMORY_FOR_PACKETIZATION, 104 PVMF_JB_REGISTER_MEDIA_MSG_ERR_UNEXPECTED_DATA, 105 PVMF_JB_REGISTER_MEDIA_MSG_ERR_EOS_SIGNALLED, 106 PVMF_JB_REGISTER_MEDIA_MSG_ERR_INVALID_HEADER, 107 PVMF_JB_REGISTER_MEDIA_MSG_SUCCESS 108 } PVMFJitterBufferRegisterMediaMsgStatus; 109 110 class PVMFJBEventNotifier; 111 class PVMFMediaClock; 112 113 enum JB_NOTIFY_CALLBACK 114 { 115 JB_INCOMING_MEDIA_INACTIVITY_DURATION_EXPIRED, 116 JB_NOTIFY_REPORT_BUFFERING_STATUS, 117 JB_BUFFERING_DURATION_COMPLETE, 118 JB_MONITOR_REBUFFERING, 119 JB_NOTIFY_SEND_FIREWALL_PACKET, 120 JB_NOTIFY_WAIT_FOR_OOO_PACKET_COMPLETE //OOO->Out Of Order 121 }; 122 123 class PVMFJitterBufferObserver; 124 /////////////////////////////////////////////////////////////////////////////// 125 //PVMFJitterBufferConstructParams 126 /////////////////////////////////////////////////////////////////////////////// 127 class PVMFJitterBufferConstructParams 128 { 129 public: PVMFJitterBufferConstructParams(PVMFMediaClock & aEstimatedServerClock,PVMFMediaClock & aClientPlaybackClock,OSCL_HeapString<OsclMemAllocator> & aMimeType,PVMFJBEventNotifier & aJBEventNotifier,bool & aDelayEstablished,int & aJitterDelayPercent,PVMFJitterBufferDataState & aJitterBufferDataState,PVMFJitterBufferObserver * const aObserver,OsclAny * const aContext)130 PVMFJitterBufferConstructParams(PVMFMediaClock& aEstimatedServerClock 131 , PVMFMediaClock& aClientPlaybackClock 132 , OSCL_HeapString<OsclMemAllocator>& aMimeType 133 , PVMFJBEventNotifier& aJBEventNotifier 134 , bool& aDelayEstablished 135 , int& aJitterDelayPercent 136 , PVMFJitterBufferDataState& aJitterBufferDataState 137 , PVMFJitterBufferObserver* const aObserver 138 , OsclAny* const aContext) 139 : irEstimatedServerClock(aEstimatedServerClock) 140 , irClientPlaybackClock(aClientPlaybackClock) 141 , irMimeType(aMimeType) 142 , irJBEventNotifier(aJBEventNotifier) 143 , irDelayEstablished(aDelayEstablished) 144 , irJitterDelayPercent(aJitterDelayPercent) 145 , irJitterBufferState(aJitterBufferDataState) 146 , ipObserver(aObserver) 147 , ipContextData(aContext) 148 {} 149 GetEstimatedServerClock()150 PVMFMediaClock& GetEstimatedServerClock() const 151 { 152 return irEstimatedServerClock; 153 } 154 GetClientPlaybackClock()155 PVMFMediaClock& GetClientPlaybackClock() const 156 { 157 return irClientPlaybackClock; 158 } 159 GetMimeType()160 OSCL_HeapString<OsclMemAllocator>& GetMimeType() const 161 { 162 return irMimeType; 163 } 164 GetDelayEstablishStatus()165 bool& GetDelayEstablishStatus() const 166 { 167 return irDelayEstablished; 168 } 169 GetJBDelayPercent()170 int& GetJBDelayPercent() const 171 { 172 return irJitterDelayPercent; 173 } 174 GetEventNotifier()175 PVMFJBEventNotifier& GetEventNotifier() const 176 { 177 return irJBEventNotifier; 178 } 179 GetJBObserver()180 PVMFJitterBufferObserver* const GetJBObserver() const 181 { 182 return ipObserver; 183 } 184 GetContextData()185 OsclAny* const GetContextData() const 186 { 187 return ipContextData; 188 } 189 GetJitterBufferState()190 PVMFJitterBufferDataState& GetJitterBufferState() const 191 { 192 return irJitterBufferState; 193 } 194 195 private: 196 PVMFMediaClock& irEstimatedServerClock; 197 PVMFMediaClock& irClientPlaybackClock; 198 OSCL_HeapString<OsclMemAllocator>& irMimeType; 199 PVMFJBEventNotifier& irJBEventNotifier; 200 bool& irDelayEstablished; 201 int& irJitterDelayPercent; 202 PVMFJitterBufferDataState& irJitterBufferState; 203 PVMFJitterBufferObserver *const ipObserver; 204 OsclAny* const ipContextData; 205 }; 206 207 /////////////////////////////////////////////////////////////////////////////// 208 //RTPSessionInfoForFirewallExchange 209 /////////////////////////////////////////////////////////////////////////////// 210 class PVMFPortInterface; 211 class RTPSessionInfoForFirewallExchange 212 { 213 public: RTPSessionInfoForFirewallExchange()214 RTPSessionInfoForFirewallExchange(): ipRTPDataJitterBufferPort(NULL), iSSRC(0) {} RTPSessionInfoForFirewallExchange(const RTPSessionInfoForFirewallExchange & aRTPSessionInfo)215 RTPSessionInfoForFirewallExchange(const RTPSessionInfoForFirewallExchange& aRTPSessionInfo) 216 { 217 ipRTPDataJitterBufferPort = aRTPSessionInfo.ipRTPDataJitterBufferPort; 218 iSSRC = aRTPSessionInfo.iSSRC; 219 } RTPSessionInfoForFirewallExchange(PVMFPortInterface * aInputPort,uint32 aSSRC)220 RTPSessionInfoForFirewallExchange(PVMFPortInterface* aInputPort, uint32 aSSRC): ipRTPDataJitterBufferPort(aInputPort) 221 , iSSRC(aSSRC) {} 222 223 PVMFPortInterface* ipRTPDataJitterBufferPort; 224 uint32 iSSRC; 225 }; 226 227 /** 228 * An enumeration of info codes from PVMFJitterBufferNode 229 **/ 230 typedef enum 231 { 232 PVMFJitterBufferNodeInfoEventStart = 8192, 233 PVMFJitterBufferNodeJitterBufferFull, 234 PVMFJitterBufferNodeTrackEOSReached, 235 PVMFJitterBufferNodeExcercisingPortFlowControl, 236 PVMFJitterBufferNodeRTCPBYERecvd, 237 PVMFJitterBufferNodeJitterBufferLowWaterMarkReached, 238 PVMFJitterBufferNodeJitterBufferHighWaterMarkReached, 239 PVMFJitterBufferNodeStreamThinningRecommended, 240 PVMFJitterBufferNodeRTCPDataProcessed, 241 PVMFJitterBufferNodeInfoEventEnd 242 } PVMFJitterBufferNodeInfoEventType; 243 244 #endif 245