multimediacommscontroller/mmccrtpsourcesink/inc/mccjittercalculator.h
changeset 0 1bce908db942
child 32 f2ed1fc4c163
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    MccJitterCalculator calculates jitter level and compares given
       
    15 *                triggers.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #ifndef MCCJITTERCALCULATOR_H
       
    23 #define MCCJITTERCALCULATOR_H
       
    24 
       
    25 //  INCLUDES
       
    26 #include <mmf/common/mmfcontrollerframework.h>
       
    27 #include <mmccinterfacedef.h>
       
    28 
       
    29 #ifdef FTD_ENABLED
       
    30 #include <e32msgqueue.h>
       
    31 #include <mccstreamstats.h>
       
    32 #include <mccjbufferstats.h>
       
    33 #endif
       
    34 
       
    35 
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39 *  Observer for jitter calculation event notification
       
    40 *
       
    41 *  @lib      MccRtpSourceSink.dll
       
    42 *  @since    Series 60 3.2
       
    43 */
       
    44 class MRtpJitterObserver
       
    45     {
       
    46     public:
       
    47           virtual void SendJitterEvent( TMccRtpEventData aEvent, TInt aError ) = 0;
       
    48     };
       
    49 
       
    50 
       
    51 /**
       
    52 * Class which implements jittercalculations for received RTP packets
       
    53 * 
       
    54 * @lib Mccrtpsourcesink.dll
       
    55 * @since Series 60 3.0
       
    56 */
       
    57 class CMccJitterCalculator : public CBase
       
    58     {
       
    59     public:  // Constructors and destructor
       
    60         
       
    61         /**
       
    62         * Two-phased constructor.
       
    63         */
       
    64         static CMccJitterCalculator* NewL( MRtpJitterObserver& aObserver );
       
    65         
       
    66         /**
       
    67         * Destructor.
       
    68         */
       
    69         virtual ~CMccJitterCalculator( );
       
    70 
       
    71     public: // New functions
       
    72     
       
    73         /**
       
    74         * Starts media quality observing
       
    75         * @since    Series 60 3.0
       
    76         * @return   Error code
       
    77         */
       
    78         TInt StartObserving();
       
    79         
       
    80         /**
       
    81         * Cancels media quality observing
       
    82         * @since    Series 60 3.0
       
    83         * @return   void
       
    84         */
       
    85         void CancelObserving();
       
    86         
       
    87         /**
       
    88         * Handles received packets and calculates jitter level
       
    89         * @since    Series 60 3.0
       
    90         * @param    "aHeaderInfo"
       
    91         *           RTP header from received packet
       
    92         * @return   void
       
    93         */
       
    94         void RtpPacketReceived( const TUint32 aTimeStamp, TBool aMarker );
       
    95         
       
    96         /**
       
    97         * Set media configurations
       
    98         * @since    Series 60 3.0
       
    99         * @param    "aMessage"
       
   100         *           message from client
       
   101         * @return   void
       
   102         */
       
   103         void SetMediaConfigsL( const TMMFMessage& aMessage );
       
   104         
       
   105         /**
       
   106         * Reset local counters
       
   107         * @since    Series 60 3.0
       
   108         * @return   void
       
   109         */
       
   110         void ResetCounters( );
       
   111         
       
   112         /**
       
   113         * Check the observing status
       
   114         * @since    Series 60 3.0
       
   115         * @return   iMediaQualityObservingStarted
       
   116         */
       
   117         TBool IsObserving() const;
       
   118         
       
   119     private:
       
   120         /**
       
   121         * C++ default constructor.
       
   122         */
       
   123         CMccJitterCalculator( MRtpJitterObserver& aObserver );
       
   124 
       
   125         /**
       
   126         * By default Symbian 2nd phase constructor is private.
       
   127         */
       
   128         void ConstructL();
       
   129         
       
   130         /**
       
   131         * Jitter level observing routines
       
   132         * @since    Series 60 3.0
       
   133         * @return   void
       
   134         */
       
   135         void JitterObserving();
       
   136         
       
   137     private:   
       
   138         
       
   139         // Number of packets received
       
   140         TUint32 iPacketsReceived;
       
   141 
       
   142         // Current jitter estimate
       
   143         TUint64 iCurJitter;
       
   144 
       
   145         // Holds the previous packet arrival time
       
   146         TTime iPrevPacketArrival;
       
   147         
       
   148         // Holds the previous packets transit time
       
   149         TInt64 iPrevPacketTransit;
       
   150                 
       
   151         // Indicates reference jitter level from client
       
   152         TUint iJitterLevelFromClient;
       
   153         
       
   154         // Indicates current report type
       
   155         TInt iReportType;
       
   156         
       
   157         // Indicates report interval type
       
   158         TInt iReportIntervalType;
       
   159         
       
   160         // Indicates report interval
       
   161         TInt iReportInterval;
       
   162         
       
   163         // Flags for indicating jitter level observing state and frame loss rate
       
   164         TBool iJitterObsOn;
       
   165         TBool iFrameLossObsOn;
       
   166 
       
   167         // Indicates observing state. Refer to IsObserving-method
       
   168         TBool iMediaQualityObservingStarted;
       
   169         
       
   170         // Indicates interval time
       
   171         TTime iIntervalTime;
       
   172         
       
   173         // Indicates packet loss rate from client
       
   174         TInt iPacketLossFromClient;
       
   175         
       
   176         // Indicates amount of received packets
       
   177         TUint32 iReceivedPacketCounter;
       
   178         
       
   179         // Media config buffer is filled with config data
       
   180         TMccMediaQualityConfig iMediaConf;
       
   181         
       
   182         // Indicates home time
       
   183         TTime iHomeTime;
       
   184         
       
   185         // Indicates current time
       
   186         TTime iCurTime;
       
   187         
       
   188         /**
       
   189          * jitter observer
       
   190          * Own.
       
   191          */
       
   192         MRtpJitterObserver* iObserver;
       
   193         
       
   194         #ifdef FTD_ENABLED
       
   195 
       
   196         // Message queue carrying stream statistics
       
   197         RMsgQueue<TMccStreamStats> iStreamStatsQueue;
       
   198         
       
   199         // Message queue carrying jitter buffer statistics
       
   200         RMsgQueue<TMccJBufferStats> iJBufStatsQueue;
       
   201 
       
   202         #endif
       
   203         
       
   204         #ifdef TEST_EUNIT
       
   205         public:
       
   206             friend class UT_CMccRtpDataSource;
       
   207             friend class UT_CMccJitterCalculator;
       
   208         #endif
       
   209     };
       
   210 
       
   211 #endif      // MCCJITTERCALCULATOR_H   
       
   212             
       
   213 // End of File