Home | History | Annotate | Download | only in include
      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_NODE_H_INCLUDED
     19 #define PVMF_JITTER_BUFFER_NODE_H_INCLUDED
     20 #ifndef OSCL_EXCLUSIVE_PTR_H_INCLUDED
     21 #include "oscl_exclusive_ptr.h"
     22 #endif
     23 #ifndef PVMF_MEDIA_CLOCK_H_INCLUDED
     24 #include "pvmf_media_clock.h"
     25 #endif
     26 #ifndef OSCL_TIMER_H_INCLUDED
     27 #include "oscl_timer.h"
     28 #endif
     29 #ifndef PVLOGGER_H_INCLUDED
     30 #include "pvlogger.h"
     31 #endif
     32 #ifndef PVMF_NODE_INTERFACE_H_INCLUDED
     33 #include "pvmf_node_interface.h"
     34 #endif
     35 #ifdef PVMF_NODE_UTILS_H_INCLUDED
     36 #include "pvmf_node_utils.h"
     37 #endif
     38 #ifndef OSCL_SCHEDULER_AO_H_INCLUDED
     39 #include "oscl_scheduler_ao.h"
     40 #endif
     41 #ifndef PVMF_JITTER_BUFFER_PORT_H_INCLUDED
     42 #include "pvmf_jitter_buffer_port.h"
     43 #endif
     44 #ifndef PVMF_JITTER_BUFFER_EXT_INTERFACE_H_INCLUDED
     45 #include "pvmf_jitter_buffer_ext_interface.h"
     46 #endif
     47 #ifndef PVMF_JITTER_BUFFER_INTERNAL_H_INCLUDED
     48 #include "pvmf_jitter_buffer_internal.h"
     49 #endif
     50 #ifndef PVMF_SM_NODE_EVENTS_H_INCLUDED
     51 #include "pvmf_sm_node_events.h"
     52 #endif
     53 
     54 #ifndef PVMF_JB_JITTERBUFFERMISC_H_INCLUDED
     55 #include "pvmf_jb_jitterbuffermisc.h"
     56 #endif
     57 
     58 #ifndef PVMF_MEDIA_CMD_H_INCLUDED
     59 #include "pvmf_media_cmd.h"
     60 #endif
     61 
     62 ///////////////////////////////////////////////
     63 //IDs for all of the asynchronous node commands.
     64 ///////////////////////////////////////////////
     65 enum TPVMFJitterBufferNodeCommand
     66 {
     67     PVMF_JITTER_BUFFER_NODE_QUERYUUID,
     68     PVMF_JITTER_BUFFER_NODE_QUERYINTERFACE,
     69     PVMF_JITTER_BUFFER_NODE_REQUESTPORT,
     70     PVMF_JITTER_BUFFER_NODE_RELEASEPORT,
     71     PVMF_JITTER_BUFFER_NODE_INIT,
     72     PVMF_JITTER_BUFFER_NODE_PREPARE,
     73     PVMF_JITTER_BUFFER_NODE_START,
     74     PVMF_JITTER_BUFFER_NODE_STOP,
     75     PVMF_JITTER_BUFFER_NODE_FLUSH,
     76     PVMF_JITTER_BUFFER_NODE_PAUSE,
     77     PVMF_JITTER_BUFFER_NODE_RESET,
     78     PVMF_JITTER_BUFFER_NODE_CANCELALLCOMMANDS,
     79     PVMF_JITTER_BUFFER_NODE_CANCELCOMMAND,
     80     /* add jitter buffer node specific commands here */
     81     PVMF_JITTER_BUFFER_NODE_COMMAND_LAST
     82 };
     83 
     84 enum PVMFStreamType
     85 {
     86     PVMF_STREAM_TYPE_UNKNOWN = 0,
     87     PVMF_STREAM_TYPE_AUDIO = 1,
     88     PVMF_STREAM_TYPE_VIDEO = 2,
     89 
     90     //NUM_PVMF_STREAM_TYPES must always be at the end.
     91     NUM_PVMF_STREAM_TYPES
     92 };
     93 
     94 class PVLogger;
     95 class PVMFJitterBufferExtensionInterfaceImpl;
     96 class PVMFJitterBufferConstructParams;
     97 class JitterBufferFactory;
     98 
     99 class PVMFJitterBufferNode : public PVInterface,
    100         public PVMFNodeInterface,
    101         public OsclActiveObject,
    102         public PVMFJitterBufferObserver,
    103         public PVMFJitterBufferMiscObserver,
    104         public PVMFJBEventNotifierObserver,
    105         public PVMFMediaClockStateObserver
    106 {
    107     public:
    108         OSCL_IMPORT_REF PVMFJitterBufferNode(int32 aPriority, JitterBufferFactory* aJBFactory);         //may be provide static func for creation and make the ctor private
    109         OSCL_IMPORT_REF virtual ~PVMFJitterBufferNode();
    110 
    111         //Overrides from PVInterface
    112         virtual void addRef()
    113         {
    114         }
    115         virtual void removeRef()
    116         {
    117         }
    118         virtual bool queryInterface(const PVUuid& uuid, PVInterface*& iface);
    119 
    120         //Overrides from PVMFNodeInterface
    121         OSCL_IMPORT_REF PVMFStatus ThreadLogon();
    122         OSCL_IMPORT_REF PVMFStatus ThreadLogoff();
    123         OSCL_IMPORT_REF PVMFStatus GetCapability(PVMFNodeCapability& aNodeCapability);
    124         OSCL_IMPORT_REF PVMFPortIter* GetPorts(const PVMFPortFilter* aFilter = NULL);
    125         OSCL_IMPORT_REF PVMFCommandId QueryUUID(PVMFSessionId,
    126                                                 const PvmfMimeString& aMimeType,
    127                                                 Oscl_Vector< PVUuid, OsclMemAllocator >& aUuids,
    128                                                 bool aExactUuidsOnly = false,
    129                                                 const OsclAny* aContext = NULL);
    130         OSCL_IMPORT_REF PVMFCommandId QueryInterface(PVMFSessionId,
    131                 const PVUuid& aUuid,
    132                 PVInterface*& aInterfacePtr,
    133                 const OsclAny* aContext = NULL);
    134         OSCL_IMPORT_REF PVMFCommandId RequestPort(PVMFSessionId,
    135                 int32 aPortTag,
    136                 const PvmfMimeString* aPortConfig = NULL,
    137                 const OsclAny* aContext = NULL);
    138         OSCL_IMPORT_REF PVMFCommandId ReleasePort(PVMFSessionId,
    139                 PVMFPortInterface& aPort,
    140                 const OsclAny* aContext = NULL);
    141         OSCL_IMPORT_REF PVMFCommandId Init(PVMFSessionId,
    142                                            const OsclAny* aContext = NULL);
    143         OSCL_IMPORT_REF PVMFCommandId Prepare(PVMFSessionId aSession,
    144                                               const OsclAny* aContext = NULL);
    145         OSCL_IMPORT_REF PVMFCommandId Start(PVMFSessionId,
    146                                             const OsclAny* aContext = NULL);
    147         OSCL_IMPORT_REF PVMFCommandId Stop(PVMFSessionId,
    148                                            const OsclAny* aContext = NULL);
    149         OSCL_IMPORT_REF PVMFCommandId Flush(PVMFSessionId,
    150                                             const OsclAny* aContext = NULL);
    151         OSCL_IMPORT_REF PVMFCommandId Pause(PVMFSessionId,
    152                                             const OsclAny* aContext = NULL);
    153         OSCL_IMPORT_REF PVMFCommandId Reset(PVMFSessionId,
    154                                             const OsclAny* aContext = NULL);
    155         OSCL_IMPORT_REF PVMFCommandId CancelAllCommands(PVMFSessionId,
    156                 const OsclAny* aContextData = NULL);
    157         OSCL_IMPORT_REF PVMFCommandId CancelCommand(PVMFSessionId,
    158                 PVMFCommandId aCmdId,
    159                 const OsclAny* aContextData = NULL);
    160         void HandlePortActivity(const PVMFPortActivity& aActivity);   //from PVMFPortActivityHandler
    161 
    162         //Overrides from PVMFJitterBufferObserver
    163         virtual void JitterBufferFreeSpaceAvailable(OsclAny* aContext);
    164         virtual void ProcessJBInfoEvent(PVMFAsyncEvent& aEvent);
    165         virtual void PacketReadyToBeRetrieved(OsclAny* aContext);
    166         virtual void EndOfStreamSignalled(OsclAny* aContext);
    167         virtual void MediaTrackSSRCEstablished(PVMFJitterBuffer* aJitterBuffer, uint32 aSSRC);
    168 
    169         //PVMFJitterBufferMiscObserver
    170         virtual void MessageReadyToSend(PVMFPortInterface*& aPort, PVMFSharedMediaMsgPtr& aMessage);
    171         virtual void MediaReceivingChannelPrepared(bool aStatus);
    172         virtual void ProcessRTCPControllerEvent(PVMFAsyncEvent& aEvent);
    173         virtual void SessionSessionExpired();
    174 
    175 
    176         //Overrides from PVMFJBEventNotifierObserver
    177         virtual void ProcessCallback(CLOCK_NOTIFICATION_INTF_TYPE aClockNotificationInterfaceType, uint32 aCallBkId, const OsclAny* aContext, PVMFStatus aStatus);
    178 
    179         //Override from PVMFMediaClockStateObserver
    180         virtual void ClockStateUpdated();
    181         virtual void NotificationsInterfaceDestroyed();
    182 
    183     private:
    184         //Overrides from OsclActiveObject
    185         void Run();
    186         void DoCancel();
    187 
    188         //Extension interface functions implemented in Node
    189         virtual void SetRTCPIntervalInMicroSecs(uint32 aRTCPInterval);  //Not used as of now
    190         virtual bool SetPortParams(PVMFPortInterface* aPort,
    191                                    uint32 aTimeScale,
    192                                    uint32 aBitRate,
    193                                    OsclRefCounterMemFrag& aConfig,
    194                                    bool aRateAdaptation = false,
    195                                    uint32 aRateAdaptationFeedBackFrequency = 0);
    196         virtual bool SetPlayRange(int32 aStartTimeInMS,
    197                                   int32 aStopTimeInMS,
    198                                   bool oPlayAfterASeek,
    199                                   bool aStopTimeAvailable = true);
    200         virtual void SetPlayBackThresholdInMilliSeconds(uint32 threshold);  //Not used as of now [replace with wait for OOO timeout]
    201         virtual void SetJitterBufferRebufferingThresholdInMilliSeconds(uint32 aThreshold);
    202         virtual void GetJitterBufferRebufferingThresholdInMilliSeconds(uint32& aThreshold);
    203         virtual void SetJitterBufferDurationInMilliSeconds(uint32 duration);
    204         virtual void GetJitterBufferDurationInMilliSeconds(uint32& duration);
    205         virtual void SetEarlyDecodingTimeInMilliSeconds(uint32 duration);
    206         virtual void SetBurstThreshold(float burstThreshold);
    207         //While in buffering/start state, Jitter Buffer node expects its upstream peer node to send media msg at its input port in duration < inactivity duration
    208         virtual void SetMaxInactivityDurationForMediaInMs(uint32 duration);
    209         virtual void GetMaxInactivityDurationForMediaInMs(uint32& duration);
    210 
    211         virtual void SetClientPlayBackClock(PVMFMediaClock* clientClock);
    212         virtual bool PrepareForRepositioning(bool oUseExpectedClientClockVal = false,
    213                                              uint32 aExpectedClientClockVal = 0);   //called for RTSP based streaming only
    214         virtual bool SetPortSSRC(PVMFPortInterface* aPort, uint32 aSSRC);
    215         virtual bool SetPortRTPParams(PVMFPortInterface* aPort,
    216                                       bool   aSeqNumBasePresent,
    217                                       uint32 aSeqNumBase,
    218                                       bool   aRTPTimeBasePresent,
    219                                       uint32 aRTPTimeBase,
    220                                       bool   aNPTTimeBasePresent,
    221                                       uint32 aNPTInMS,
    222                                       bool oPlayAfterASeek = false);
    223         virtual bool SetPortRTCPParams(PVMFPortInterface* aPort,
    224                                        int aNumSenders,
    225                                        uint32 aRR,
    226                                        uint32 aRS);
    227         virtual PVMFTimestamp GetActualMediaDataTSAfterSeek();
    228         virtual PVMFTimestamp GetMaxMediaDataTS();
    229 
    230         virtual PVMFStatus SetServerInfo(PVMFJitterBufferFireWallPacketInfo& aServerInfo);
    231         virtual PVMFStatus NotifyOutOfBandEOS();
    232         virtual PVMFStatus SendBOSMessage(uint32 aStramID);
    233 
    234         virtual void SetJitterBufferChunkAllocator(OsclMemPoolResizableAllocator* aDataBufferAllocator, const PVMFPortInterface* aPort);
    235 
    236         virtual void SetJitterBufferMemPoolInfo(const PvmfPortBaseImpl* aPort, uint32 aSize, uint32 aResizeSize, uint32 aMaxNumResizes, uint32 aExpectedNumberOfBlocksPerBuffer);
    237         virtual void GetJitterBufferMemPoolInfo(const PvmfPortBaseImpl* aPort, uint32& aSize, uint32& aResizeSize, uint32& aMaxNumResizes, uint32& aExpectedNumberOfBlocksPerBuffer) const ;
    238 
    239         virtual void SetSharedBufferResizeParams(uint32 maxNumResizes, uint32 resizeSize);
    240         virtual void GetSharedBufferResizeParams(uint32& maxNumResizes, uint32& resizeSize);
    241 
    242         virtual bool ClearJitterBuffer(PVMFPortInterface* aPort,
    243                                        uint32 aSeqNum);
    244         virtual void FlushJitterBuffer();
    245 
    246 
    247         virtual PVMFStatus SetInputMediaHeaderPreParsed(PVMFPortInterface* aPort,
    248                 bool aHeaderPreParsed);
    249 
    250         virtual PVMFStatus HasSessionDurationExpired(bool& aExpired);
    251         virtual bool PurgeElementsWithNPTLessThan(NptTimeFormat& aNPTTime);
    252 
    253         virtual void SetBroadCastSession();
    254         virtual void DisableFireWallPackets();
    255         virtual void UpdateJitterBufferState();
    256         virtual void StartOutputPorts();
    257         virtual void StopOutputPorts();
    258 
    259         bool SetPortParams(PVMFPortInterface* aPort,
    260                            uint32 aTimeScale,
    261                            uint32 aBitRate,
    262                            OsclRefCounterMemFrag& aConfig,
    263                            bool aRateAdaptation,
    264                            uint32 aRateAdaptationFeedBackFrequency,
    265                            uint aMaxNumBuffResizes, uint aBuffResizeSize);
    266         bool SetPortParams(PVMFPortInterface* aPort,
    267                            uint32 aTimeScale,
    268                            uint32 aBitRate,
    269                            OsclRefCounterMemFrag& aConfig,
    270                            bool aRateAdaptation,
    271                            uint32 aRateAdaptationFeedBackFrequency,
    272                            bool aUserSpecifiedBuffParams,
    273                            uint aMaxNumBuffResizes = 0, uint aBuffResizeSize = 0);
    274         bool PrepareForPlaylistSwitch();
    275 
    276         //Async command handling functions
    277         void DoQueryUuid(PVMFJitterBufferNodeCommand&);
    278         void DoQueryInterface(PVMFJitterBufferNodeCommand&);
    279         void DoRequestPort(PVMFJitterBufferNodeCommand&);
    280         void DoReleasePort(PVMFJitterBufferNodeCommand&);
    281         void DoInit(PVMFJitterBufferNodeCommand&);
    282         void DoPrepare(PVMFJitterBufferNodeCommand& aCmd);
    283         void CompletePrepare();
    284         void CancelPrepare();
    285         void DoStart(PVMFJitterBufferNodeCommand&);
    286         void CompleteStart();
    287         void CancelStart();
    288 
    289         //Utility functions
    290         void Construct();
    291         void ResetNodeParams(bool aReleaseMemory = true);
    292         bool ProcessPortActivity(PVMFJitterBufferPortParams*);
    293         PVMFStatus ProcessIncomingMsg(PVMFJitterBufferPortParams*);
    294         PVMFStatus ProcessOutgoingMsg(PVMFJitterBufferPortParams*);
    295         void QueuePortActivity(PVMFJitterBufferPortParams*,
    296                                const PVMFPortActivity&);
    297         bool CheckForPortRescheduling();
    298         bool CheckForPortActivityQueues();
    299 
    300         bool getPortContainer(PVMFPortInterface* aPort,
    301                               PVMFJitterBufferPortParams*& aPortParams);
    302 
    303 
    304         PVMFCommandId QueueCommandL(PVMFJitterBufferNodeCommand&);
    305         void MoveCmdToCurrentQueue(PVMFJitterBufferNodeCommand& aCmd);
    306         bool ProcessCommand(PVMFJitterBufferNodeCommand&);
    307         void CommandComplete(PVMFJitterBufferNodeCmdQ&,
    308                              PVMFJitterBufferNodeCommand&,
    309                              PVMFStatus,
    310                              OsclAny* aData = NULL,
    311                              PVUuid* aEventUUID = NULL,
    312                              int32* aEventCode = NULL);
    313         void CommandComplete(PVMFJitterBufferNodeCommand&,
    314                              PVMFStatus,
    315                              OsclAny* aData = NULL,
    316                              PVUuid* aEventUUID = NULL,
    317                              int32* aEventCode = NULL);
    318         void InternalCommandComplete(PVMFJitterBufferNodeCmdQ&,
    319                                      PVMFJitterBufferNodeCommand&,
    320                                      PVMFStatus aStatus,
    321                                      OsclAny* aEventData = NULL);
    322         PVMFJBCommandContext* RequestNewInternalCmd();
    323 
    324         void DoStop(PVMFJitterBufferNodeCommand&);
    325         void DoFlush(PVMFJitterBufferNodeCommand&);
    326         bool FlushPending();
    327 
    328         void DoPause(PVMFJitterBufferNodeCommand&);
    329         void DoReset(PVMFJitterBufferNodeCommand&);
    330         void DoCancelAllCommands(PVMFJitterBufferNodeCommand&);
    331         void DoCancelCommand(PVMFJitterBufferNodeCommand&);
    332 
    333         void ReportErrorEvent(PVMFEventType aEventType,
    334                               OsclAny* aEventData = NULL,
    335                               PVUuid* aEventUUID = NULL,
    336                               int32* aEventCode = NULL);
    337         void ReportInfoEvent(PVMFEventType aEventType,
    338                              OsclAny* aEventData = NULL,
    339                              PVUuid* aEventUUID = NULL,
    340                              int32* aEventCode = NULL);
    341         void SetState(TPVMFNodeInterfaceState);
    342 
    343         void CleanUp();
    344 
    345 
    346 
    347         friend class PVMFJitterBufferPort;
    348         friend class PVMFJitterBufferExtensionInterfaceImpl;
    349 
    350 
    351 
    352         bool CheckStateForRegisteringRTPPackets();
    353 
    354         bool NotifyAutoPauseComplete()
    355         {
    356 
    357             return true;
    358         }
    359         bool NotifyAutoResumeComplete()
    360         {
    361 
    362             return true;
    363         }
    364 
    365         PVMFPortInterface* getPortCounterpart(PVMFPortInterface* aPort);
    366         bool CheckForSpaceInJitterBuffer(PVMFPortInterface* aPort);
    367         PVMFStatus CheckForHighWaterMark(PVMFPortInterface* aPort, bool& aHighWaterMarkReached);
    368         PVMFStatus CheckForLowWaterMark(PVMFPortInterface* aPort, bool& aLowWaterMarkReached);
    369         PVMFStatus RequestMemCallBackForAutoResume(PVMFPortInterface* aPort);
    370         void freeblockavailable(OsclAny* aContextData);
    371         void freememoryavailable(OsclAny* aContextData);
    372         void chunkdeallocated(OsclAny* aContextData);
    373         bool RegisterDataPacket(PVMFPortInterface* aPort,
    374                                 PVMFJitterBuffer* aJitterBuffer,
    375                                 PVMFSharedMediaDataPtr& aDataPacket);
    376         PVMFJitterBuffer* findJitterBuffer(PVMFPortInterface* aPort);
    377         PVMFPortInterface* findPortForJitterBuffer(PVMFJitterBuffer*);
    378         bool IsJitterBufferReady(PVMFJitterBufferPortParams*, uint32& aClockDiff);
    379         PVMFStatus SendData(PVMFPortInterface*);
    380         PVMFStatus CheckJitterBufferEmpty(bool& oEmpty);
    381 
    382 
    383         void LogSessionDiagnostics();
    384         void LogPortDiagnostics();
    385 
    386         PVMFStatus CheckForEOS();
    387         PVMFStatus GenerateAndSendEOSCommand(PVMFPortInterface* aPort);
    388 
    389 
    390         bool QueueBOSCommand(PVMFPortInterface* aPort);
    391 
    392         PVMFStatus SetInPlaceProcessingMode(PVMFPortInterface* aPort,
    393                                             bool aInPlaceProcessing)
    394         {
    395             PVMFJitterBufferPortParams* portParamsPtr = NULL;
    396             if (!getPortContainer(aPort, portParamsPtr))
    397             {
    398                 return PVMFFailure;
    399             }
    400 
    401             if (portParamsPtr->ipJitterBuffer != NULL)
    402             {
    403                 portParamsPtr->ipJitterBuffer->SetInPlaceProcessingMode(aInPlaceProcessing);
    404             }
    405             return PVMFSuccess;
    406         }
    407 
    408 
    409         OsclAny* AllocatePort();
    410         bool PushPortToVect(PVMFJitterBufferPort*& aPort);
    411         bool PushPortParamsToQ(PVMFJitterBufferPortParams*& aPortParams);
    412 
    413         //  PvmfRtcpTimer* iRTCPTimer;
    414         void RtcpTimerEvent(PvmfRtcpTimer* pTimer);
    415         uint32 CalcRtcpInterval(PVMFJitterBufferPortParams* pFeedbackPort);
    416         PVMFStatus ProcessIncomingRTCPReport(PVMFSharedMediaMsgPtr&,
    417                                              PVMFJitterBufferPortParams*);
    418 
    419         PVMFStatus GenerateRTCPRR(PVMFJitterBufferPortParams* pPort);
    420 
    421         bool LocateFeedBackPort(PVMFJitterBufferPortParams*&,
    422                                 PVMFJitterBufferPortParams*&);
    423 
    424         bool LocateInputPortForFeedBackPort(PVMFJitterBufferPortParams*&,
    425                                             PVMFJitterBufferPortParams*&);
    426 
    427         PVMFStatus ComposeAndSendFeedBackPacket(PVMFJitterBufferPortParams*&,
    428                                                 PVMFJitterBufferPortParams*&);
    429 
    430         PVMFStatus ComposeAndSendRateAdaptationFeedBackPacket(PVMFJitterBufferPortParams*&,
    431                 PVMFJitterBufferPortParams*&);
    432 
    433 
    434 
    435 
    436         void PVMFJBSessionDurationTimerEvent();
    437         void ComputeCurrentSessionDurationMonitoringInterval();
    438 
    439 
    440         PVMFStatus CreateFireWallPacketMemAllocators(PVMFJitterBufferPortParams*);
    441         PVMFStatus DestroyFireWallPacketMemAllocators(PVMFJitterBufferPortParams*);
    442 
    443         PVMFStatus SendFireWallPackets();
    444 
    445         bool Allocate(PVMFJitterBufferPortParams* it, PVMFSharedMediaDataPtr& fireWallPkt, OsclSharedPtr<PVMFMediaDataImpl>& mediaDataImpl, const int size);
    446 
    447         PVMFStatus ResetFireWallPacketInfoAndResend();
    448         void CheckForFireWallRecv(bool &aComplete);
    449         void CheckForFireWallPacketAttempts(bool &aComplete);
    450         PVMFStatus DecodeFireWallPackets(PVMFSharedMediaDataPtr aPacket,
    451                                          PVMFJitterBufferPortParams* aPortParamsPtr);
    452         void SetJitterBufferSize(uint32 aBufferSz);
    453         void GetJitterBufferSize(uint32& aBufferSz) const;
    454         void SetJitterBufferChunkAllocator(OsclMemPoolResizableAllocator* aDataBufferAllocator);
    455         bool RequestEventCallBack(JB_NOTIFY_CALLBACK aEventType, uint32 aDelay = 0, OsclAny* aContext = NULL);
    456         void CancelEventCallBack(JB_NOTIFY_CALLBACK aEventType, OsclAny* aContext = NULL);
    457         void HandleEvent_IncomingMediaInactivityDurationExpired();
    458         void HandleEvent_NotifyReportBufferingStatus();
    459         void HandleEvent_JitterBufferBufferingDurationComplete();
    460 
    461         /* Bitstream thinning releated */
    462         void UpdateRebufferingStats(PVMFEventType aEventType);
    463         PVMFNodeCapability iCapability;
    464         PVMFJitterBufferNodeCmdQ iInputCommands;
    465         PVMFJitterBufferNodeCmdQ iCurrentCommand;
    466         PVMFPortVector<PVMFJitterBufferPort, OsclMemAllocator> iPortVector;
    467         Oscl_Vector<PVMFJitterBufferPortParams*, OsclMemAllocator> iPortParamsQueue;
    468         Oscl_Vector<PVMFPortActivity, OsclMemAllocator> iPortActivityQueue;
    469 
    470         bool    oStartPending;
    471         bool    oStopOutputPorts;
    472         uint32  iPauseTime;
    473 
    474         PVMFMediaClock* ipClientPlayBackClock;
    475 
    476         bool    iMediaReceiveingChannelPrepared;
    477 
    478         PVMFJitterBufferMisc*   ipJitterBufferMisc;
    479 
    480         bool iBroadCastSession;
    481 
    482         JitterBufferFactory* ipJitterBufferFactory;
    483         /////////////////////////////////////////////////////////////////////////////
    484         //Following variables are shared with the jitter buffers associated with the session and are passed by refernce
    485         //Node should only observe these and initialize it, and modification to these are supposed to be done by the
    486         //jitter buffer only
    487         bool    iDelayEstablished;
    488         int     iJitterDelayPercent;
    489         PVMFJitterBufferDataState iJitterBufferState;
    490 
    491         /////////////////////////////////////////////////////////////////////////////
    492         //Extention interface
    493         PVMFJitterBufferExtensionInterfaceImpl* ipExtensionInterface;
    494         //Variables to persist info passed on by the extension interface
    495         uint32 iRebufferingThreshold;
    496         uint32 iJitterBufferDurationInMilliSeconds;
    497         uint32 iMaxInactivityDurationForMediaInMs;
    498         uint32 iEstimatedServerKeepAheadInMilliSeconds;
    499         /* resizable reallocator configuration */
    500         uint32 iJitterBufferSz;
    501         uint iMaxNumBufferResizes;
    502         uint iBufferResizeSize;
    503         uint32 iBufferingStatusIntervalInMs;
    504 
    505         PVMFJitterBufferFireWallPacketInfo iFireWallPacketInfo;
    506         bool iDisableFireWallPackets;
    507         bool iPlayingAfterSeek;
    508         ///////////////////////////////////////////////////////////////////////
    509         //EventNotification tracking vars
    510         PVMFJBEventNotifier*    ipEventNotifier;
    511         uint32 iIncomingMediaInactivityDurationCallBkId;
    512         bool   iIncomingMediaInactivityDurationCallBkPending;
    513         uint32 iNotifyBufferingStatusCallBkId;
    514         bool   iNotifyBufferingStatusCallBkPending;
    515         uint32 iJitterBufferDurationCallBkId;
    516         bool   iJitterBufferDurationCallBkPending;
    517 
    518         //////////////////////// Diagnostic log related  //////////////////////
    519         bool iDiagnosticsLogged;
    520         uint32 iNumRunL;
    521         ///////////////////////////////////////////////////////////////////////
    522 
    523         ///////////////////////////////////////////////////////////////////////
    524         //Loggers
    525         PVLogger* ipLogger;
    526         PVLogger* ipDataPathLogger;
    527         PVLogger* ipDataPathLoggerIn;
    528         PVLogger* ipDataPathLoggerOut;
    529         PVLogger* ipDataPathLoggerFlowCtrl;
    530         PVLogger* ipClockLogger;
    531         PVLogger* ipClockLoggerSessionDuration;
    532         PVLogger* ipClockLoggerRebuff;
    533         PVLogger* ipDiagnosticsLogger;
    534         PVLogger* ipJBEventsClockLogger;
    535         ///////////////////////////////////////////////////////////////////////
    536 };
    537 #endif
    538