Revision: 201031 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 19 Aug 2010 10:18:22 +0300
branchRCL_3
changeset 42 817c922b90eb
parent 41 b9d283c5c7b5
child 45 3f7c7e6eea8a
Revision: 201031 Kit: 201033
ipappsrv_plat/media_control_api/inc/mmcccodecinformation.h
ipappsrv_plat/media_control_api/inc/mmccevents.h
ipappsrv_plat/multimedia_comms_api/inc/mcefilesink.h
ipappsrv_plat/multimedia_comms_api/inc/mcertpsink.h
multimediacommscontroller/mmccinterface/src/mmcccodecinformation.cpp
multimediacommscontroller/mmccinterface/tsrc/ut_interface/inc/UT_CMCCCodecInformation.h
multimediacommscontroller/mmccinterface/tsrc/ut_interface/src/UT_CMCCCodecInformation.cpp
multimediacommscontroller/mmccjitterbuffer/group/jitterbuffer.mmp
multimediacommscontroller/mmccjitterbuffer/inc/mccjitterbufferimpl.h
multimediacommscontroller/mmccjitterbuffer/src/mccjitterbufferimpl.cpp
multimediacommscontroller/mmccjitterbuffer/tsrc/ut_jitterbuffer/src/UT_CMccJitterBufferImpl.cpp
multimediacommscontroller/mmccrtpsourcesink/inc/mccjittercalculator.h
multimediacommscontroller/mmccrtpsourcesink/inc/mccrtpdatasink.h
multimediacommscontroller/mmccrtpsourcesink/inc/mccrtpdatasource.h
multimediacommscontroller/mmccrtpsourcesink/inc/mccrtpinterface.h
multimediacommscontroller/mmccrtpsourcesink/src/mccjittercalculator.cpp
multimediacommscontroller/mmccrtpsourcesink/src/mccrtpdatasink.cpp
multimediacommscontroller/mmccrtpsourcesink/src/mccrtpdatasource.cpp
multimediacommscontroller/mmccrtpsourcesink/src/mccrtpinterface.cpp
multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/group/UT_MccRtpSourceSink.mmp
multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/inc/UT_CMccJitterCalculator.h
multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/inc/UT_CMccRtpDataSink.h
multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/inc/UT_CMccRtpDataSource.h
multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/inc/UT_CMccRtpInterface.h
multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/src/UT_CMccJitterCalculator.cpp
multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/src/UT_CMccRtpDataSink.cpp
multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/src/UT_CMccRtpDataSource.cpp
multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/src/UT_CMccRtpInterface.cpp
multimediacommscontroller/mmccshared/inc/mccinternalcodecs.h
multimediacommscontroller/mmccsubcontroller/group/subcontroller.mmp
multimediacommscontroller/mmccsubcontroller/inc/mccrtpkeepalive.h
multimediacommscontroller/mmccsubcontroller/inc/mccrtpkeepalivecontainer.h
multimediacommscontroller/mmccsubcontroller/inc/mccsymdlstream.h
multimediacommscontroller/mmccsubcontroller/inc/mccsymsimpledlstream.h
multimediacommscontroller/mmccsubcontroller/src/mccdtmfulstream.cpp
multimediacommscontroller/mmccsubcontroller/src/mccrtpkeepalive.cpp
multimediacommscontroller/mmccsubcontroller/src/mccrtpkeepalivecontainer.cpp
multimediacommscontroller/mmccsubcontroller/src/mccrtpmanager.cpp
multimediacommscontroller/mmccsubcontroller/src/mccsymdlstream.cpp
multimediacommscontroller/mmccsubcontroller/src/mccsymsimpledlstream.cpp
multimediacommscontroller/mmccsubcontroller/src/mccsymsubthreadclient.cpp
multimediacommscontroller/mmccsubcontroller/src/mccsymulstream.cpp
multimediacommscontroller/mmccsubcontroller/tsrc/ut_subcontroller/Inc/UT_CMCCSymSimpleDlStream.h
multimediacommscontroller/mmccsubcontroller/tsrc/ut_subcontroller/Inc/UT_CMccSymDlStream.h
multimediacommscontroller/mmccsubcontroller/tsrc/ut_subcontroller/Src/UT_CMCCSymSimpleDlStream.cpp
multimediacommscontroller/mmccsubcontroller/tsrc/ut_subcontroller/Src/UT_CMccRtpKeepalive.cpp
multimediacommscontroller/mmccsubcontroller/tsrc/ut_subcontroller/Src/UT_CMccSymDlStream.cpp
multimediacommscontroller/tsrc/rtpsourcesinkstub/inc/mccrtpdatasource.h
multimediacommscontroller/tsrc/rtpsourcesinkstub/src/MccRtpDataSource_STUB.cpp
multimediacommscontroller/tsrc/rtpsourcesinkstub/src/mccrtpinterface_stub.cpp
multimediacommscontroller/tsrc/stubs/src/mccrtpkeepalivecontainer_STUB.cpp
multimediacommsengine/mmceshared/src/mcecomcodec.cpp
multimediacommsengine/mmcesrv/group/mceserver.mmp
multimediacommsengine/mmcesrv/mmceserver/src/mcesipconnection.cpp
multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/src/UT_CMCESIPConnection.cpp
multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/stubs/src/sipprofile.cpp
multimediacommsengine/tsrc/mccstub/src/MmccCodecInformation.cpp
natplugins/natpcliprovisioningnatfwadapter/group/wpnatfwtraversaladapter.mmp
--- a/ipappsrv_plat/media_control_api/inc/mmcccodecinformation.h	Thu Jul 15 19:04:32 2010 +0300
+++ b/ipappsrv_plat/media_control_api/inc/mmcccodecinformation.h	Thu Aug 19 10:18:22 2010 +0300
@@ -584,8 +584,8 @@
     virtual TInt PriorityPreference( ) const;
 
     /**
-    * Get keep alive packets send timer value.
-    * @return keep alive packets send timer value.
+    * Get keep alive packets send timer value in seconds.
+    * @return keep alive packets send timer value in seconds.
     */
     virtual TUint8 KeepAliveTimer() const;
 
@@ -742,7 +742,21 @@
     */
     virtual TInt GetInterleaving() const;
           
-    
+public:
+
+   /**
+    * Set keep alive packets send timer value.
+    * @param aTimerValueMicroSecs timer value in microseconds for keep alive packets
+    * @return One of the standard system-wide error codes.
+    */
+	virtual TInt SetKeepAliveTimerMicroSecs( TUint32 aTimerValueMicroSecs );
+	
+	/**
+    * Get keep alive packets send timer value in microseconds.
+    * @return keep alive packets send timer value in microseconds.
+    */
+	virtual TUint32 KeepAliveTimerMicroSecs() const;
+	   
 protected:  // Data
 
     /**
@@ -936,7 +950,7 @@
     TUint iVideoHeight;
     
     /**
-    * Timer value for keep alive data
+    * Timer value for keep alive data, seconds
     */
     TUint8 iKeepAliveTimer;
     
@@ -970,7 +984,12 @@
     * Encoder/decoder uid
     */
     TUid iEncodingDecodingDevice;
-        
+    
+	/**    
+	* Timer value for keep alive data, microseconds
+    */
+    TUint32 iKeepAliveTimerMicroSecs;
+	
 private:
 
     #ifdef TEST_EUNIT
--- a/ipappsrv_plat/media_control_api/inc/mmccevents.h	Thu Jul 15 19:04:32 2010 +0300
+++ b/ipappsrv_plat/media_control_api/inc/mmccevents.h	Thu Aug 19 10:18:22 2010 +0300
@@ -400,6 +400,65 @@
     };
     
 typedef TPckgBuf<TMccDtmfEventData> TMccDtmfEventDataPackage;
+
+
+/**
+* Rtp SourceSink event data, extended version
+*/
+class TMccRtpEventDataExtended : public TMccRtpEventData
+    {
+    public: 
+    
+        /**
+        * Default constructor
+        */
+        inline TMccRtpEventDataExtended() :
+            TMccRtpEventData(),
+  			iPacketLoss( 0 ),
+			iTriggeredPacketLoss( 0 )
+            {   
+            }
+    
+        /**
+        * Copy constructor
+        */           
+        inline TMccRtpEventDataExtended( const TMccRtpEventDataExtended& aEvent ) :
+            TMccRtpEventData( aEvent ),
+            iPacketLoss( aEvent.iPacketLoss ),
+			iTriggeredPacketLoss( aEvent.iTriggeredPacketLoss )
+            {
+            }
+        
+        
+        /**
+         * parametrized constructor
+         */
+        inline TMccRtpEventDataExtended( TInt64 aEstimate, 
+                                 TUint32 aPcksRec, 
+                                 TInt64 aPrevTransTime, 
+                                 TUint64 aTriggeredJitterLevel,
+                                 TInt aPacketLoss,
+								 TInt aTriggeredPacketLoss ) :
+            TMccRtpEventData(	aEstimate, 
+            					aPcksRec, 
+            					aPrevTransTime, 
+            					aTriggeredJitterLevel ),
+            iPacketLoss( aPacketLoss ),
+			iTriggeredPacketLoss( aTriggeredPacketLoss )
+            {
+            }
+        
+    public: // Data
+        
+        // Current packet loss percentage
+		TInt iPacketLoss;
+		
+		// Triggered packet loss percentage
+		TInt iTriggeredPacketLoss;
+
+    };
+    
+typedef TPckgBuf<TMccRtpEventDataExtended> TMccRtpEventDataExtendedPackage; 
       
 #endif      // MMCCEVENTS_H   
             
--- a/ipappsrv_plat/multimedia_comms_api/inc/mcefilesink.h	Thu Jul 15 19:04:32 2010 +0300
+++ b/ipappsrv_plat/multimedia_comms_api/inc/mcefilesink.h	Thu Aug 19 10:18:22 2010 +0300
@@ -23,7 +23,7 @@
 
 // INCLUDES
 #include <e32std.h>  
-#include <MceMediaSink.h>
+#include <mcemediasink.h>
 
 // FORWARD DECLARATIONS
 
--- a/ipappsrv_plat/multimedia_comms_api/inc/mcertpsink.h	Thu Jul 15 19:04:32 2010 +0300
+++ b/ipappsrv_plat/multimedia_comms_api/inc/mcertpsink.h	Thu Aug 19 10:18:22 2010 +0300
@@ -23,7 +23,7 @@
 
 // INCLUDES
 #include <e32std.h>  
-#include <MceMediaSink.h>
+#include <mcemediasink.h>
 
 // CONSTANTS
 const TMceSinkType KMceRTPSink = 1;
--- a/multimediacommscontroller/mmccinterface/src/mmcccodecinformation.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccinterface/src/mmcccodecinformation.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -37,6 +37,7 @@
 const TUint KDefaultPreference = EMdaPriorityPreferenceNone;
 const TUint KDefaultPriority = EMdaPriorityNormal;
 const TInt KDefaultModeChangePeriod = 1;
+const TUint KMccSecsToMicroSecs = 1000000;
 
 
 // MACROS
@@ -136,7 +137,16 @@
     iFrameSize = codecInfo.iFrameSize;
     iHwFrameTime = codecInfo.iHwFrameTime;
     
-    iKeepAliveTimer = codecInfo.iKeepaliveInterval;
+    if( (codecInfo.iKeepaliveInterval / KMccSecsToMicroSecs) > KMaxTUint8 )
+    	{
+    	iKeepAliveTimer = KMaxTUint8;
+    	iKeepAliveTimerMicroSecs = KMaxTUint8 * KMccSecsToMicroSecs;	
+    	}
+    else
+    	{
+    	iKeepAliveTimer = codecInfo.iKeepaliveInterval / KMccSecsToMicroSecs;
+    	iKeepAliveTimerMicroSecs = codecInfo.iKeepaliveInterval;	
+    	}
     iKeepAlivePT = codecInfo.iKeepalivePT;
     iKeepAliveData = codecInfo.iKeepaliveData;
     
@@ -188,7 +198,7 @@
     codecInfo.iRedundantPayload = iRedundancyPT;
     codecInfo.iNeighbor = iNeighbor;
     codecInfo.iModeChangePeriod = iModeChangePeriod;
-    codecInfo.iKeepaliveInterval = iKeepAliveTimer;
+    codecInfo.iKeepaliveInterval = iKeepAliveTimerMicroSecs;
     codecInfo.iKeepalivePT = iKeepAlivePT;
     codecInfo.iKeepaliveData = iKeepAliveData;
     codecInfo.iMaxRed = iMaxRed;
@@ -924,6 +934,7 @@
 TInt CMccCodecInformation::SetKeepAliveTimer( TUint8 aTimerValue )
     {
     iKeepAliveTimer = aTimerValue;
+    iKeepAliveTimerMicroSecs = aTimerValue * KMccSecsToMicroSecs;
     return KErrNone;    
     }
 
@@ -983,3 +994,34 @@
     {
     return iKeepAliveData;
     }
+
+// -----------------------------------------------------------------------------
+// CMccCodecInformation:SetKeepAliveTimerMicroSecs
+// Default implementation
+// -----------------------------------------------------------------------------
+// 
+TInt CMccCodecInformation::SetKeepAliveTimerMicroSecs( 
+									TUint32 aTimerValueMicroSecs )
+    {
+    if( (aTimerValueMicroSecs / KMccSecsToMicroSecs) > KMaxTUint8 )
+    	{
+    	iKeepAliveTimer = KMaxTUint8;
+    	iKeepAliveTimerMicroSecs = KMaxTUint8 * KMccSecsToMicroSecs;	
+    	}
+    else
+    	{
+    	iKeepAliveTimer = aTimerValueMicroSecs / KMccSecsToMicroSecs;	
+    	iKeepAliveTimerMicroSecs = aTimerValueMicroSecs;
+    	}
+    return KErrNone;    
+    }
+
+// -----------------------------------------------------------------------------
+// CMccCodecInformation:KeepAliveTimerMicroSecs
+// Default implementation
+// -----------------------------------------------------------------------------
+// 
+TUint32 CMccCodecInformation::KeepAliveTimerMicroSecs() const
+    {
+    return iKeepAliveTimerMicroSecs;
+    }
--- a/multimediacommscontroller/mmccinterface/tsrc/ut_interface/inc/UT_CMCCCodecInformation.h	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccinterface/tsrc/ut_interface/inc/UT_CMCCCodecInformation.h	Thu Aug 19 10:18:22 2010 +0300
@@ -156,6 +156,9 @@
         
         
          void UT_CMccCodecInformation_SetKeepAliveTimerL();
+         
+         
+         void UT_CMccCodecInformation_SetKeepAliveTimerMicroSecsL();
         
         
          void UT_CMccCodecInformation_SetKeepAlivePTL();
@@ -252,6 +255,9 @@
         
         
          void UT_CMccCodecInformation_KeepAliveTimerL();
+         
+         
+         void UT_CMccCodecInformation_KeepAliveTimerMicroSecsL();
         
         
          void UT_CMccCodecInformation_KeepAlivePTL();
--- a/multimediacommscontroller/mmccinterface/tsrc/ut_interface/src/UT_CMCCCodecInformation.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccinterface/tsrc/ut_interface/src/UT_CMCCCodecInformation.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -809,11 +809,25 @@
 
 void UT_CMccCodecInformation::UT_CMccCodecInformation_SetKeepAliveTimerL(  )
     {
+    const TInt KNum25 = 25;
+    const TInt KSecsToMicroSecs = 1000000;
     for( TInt k = 0; k < iCount; k++ )
         {
-        EUNIT_ASSERT_EQUALS( iCodecArray[k]->SetKeepAliveTimer( 25 ), KErrNone );
+        EUNIT_ASSERT_EQUALS( iCodecArray[k]->SetKeepAliveTimer( KNum25 ), KErrNone );
+        EUNIT_ASSERT_EQUALS( iCodecArray[k]->KeepAliveTimerMicroSecs(), KNum25 * KSecsToMicroSecs );
         }
     }
+    
+void UT_CMccCodecInformation::UT_CMccCodecInformation_SetKeepAliveTimerMicroSecsL(  )
+    {
+    const TInt KNum2000000 = 2000000;
+    const TInt KSecsToMicroSecs = 1000000;
+    for( TInt k = 0; k < iCount; k++ )
+        {
+        EUNIT_ASSERT_EQUALS( iCodecArray[k]->SetKeepAliveTimerMicroSecs( 2000000 ), KErrNone );
+        EUNIT_ASSERT_EQUALS( iCodecArray[k]->KeepAliveTimer(), KNum2000000 / KSecsToMicroSecs );
+        }
+    }    
 
 void UT_CMccCodecInformation::UT_CMccCodecInformation_SetKeepAlivePTL(  )
     {
@@ -1215,6 +1229,15 @@
                              iCodecArray[k]->iKeepAliveTimer );
         }
     }
+    
+void UT_CMccCodecInformation::UT_CMccCodecInformation_KeepAliveTimerMicroSecsL(  )
+    {
+    for( TInt k = 0; k < iCount; k++ )
+        {
+        EUNIT_ASSERT_EQUALS( iCodecArray[k]->KeepAliveTimerMicroSecs(), 
+                             iCodecArray[k]->iKeepAliveTimerMicroSecs );
+        }
+    }    
 
 void UT_CMccCodecInformation::UT_CMccCodecInformation_KeepAlivePTL(  )
     {
@@ -1733,6 +1756,13 @@
     "SetKeepAliveTimer",
     "FUNCTIONALITY",
     SetupL, UT_CMccCodecInformation_SetKeepAliveTimerL, Teardown)
+    
+EUNIT_TEST(
+    "SetKeepAliveTimerMicroSecs - test ",
+    "CMccCodecInformation",
+    "SetKeepAliveTimerMicroSecs",
+    "FUNCTIONALITY",
+    SetupL, UT_CMccCodecInformation_SetKeepAliveTimerMicroSecsL, Teardown)    
 
 EUNIT_TEST(
     "SetKeepAlivePT - test ",
@@ -1957,6 +1987,13 @@
     "KeepAliveTimer",
     "FUNCTIONALITY",
     SetupL, UT_CMccCodecInformation_KeepAliveTimerL, Teardown)
+    
+EUNIT_TEST(
+    "KeepAliveTimerMicroSecs - test ",
+    "CMccCodecInformation",
+    "KeepAliveTimerMicroSecs",
+    "FUNCTIONALITY",
+    SetupL, UT_CMccCodecInformation_KeepAliveTimerMicroSecsL, Teardown)    
 
 EUNIT_TEST(
     "KeepAlivePT - test ",
--- a/multimediacommscontroller/mmccjitterbuffer/group/jitterbuffer.mmp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccjitterbuffer/group/jitterbuffer.mmp	Thu Aug 19 10:18:22 2010 +0300
@@ -46,6 +46,6 @@
 LIBRARY         ecom.lib
 LIBRARY         mmfcontrollerframework.lib
 LIBRARY         mmfserverbaseclasses.lib
-LIBRARY         errorconcealmentintfc.lib
+LIBRARY         ErrorConcealmentIntfc.lib
 
 PAGED
--- a/multimediacommscontroller/mmccjitterbuffer/inc/mccjitterbufferimpl.h	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccjitterbuffer/inc/mccjitterbufferimpl.h	Thu Aug 19 10:18:22 2010 +0300
@@ -355,6 +355,9 @@
      */
     TBool iDropNextFrame;
     
+    // Saved bufLenMultiplier from SetupL()
+    TInt iBufLenMultiplier;
+    
     private:
         #ifdef TEST_EUNIT
             friend class UT_CMccJitterBufferImpl;
--- a/multimediacommscontroller/mmccjitterbuffer/src/mccjitterbufferimpl.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccjitterbuffer/src/mccjitterbufferimpl.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -116,7 +116,8 @@
         iPlayToneInterval( 0 ),
         iNotifyUser( ETrue ),
         iLatestNotifiedEvent( KMccEventNone ),
-        iSampleRate( KDefaultSampleRateInkHz )
+        iSampleRate( KDefaultSampleRateInkHz ),
+        iBufLenMultiplier( 1 )
     {
     iTonePlayTime.UniversalTime();
     }
@@ -207,135 +208,145 @@
     __ASSERT_ALWAYS( aCInfo.iJitterBufBufferLength, User::Leave( KErrArgument ) );
     __ASSERT_ALWAYS( aCInfo.iHwFrameTime, User::Leave( KErrArgument ) );
     
-    // Save the original HW frame time because we may need it in case of
-    // dynamic G.711 adjustment.
-    const TUint8 origHwtime = iCInfo.iHwFrameTime;
-    iCInfo = aCInfo;
-    iEventHandler = aEventHandler;
-    iEndpointId = aEndpointId;
-    
-    __JITTER_BUFFER_INT1( "CMccJitterBufferImpl::SetupL origHwtime:", origHwtime )
-    
-    if( iCInfo.iJitterBufInactivityTimeOut )
-        {
-        if( ( iCInfo.iJitterBufPlayToneFrequency > 0 ) && 
-            ( iCInfo.iJitterBufPlayToneDuration > 0 ) )
-            {
-            iPlayToneInterval = iCInfo.iJitterBufPlayToneTimeout;            
-            iPlay = ETrue;
-            }
-        }
-        
-    TInt bufLenMultiplier = 1;
-    if ( iCInfo.iFourCC == KMMFFourCCCodeAMR )
-        {
-        iFrameSize = KAMRNBFrameSize;
-        iFrameTime = KAMRNBFrameTime;
-        }
-    else if ( iCInfo.iFourCC == KMMFFourCCCodeAWB )
-        {   
-        iFrameSize = KAMRWBFrameSize;
-        iFrameTime = KAMRNBFrameTime;
-        iSampleRate = KWbSampleRateInkHz;
-        }
-    else if( iCInfo.iFourCC == KMccFourCCIdG711 )
-        {
-        // G.711 is configured dynamically. Take voip headerlength also in to
-        // account. G.711 hwframetime is in milliseconds, so need to multiply.
-        iFrameSize = ( iCInfo.iHwFrameTime * KDefaultSampleRateInkHz )
-            + KVoIPHeaderLength;
-        iFrameTime = 0;
-        
-        // In case of G.711 codec dynamic configuration, we may need to double
-        // the jitterbuffer length if HW frame time is changed from 20ms to
-        // 10ms. 
-        if ( origHwtime )
-            {
-            bufLenMultiplier = origHwtime / iCInfo.iHwFrameTime;
-            if ( !bufLenMultiplier )
-                {
-                bufLenMultiplier = 1;
-                }
-            }
-        }
-    else if( iCInfo.iFourCC == KMccFourCCIdILBC )
-        {
-        iFrameSize = KILBCFrameSize;
-        iFrameTime = 0;
-        }
-    else if( iCInfo.iFourCC == KMccFourCCIdG729 )
-        {
-        iFrameSize = KG729FrameSize;
-        iFrameTime = 0;
-        // Multiply G.729 also by two...
-        bufLenMultiplier = 2;
-        }
-    else
-        {
-        __JITTER_BUFFER( "CMccJitterBufferImpl::SetupL KErrNotSupported" )
-        
-        User::Leave( KErrNotSupported );
-        }
-            
-    // Delete old buffer & reset it
-    const TInt elems = iBuffer.Count();
-    for( TInt i = 0; i < elems; i++ )
-        {
-        delete iBuffer[i].iDataFrame;
-        iBuffer[i].iDataFrame = NULL;
-        }
-    
-    iBuffer.Reset();
-    
-    // Calculate needed elements
-    TInt bufLen = iCInfo.iJitterBufBufferLength * bufLenMultiplier;
-    
-    __JITTER_BUFFER_INT1( "CMccJitterBufferImpl::SetupL G.711 bufLenMultiplier ",
-        bufLenMultiplier )
-    __JITTER_BUFFER_INT1( "CMccJitterBufferImpl::SetupL iBufferLength: ",
-        bufLen )
-    
-    __ASSERT_ALWAYS( aPlayoutThreshold < bufLen, User::Leave( KErrTooBig ) );
-    
-    // if differences between bufferlength and treshold set by client
-    // is less than 10, increase bufferlength so the differences is 10
-    // this is to help buffer goes to overflow easily.
-    // Also possible G.711/729 multiplier needs to be taken care of.
-    CheckThresholdBufferLength( bufLen, aPlayoutThreshold );
-    iCurrentPlayThreshold = aPlayoutThreshold * bufLenMultiplier;
-    iOriginalPlayThreshold = aPlayoutThreshold * bufLenMultiplier;
-    
-    if( iCnGenerator )
-        {
-        delete iCnGenerator;
-        iCnGenerator = NULL;
-        }
+    if( aCInfo.iJitterBufInactivityTimeOut 	!= iCInfo.iJitterBufInactivityTimeOut 
+    	|| aCInfo.iJitterBufBufferLength 	!= iCInfo.iJitterBufBufferLength
+    	|| aCInfo.iHwFrameTime 				!= iCInfo.iHwFrameTime 
+    	|| aCInfo.iFourCC 					!= iCInfo.iFourCC   
+    	|| aPlayoutThreshold 				!= iOriginalPlayThreshold / iBufLenMultiplier )
+	    {
+	    // Save the original HW frame time because we may need it in case of
+	    // dynamic G.711 adjustment.
+	    const TUint8 origHwtime = iCInfo.iHwFrameTime;
+	    iCInfo = aCInfo;
+	    iEventHandler = aEventHandler;
+	    iEndpointId = aEndpointId;
+	    
+	    __JITTER_BUFFER_INT1( "CMccJitterBufferImpl::SetupL origHwtime:", origHwtime )
+	    
+	    if( iCInfo.iJitterBufInactivityTimeOut )
+	        {
+	        if( ( iCInfo.iJitterBufPlayToneFrequency > 0 ) && 
+	            ( iCInfo.iJitterBufPlayToneDuration > 0 ) )
+	            {
+	            iPlayToneInterval = iCInfo.iJitterBufPlayToneTimeout;            
+	            iPlay = ETrue;
+	            }
+	        }
+	        
+	    TInt bufLenMultiplier = 1;
+	    if ( iCInfo.iFourCC == KMMFFourCCCodeAMR )
+	        {
+	        iFrameSize = KAMRNBFrameSize;
+	        iFrameTime = KAMRNBFrameTime;
+	        }
+	    else if ( iCInfo.iFourCC == KMMFFourCCCodeAWB )
+	        {   
+	        iFrameSize = KAMRWBFrameSize;
+	        iFrameTime = KAMRNBFrameTime;
+	        iSampleRate = KWbSampleRateInkHz;
+	        }
+	    else if( iCInfo.iFourCC == KMccFourCCIdG711 )
+	        {
+	        // G.711 is configured dynamically. Take voip headerlength also in to
+	        // account. G.711 hwframetime is in milliseconds, so need to multiply.
+	        iFrameSize = ( iCInfo.iHwFrameTime * KDefaultSampleRateInkHz )
+	            + KVoIPHeaderLength;
+	        iFrameTime = 0;
+	        
+	        // In case of G.711 codec dynamic configuration, we may need to double
+	        // the jitterbuffer length if HW frame time is changed from 20ms to
+	        // 10ms. 
+	        if ( origHwtime )
+	            {
+	            bufLenMultiplier = origHwtime / iCInfo.iHwFrameTime;
+	            if ( !bufLenMultiplier )
+	                {
+	                bufLenMultiplier = 1;
+	                }
+	            }
+	        }
+	    else if( iCInfo.iFourCC == KMccFourCCIdILBC )
+	        {
+	        iFrameSize = KILBCFrameSize;
+	        iFrameTime = 0;
+	        }
+	    else if( iCInfo.iFourCC == KMccFourCCIdG729 )
+	        {
+	        iFrameSize = KG729FrameSize;
+	        iFrameTime = 0;
+	        // Multiply G.729 also by two...
+	        bufLenMultiplier = 2;
+	        }
+	    else
+	        {
+	        __JITTER_BUFFER( "CMccJitterBufferImpl::SetupL KErrNotSupported" )
+	        
+	        User::Leave( KErrNotSupported );
+	        }
+	        
+	    // Save the bufLenMultiplier value, so we can use it later in comparison   
+		iBufLenMultiplier = bufLenMultiplier;
+	            
+	    // Delete old buffer & reset it
+	    const TInt elems = iBuffer.Count();
+	    for( TInt i = 0; i < elems; i++ )
+	        {
+	        delete iBuffer[i].iDataFrame;
+	        iBuffer[i].iDataFrame = NULL;
+	        }
+	    
+	    iBuffer.Reset();
+	    
+	    // Calculate needed elements
+	    TInt bufLen = iCInfo.iJitterBufBufferLength * bufLenMultiplier;
+	    
+	    __JITTER_BUFFER_INT1( "CMccJitterBufferImpl::SetupL G.711 bufLenMultiplier ",
+	        bufLenMultiplier )
+	    __JITTER_BUFFER_INT1( "CMccJitterBufferImpl::SetupL iBufferLength: ",
+	        bufLen )
+	    
+	    __ASSERT_ALWAYS( aPlayoutThreshold < bufLen, User::Leave( KErrTooBig ) );
+	    
+	    // if differences between bufferlength and treshold set by client
+	    // is less than 10, increase bufferlength so the differences is 10
+	    // this is to help buffer goes to overflow easily.
+	    // Also possible G.711/729 multiplier needs to be taken care of.
+	    CheckThresholdBufferLength( bufLen, aPlayoutThreshold );
+	    iCurrentPlayThreshold = aPlayoutThreshold * bufLenMultiplier;
+	    iOriginalPlayThreshold = aPlayoutThreshold * bufLenMultiplier;
+	    
+	    if( iCnGenerator )
+	        {
+	        delete iCnGenerator;
+	        iCnGenerator = NULL;
+	        }
 
-    iCnGenerator = CMccCnGenerator::NewL( iCInfo.iFourCC, aDevSound );
-    
-    // Create the elements in the Buffer
-    for( TInt k = 0; k < bufLen; k++ )
-        {
-        CMMFDataBuffer* buf = CMMFDataBuffer::NewL( iFrameSize );
-        CleanupStack::PushL( buf );
-        TJitterBufferElement newElement;
-        newElement.iDataFrame = buf;
-        newElement.iSequenceNumber = -1;
-        newElement.iStamp = -1;
-        iBuffer.AppendL( newElement );
-        CleanupStack::Pop( buf );
-        }
-    
-    // Zero the statistic members
-    iFramesLost = 0;
-    iFramesReceived = 0;
-    iNumOfLateFrames = 0;
-    iFramesRemoved = 0;
-    iFramesPlayed = 0;
-    iPacketsInBuffer = 0;
-    
-    // Calculate the sequence number increment
-    iSeqNumIncrement = iSampleRate * iCInfo.iHwFrameTime;
+	    iCnGenerator = CMccCnGenerator::NewL( iCInfo.iFourCC, aDevSound );
+	    
+	    // Create the elements in the Buffer
+	    for( TInt k = 0; k < bufLen; k++ )
+	        {
+	        CMMFDataBuffer* buf = CMMFDataBuffer::NewL( iFrameSize );
+	        CleanupStack::PushL( buf );
+	        TJitterBufferElement newElement;
+	        newElement.iDataFrame = buf;
+	        newElement.iSequenceNumber = -1;
+	        newElement.iStamp = -1;
+	        iBuffer.AppendL( newElement );
+	        CleanupStack::Pop( buf );
+	        }
+	    
+	    // Zero the statistic members
+	    iFramesLost = 0;
+	    iFramesReceived = 0;
+	    iNumOfLateFrames = 0;
+	    iFramesRemoved = 0;
+	    iFramesPlayed = 0;
+	    iPacketsInBuffer = 0;
+	    
+	    // Calculate the sequence number increment
+	    iSeqNumIncrement = iSampleRate * iCInfo.iHwFrameTime;
+	    }
     } 
         
 // -----------------------------------------------------------------------------
--- a/multimediacommscontroller/mmccjitterbuffer/tsrc/ut_jitterbuffer/src/UT_CMccJitterBufferImpl.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccjitterbuffer/tsrc/ut_jitterbuffer/src/UT_CMccJitterBufferImpl.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -246,6 +246,57 @@
     iJBufImpl->SetupL( 5, cInfo, *devSoundDummy, this, 0 );
     iJBufImpl->SetupL( 33, cInfo, *devSoundDummy, this, 0 );
     EUNIT_ASSERT( iJBufImpl->iSampleRate == 16 );
+    
+    
+    // Check that values are not changed: 
+    
+    // Save original values:
+	TMccCodecInfo originalCInfo( cInfo );
+    
+    // Set dummy values:
+    cInfo.iPayloadFormatEncoder = 111;
+    cInfo.iPayloadFormatDecoder = 222;
+    cInfo.iBitrate = 333;
+    cInfo.iSamplingFreq = 444;
+    cInfo.iEnableDTX = ETrue;
+    cInfo.iCodecMode = 555;
+    cInfo.iAlgoUsed = 666;
+    cInfo.iPtime = 777;
+    cInfo.iMaxPtime = 888;
+    cInfo.iPayloadType = 999;
+    cInfo.iRedundantPayload = 1111;
+    cInfo.iRedundancyCount = 2222;
+    cInfo.iFrameSize = 3333;
+    cInfo.iCNFrameSize = 4444;
+    cInfo.iFmtpLength = 5555;
+    cInfo.iJitterSize = 6666;
+    cInfo.iNeighbor = ETrue;
+    cInfo.iModeChangePeriod = 7777;
+    cInfo.iJitterBufPlayToneTimeout = 8888; 
+    cInfo.iJitterBufPlayToneFrequency = 9999; 
+    cInfo.iJitterBufPlayToneDuration = 1;
+    cInfo.iComfortNoiseGenerationPt = 2;
+    cInfo.iBitrateMask = 3;
+	cInfo.iAverageBitrate = 4;
+	cInfo.iMaxBitrate = 5;
+	cInfo.iFramerate = 6;
+    cInfo.iVideoWidth = 7;
+    cInfo.iVideoHeight = 8;   
+    cInfo.iMTUSize = 9;
+    cInfo.iSessionID = 1;
+    cInfo.iLinkID = 2;
+    cInfo.iStreamID = 3;
+    cInfo.iKeepaliveInterval = 1234;
+    cInfo.iKeepalivePT = 2;
+    cInfo.iIsUpdate = ETrue;
+    cInfo.iMaxRed = 1000;
+    cInfo.iSourceDefinedTimeStamps = ETrue;
+
+	// Put the same parameter values than in previous function call, 
+    iJBufImpl->SetupL( 33, cInfo, *devSoundDummy, this, 0 );
+    // and check that TMccCodecInfo values were not changed:
+    TBool retval = originalCInfo.Compare( originalCInfo, iJBufImpl->iCInfo );
+    EUNIT_ASSERT( retval );  
     }  
 
 void UT_CMccJitterBufferImpl::UT_CMccJitterBufferImpl_ResetBufferL()
--- a/multimediacommscontroller/mmccrtpsourcesink/inc/mccjittercalculator.h	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccrtpsourcesink/inc/mccjittercalculator.h	Thu Aug 19 10:18:22 2010 +0300
@@ -44,7 +44,7 @@
 class MRtpJitterObserver
     {
     public:
-          virtual void SendJitterEvent( TMccRtpEventData aEvent, TInt aError ) = 0;
+          virtual void SendJitterEvent( TMccRtpEventDataExtended aEvent, TInt aError ) = 0;
     };
 
 
@@ -91,7 +91,7 @@
         *           RTP header from received packet
         * @return   void
         */
-        void RtpPacketReceived( const TUint32 aTimeStamp, TBool aMarker );
+        void RtpPacketReceived( const TUint32 aTimeStamp, TBool aMarker, TUint16 aSeqNum );
         
         /**
         * Set media configurations
@@ -134,6 +134,44 @@
         */
         void JitterObserving();
         
+        /**
+        * Counts packet loss percentage from iStartingSeqNum, iCurrentSeqNum
+        * 		and iReceivedPacketCounter
+        * @return   Counted packet loss percentage
+        */
+        TInt CountPacketLossPercentage();
+        
+        /**
+        * Checks if current jitter level exceeds the jitter level given by the client,
+        * 		and if exceeded, sends the report to client 
+        * @param    "aReportIntervalReached"
+        *           Changed to ETrue if the report interval was reached
+        * @param    "aReportSent"
+        *           Changed to ETrue if the jitter report was sent
+        * @return   void
+        */
+        void CheckJitter( TBool& aReportIntervalReached, TBool& aReportSent );
+        
+        /**
+        * Checks if current packet loss level exceeds the packet loss level 
+        * 		given by the client, and if exceeded, sends the report to client 
+        * @param    "aReportIntervalReached"
+        *           Changed to ETrue if the report interval was reached
+        * @param    "aReportSent"
+        *           Changed to ETrue if the packet loss report was sent
+        * @return   void
+        */
+        void CheckPacketLoss( TBool& aReportIntervalReached, TBool& aReportSent );
+
+        /**
+        * Calculates a new FER value 
+        * @param    aPrevValue Previous FER value
+        * @param    aAdd Value to add( ETrue/EFalse)
+        * @param    aFlag To add (ETrue) or remove (EFalse)
+        * @return   new FER value
+        */    
+        TUint32 CalculateFer( TUint32 aPrevValue, TBool aAdd, TBool aFlag );
+
     private:   
         
         // Number of packets received
@@ -191,6 +229,21 @@
          */
         MRtpJitterObserver* iObserver;
         
+        // Current packet sequence number
+ 		TUint16 iCurrentSeqNum;
+ 		
+ 		// Packet sequence number where to start counting the packet loss
+ 		TUint16 iStartingSeqNum;
+
+        // Holds the previous number of packets expected
+        TUint32 iPrevExpectedPackets;
+        
+        // Holds the previous number of packets received
+        TUint32 iPrevPacketsReceived;
+        
+        // Holds the previous FER value
+        TUint32 iPrevFerValue;
+
         #ifdef FTD_ENABLED
 
         // Message queue carrying stream statistics
--- a/multimediacommscontroller/mmccrtpsourcesink/inc/mccrtpdatasink.h	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccrtpsourcesink/inc/mccrtpdatasink.h	Thu Aug 19 10:18:22 2010 +0300
@@ -85,16 +85,6 @@
         	}
 
         /**
-         * Sets rtp media clock instance for data sink. Instance is forwarded 
-         * to rtp keep alive sender.
-         *
-         * @since Series 60 3.0
-         * @param aRtpMediaClock media clock instance
-         * @return void
-         */
-        virtual void SetMediaClock( CMccRtpMediaClock& aRtpMediaClock );
-        
-        /**
          * Mutes/Unmutes RTP sink. When mute is enabled, only packets with
          * exception payload type are sent.
          *
--- a/multimediacommscontroller/mmccrtpsourcesink/inc/mccrtpdatasource.h	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccrtpsourcesink/inc/mccrtpdatasource.h	Thu Aug 19 10:18:22 2010 +0300
@@ -301,7 +301,7 @@
 		 * @since	Series 60 3.2
          * Send jitter event through mcc rtp interface
          */
-        void SendJitterEvent( TMccRtpEventData aEvent, TInt aError );
+        void SendJitterEvent( TMccRtpEventDataExtended aEvent, TInt aError );
 
         
     protected:  // Functions from base classes
--- a/multimediacommscontroller/mmccrtpsourcesink/inc/mccrtpinterface.h	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccrtpsourcesink/inc/mccrtpinterface.h	Thu Aug 19 10:18:22 2010 +0300
@@ -174,7 +174,7 @@
         * @param aConfig Configuration
         * @return void
         */
-        virtual void ConfigureL( const TDesC8& aConfig );
+        virtual void ConfigureL( const TDesC8& aConfig, CMccRtpMediaClock* aRtpMediaClock );
         
         /**
         * Sends RTCP receiver report to uplink if possible.
@@ -264,7 +264,8 @@
             iEventHandler( NULL ), iCodecInfo(), iMccStreamId( 0 ), 
             iMccEvent( TMccEvent() ), iRtpKeepalive( NULL ), iContext( NULL), 
             iSecSession( NULL ), iSrtpStream( NULL ), iRtpMediaClock( NULL ),
-            iContextId( 0 )
+            iContextId( 0 ),
+			iRtpKeepaliveUpdatePending( ETrue )
             { }
             
             
@@ -308,6 +309,19 @@
         
         void CloseStreams();
         
+        void SendJitterEventToClient( 	MAsyncEventHandler* aEventHandler,
+                                        TUid aEventOriginator,
+                                        TMccInternalEventType aInternalEventType,
+                                        TMccEventType aEventType,
+                                        TUint32 aEndpointId,
+                                        TInt aError = KErrNone, 
+                                        TUint64 aJitterEstimate = 0,
+                                        TUint32 aPacketsReceived = 0,
+                                        TInt64 aPrevTransTime = 0,
+                                        TUint64 aTriggeredJitterLevel = 0,
+        								TInt aPacketLoss = 0,
+        								TInt aTriggeredPacketLoss = 0 );
+        
         void SendInternalRtpEventToClient( MAsyncEventHandler* aEventHandler,
                                            TUid aEventOriginator,
                                            TMccInternalEventType aInternalEventType,
@@ -451,7 +465,12 @@
          * Context identifier
          */
          TUint32 iContextId;
-
+       
+	   /*
+         * Indicates need for setting media clock for keepalivetimer. 
+         */
+		TBool iRtpKeepaliveUpdatePending;	 
+		 
     private:    // Friend classes
     
         #ifdef TEST_EUNIT
--- a/multimediacommscontroller/mmccrtpsourcesink/src/mccjittercalculator.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccrtpsourcesink/src/mccjittercalculator.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description:    MccJitterCalculator calculates jitter level and compares given
+* Description:  MccJitterCalculator calculates jitter level and compares given
 *                triggers.
 *
 */
@@ -46,6 +46,13 @@
 const TInt KNum4( 4 );
 const TInt KNum8( 8 );
 const TInt KNumZero( 0 );
+const TInt KNumHundred( 100 );
+
+const TUint32 KRtpFractationAccuracy = 5000;
+// Specified period of the moving average
+const TUint32 KDivider = 250;
+// Specified the max calculate count of package loss
+const TUint32 KMaxCalCount = 200;
 
 // ============================ MEMBER FUNCTIONS ===============================
 
@@ -137,7 +144,7 @@
 // -----------------------------------------------------------------------------
 //
 void CMccJitterCalculator::RtpPacketReceived( const TUint32 aTimeStamp, 
-    TBool aMarker )
+    TBool aMarker, TUint16 aSeqNum )
     {
     #ifdef TRACE_JITCALC
         RDebug::Print( _L("CMccJitterCalculator::RtpPacketReceived IN") );
@@ -147,6 +154,33 @@
         VoipTrace("%x %x %d %d %d", MCC_TRACE, MCC_RECEIVED_RTP_PACKET_INFO,
         aHeaderInfo.iSeqNum, aHeaderInfo.iTimestamp, iPacketsReceived );
     #endif
+          
+    TBool calculatePkgLoss = ETrue;  
+    if ( EMccQualityPacketBased == iReportIntervalType || iFrameLossObsOn )
+        {
+        // Save current packet sequence number
+	    // The SeqNum come from RTP package. It maybe start from a random number between
+        // 0 to 65535. iStartingSeqNum should be reset 
+        // while iCurrentSeqNum was reset (by remote packages)
+    	iCurrentSeqNum = aSeqNum;
+		if( iStartingSeqNum == KNumZero ||
+			iStartingSeqNum > iCurrentSeqNum )
+			{
+			iStartingSeqNum = aSeqNum;
+			if ( iStartingSeqNum > 0 )
+				{
+			    iStartingSeqNum--;
+				}
+			else
+				{
+                #ifdef TRACE_JITCALC
+                RDebug::Print( _L("Received SeqNum is 0, don't calculate lost package") );
+                #endif
+			    calculatePkgLoss = EFalse;
+				}
+			}
+        iReceivedPacketCounter++; 
+		}
     
     // Jitter calculating based on RFC3550 Appendix A.8, see www.ietf.org
     if ( aMarker || !iPacketsReceived )
@@ -218,15 +252,20 @@
             RDebug::Print( _L("CMccJitterCalculator::RtpPacketReceived SENDING RCV: %d"), iPacketsReceived );
         #endif
         
-        TMccRtpEventData event( ( iCurJitter >> KNum4 ), 
+        TMccRtpEventDataExtended event( ( iCurJitter >> KNum4 ), 
                                 iPacketsReceived, 
                                 iPrevPacketTransit,
+                                KNumZero,
+                                KNumZero,
                                 KNumZero );
         
         iObserver->SendJitterEvent( event, KErrNone );
         }
     
-    JitterObserving();
+    if ( calculatePkgLoss )	
+    	{
+        JitterObserving();
+    	}    
     }
 
 // ---------------------------------------------------------------------------
@@ -302,6 +341,7 @@
     iJitterObsOn = EFalse;
     iFrameLossObsOn = EFalse;
     iMediaQualityObservingStarted = EFalse;
+    iStartingSeqNum = KNumZero;
     }
 
 // ---------------------------------------------------------------------------
@@ -356,6 +396,9 @@
     iPacketsReceived = KNumZero;
     iCurJitter = KNumZero;
     iPrevPacketTransit = KNumZero;
+    iCurrentSeqNum = KNumZero;
+	iStartingSeqNum = KNumZero;
+	iReceivedPacketCounter = KNumZero;
     }
 
 // -----------------------------------------------------------------------------
@@ -366,6 +409,13 @@
 //  
 void CMccJitterCalculator::JitterObserving()
     {
+    #ifdef TRACE_JITCALC
+        RDebug::Print( _L("CMccJitterCalculator::JitterObserving IN") );
+    #endif
+    
+    TBool resetValuesForNextReport = EFalse;
+    TBool cancelObs = EFalse;
+    
     if ( iJitterObsOn )
         {
         #ifdef TRACE_JITCALC
@@ -374,98 +424,32 @@
                 iJitterLevelFromClient, ( iCurJitter / KConversionFactor ) );
         #endif
         
-        // Normalize iCurJitter
-        TUint64 modJitter = iCurJitter >> KNum4;
-            
-        if ( EMccQualityTimeBased == iReportIntervalType )
-            {
-            // change microsecs to millisecs
-            TTimeIntervalMicroSeconds getTime = 
-                iCurTime.MicroSecondsFrom( iHomeTime );
-            
-            #ifdef TRACE_JITCALC
-                RDebug::Print( _L("CMccJitterCalculator::JitterObserving getTime = %Ld"), getTime.Int64() );
-            #endif
-            
-            if ( static_cast<TInt64>( iReportInterval ) <= 
-               ( getTime.Int64() / KConversionFactor ) )
-                {
-                // compare clients jitter level to current level
-                if ( static_cast<TUint64>( iJitterLevelFromClient ) < 
-                    modJitter )
-                    {
-                    #ifdef TRACE_JITCALC
-                        RDebug::Print ( _L("CMccJitterCalculator::JitterObserving jitterlevel %u ms compared to jitter estimate %Lu ms"), 
-                            iJitterLevelFromClient, modJitter );
-                    #endif
-                    
-                    TMccRtpEventData event( ( iCurJitter >> KNum4 ), 
-                                            iPacketsReceived, 
-                                            iPrevPacketTransit,
-                                            modJitter );
-                    
-                    // Informs client via event and cancels jitter observing
-                    iObserver->SendJitterEvent( event, KErrNone );
-                    CancelObserving();
-                    }
-                
-                // Initialize hometime again
-                iHomeTime.HomeTime();
-                
-                #ifdef TRACE_JITCALC       
-                    RDebug::Print ( _L("CMccJitterCalculator::JitterObserving Initialize iHomeTime = %Ld"), iHomeTime.Int64() );
-                #endif
-            
-                }           
-            }
-        else if ( EMccQualityPacketBased == iReportIntervalType )
-            {
-            iReceivedPacketCounter++;
-            
-            #ifdef TRACE_JITCALC
-                RDebug::Print( _L("CMccJitterCalculator::JitterObserving iReceivedPacketCounter: %u"), iReceivedPacketCounter );
-            #endif
-            
-            if ( iReportInterval == iReceivedPacketCounter )
-                {
-                // compare clients jitter level to current level
-                if ( iJitterLevelFromClient < modJitter )
-                    {
-                    #ifdef TRACE_JITCALC
-                        RDebug::Print( _L("CMccJitterCalculator::JitterObserving jitterlevel %u ms compared to jitter estimate %Lu ms"), 
-                            iJitterLevelFromClient, modJitter );
-                    #endif
-                    
-                    TMccRtpEventData event( ( iCurJitter >> KNum4 ), 
-                                            iPacketsReceived, 
-                                            iPrevPacketTransit,
-                                            modJitter );
-                    
-                    // Informs client via event and cancels jitter observing
-                    iObserver->SendJitterEvent( event, KErrNone );
-                    CancelObserving();
-                    }
-                  
-                iReceivedPacketCounter = KNumZero;
-                }
-            }
-         else
-            {
-            #ifdef TRACE_JITCALC
-                RDebug::Print( _L("CMccJitterCalculator::JitterObserving Report type is not valid!") );
-            #endif
-            
-            TMccRtpEventData event( ( iCurJitter >> KNum4 ), 
-                                      iPacketsReceived, 
-                                      iPrevPacketTransit,
-                                      KNumZero );
-            
-            iObserver->SendJitterEvent( event, KErrArgument );
-            CancelObserving();
-            }
+        CheckJitter( resetValuesForNextReport, cancelObs );
+        }
+        	
+	if ( iFrameLossObsOn )
+        {
+        #ifdef TRACE_JITCALC
+            RDebug::Print( _L("CMccJitterCalculator::JitterObserving Frame Loss observing ON") );
+        #endif
+        
+        CheckPacketLoss( resetValuesForNextReport, cancelObs );
         }
+ 
+    if( resetValuesForNextReport ) 
+		{
+        // Initialize hometime again
+        iHomeTime.HomeTime();
+        #ifdef TRACE_JITCALC       
+            RDebug::Print ( _L("CMccJitterCalculator::JitterObserving Initialize iHomeTime = %Ld"), iHomeTime.Int64() );
+        #endif
+		}
+	if( cancelObs )
+		{
+		CancelObserving();	
+		}
     }
-
+    
 // ---------------------------------------------------------------------------
 // CMccJitterCalculator::IsObserving
 // To check if observing is ON
@@ -476,4 +460,288 @@
     return iMediaQualityObservingStarted;
     }
     
+// -----------------------------------------------------------------------------
+// CMccJitterCalculator::CountPacketLossPercentage
+// Counts packet loss percentage from iStartingSeqNum, iCurrentSeqNum
+// 		and iReceivedPacketCounter
+// private method
+// -----------------------------------------------------------------------------
+//  
+TInt CMccJitterCalculator::CountPacketLossPercentage()
+	{
+    TUint32 numberOfPacketsExpected( 0 );
+    numberOfPacketsExpected = iCurrentSeqNum - iStartingSeqNum;
+        
+    if ( ( iPrevExpectedPackets - iPrevPacketsReceived ) ==
+            ( numberOfPacketsExpected - iReceivedPacketCounter ) )
+        {
+        // no packet  lost - inorder
+        iPrevFerValue = CalculateFer( iPrevFerValue, EFalse, ETrue );
+        }
+    else if ( ( iPrevPacketsReceived < iReceivedPacketCounter ) &&
+                ( iPrevExpectedPackets == numberOfPacketsExpected ) )
+        {
+        // no packet  lost - late packet - remove FER
+        iPrevFerValue = CalculateFer( iPrevFerValue, ETrue, EFalse );                               
+        }
+    else if ( numberOfPacketsExpected > iPrevExpectedPackets )
+        {
+
+        // packet  lost - add FER by number of packets lost.
+        // expected = 5, prev_expected 3 => diff 2 but loss is ONE thats why - 1
+        TUint32 maxCalcount = 
+				 numberOfPacketsExpected - iPrevExpectedPackets - 1  < KMaxCalCount ?
+				 numberOfPacketsExpected - iPrevExpectedPackets - 1 : KMaxCalCount;
+        for ( TUint32 i = 0; i < maxCalcount; i++ )
+           {
+           iPrevFerValue = CalculateFer( iPrevFerValue, ETrue, ETrue );
+           }
+        }
+    
+    iPrevExpectedPackets = numberOfPacketsExpected; 
+    iPrevPacketsReceived = iReceivedPacketCounter;
+    
+    TInt percentage( iPrevFerValue / KRtpFractationAccuracy ); 
+    return percentage;
+	}    
+    
+// -----------------------------------------------------------------------------
+// CMccJitterCalculator::CheckJitter
+// Checks if current jitter level exceeds the jitter level given by the client,
+// 		and if exceeded, sends the report to client 
+// private method
+// -----------------------------------------------------------------------------
+//      
+void CMccJitterCalculator::CheckJitter( TBool& aReportIntervalReached, 
+										TBool& aReportSent )
+	{
+	#ifdef TRACE_JITCALC
+        RDebug::Print( _L("CMccJitterCalculator::CheckJitter IN") );
+    #endif
+    
+	// Normalize iCurJitter
+    TUint64 modJitter = iCurJitter >> KNum4;
+        
+    if ( EMccQualityTimeBased == iReportIntervalType )
+        {
+        // change microsecs to millisecs
+        TTimeIntervalMicroSeconds getTime = 
+            iCurTime.MicroSecondsFrom( iHomeTime );
+        
+        #ifdef TRACE_JITCALC
+            RDebug::Print( _L("CMccJitterCalculator::CheckJitter getTime = %Ld"), getTime.Int64() );
+        #endif
+        
+        if ( static_cast<TInt64>( iReportInterval ) <= 
+           ( getTime.Int64() / KConversionFactor ) )
+            {
+            // compare clients jitter level to current level
+            if ( static_cast<TUint64>( iJitterLevelFromClient ) < 
+                modJitter )
+                {
+                #ifdef TRACE_JITCALC
+                    RDebug::Print ( _L("CMccJitterCalculator::CheckJitter jitterlevel %u ms compared to jitter estimate %Lu ms"), 
+                        iJitterLevelFromClient, modJitter );
+                #endif
+                
+                TMccRtpEventDataExtended event( ( iCurJitter >> KNum4 ), 
+                                        	iPacketsReceived, 
+                                        	iPrevPacketTransit,
+                                        	modJitter,
+                                        	KNumZero,
+                                        	KNumZero );
+                
+                // Informs client via event and cancels jitter observing
+                iObserver->SendJitterEvent( event, KErrNone );
+                aReportSent = ETrue; 
+                }
+            aReportIntervalReached = ETrue;
+            }           
+        }
+    else if ( EMccQualityPacketBased == iReportIntervalType )
+        {
+        #ifdef TRACE_JITCALC
+            RDebug::Print( _L("CMccJitterCalculator::CheckJitter iReceivedPacketCounter: %u"), iReceivedPacketCounter );
+        #endif
+        
+        if ( iReportInterval == iReceivedPacketCounter )
+            {
+            // compare clients jitter level to current level
+            if ( iJitterLevelFromClient < modJitter )
+                {
+                #ifdef TRACE_JITCALC
+                    RDebug::Print( _L("CMccJitterCalculator::CheckJitter jitterlevel %u ms compared to jitter estimate %Lu ms"), 
+                        iJitterLevelFromClient, modJitter );
+                #endif
+                
+                TMccRtpEventDataExtended event( ( iCurJitter >> KNum4 ), 
+                                        	iPacketsReceived, 
+                                        	iPrevPacketTransit,
+                                        	modJitter,
+                                        	KNumZero,
+                                        	KNumZero );
+                
+                // Informs client via event and cancels jitter observing
+                iObserver->SendJitterEvent( event, KErrNone );
+                aReportSent = ETrue; 
+                }  
+            aReportIntervalReached = ETrue;
+            }
+        }
+     else
+        {
+        #ifdef TRACE_JITCALC
+            RDebug::Print( _L("CMccJitterCalculator::CheckJitter Report type is not valid!") );
+        #endif
+        
+        TMccRtpEventDataExtended event( ( iCurJitter >> KNum4 ), 
+                                  	iPacketsReceived, 
+                                  	iPrevPacketTransit,
+                                  	KNumZero,
+                                  	KNumZero,
+                                  	KNumZero );
+        
+        iObserver->SendJitterEvent( event, KErrArgument );
+        aReportSent = ETrue; 
+        }
+	
+	}
+    
+// -----------------------------------------------------------------------------
+// CMccJitterCalculator::CheckPacketLoss
+// Checks if current packet loss level exceeds the packet loss level 
+// 		given by the client, and if exceeded, sends the report to client 
+// private method
+// -----------------------------------------------------------------------------
+//      
+void CMccJitterCalculator::CheckPacketLoss( TBool& aReportIntervalReached, 
+											TBool& aReportSent )
+	{
+	#ifdef TRACE_JITCALC
+        RDebug::Print( _L("CMccJitterCalculator::CheckPacketLoss IN") );
+    #endif
+
+    TInt packetLossPercentage = CountPacketLossPercentage();
+  
+    if ( EMccQualityTimeBased == iReportIntervalType )
+	    {
+	    // change microsecs to millisecs
+	    TTimeIntervalMicroSeconds getTime = 
+	        iCurTime.MicroSecondsFrom( iHomeTime );
+	    
+	    #ifdef TRACE_JITCALC
+	        RDebug::Print( _L("CMccJitterCalculator::CheckPacketLoss getTime = %Ld"), getTime.Int64() );
+	    #endif
+	    
+	    if ( static_cast<TInt64>( iReportInterval ) <= 
+	       ( getTime.Int64() / KConversionFactor ) )
+	        {
+			// If the packet loss percentage was exceeded
+			if( iPacketLossFromClient < packetLossPercentage ) 
+	            {
+	            #ifdef TRACE_JITCALC
+	                RDebug::Print( _L("CMccJitterCalculator::CheckPacketLoss Packet Loss From Client %u compared to Current Packet Loss %u "), 
+	                    iPacketLossFromClient, packetLossPercentage );
+	            #endif
+	            
+	            TMccRtpEventDataExtended event( ( iCurJitter >> KNum4 ), 
+	                                    iPacketsReceived, 
+	                                    iPrevPacketTransit,
+	                                    KNumZero,
+										packetLossPercentage,
+										packetLossPercentage );
+	            
+	            // Informs client via event and cancels jitter observing
+	            iObserver->SendJitterEvent( event, KErrNone );
+	            aReportSent = ETrue; 
+	   			}
+	        aReportIntervalReached = ETrue; 
+	        }
+	    }      
+	else if ( EMccQualityPacketBased == iReportIntervalType )
+	    {
+	    
+	    #ifdef TRACE_JITCALC
+		RDebug::Print( _L("CMccJitterCalculator::CheckPacketLoss EMccQualityPacketBased == iReportIntervalType") );
+	    RDebug::Print( _L("CMccJitterCalculator::CheckPacketLoss iReceivedPacketCounter: %u"), iReceivedPacketCounter );
+	    #endif
+	    
+	    if ( iReportInterval == iReceivedPacketCounter )  
+	        {
+			// If the packet loss percentage was exceeded
+			if( iPacketLossFromClient < packetLossPercentage ) 
+	            {
+	            #ifdef TRACE_JITCALC
+	                RDebug::Print( _L("CMccJitterCalculator::CheckPacketLoss Packet Loss From Client %u compared to Current Packet Loss %u "), 
+	                    iPacketLossFromClient, packetLossPercentage );
+	            #endif
+	            
+	            TMccRtpEventDataExtended event( ( iCurJitter >> KNum4 ), 
+	                                    iPacketsReceived, 
+	                                    iPrevPacketTransit,
+	                                    KNumZero,
+										packetLossPercentage,
+										packetLossPercentage );
+	            
+	            // Informs client via event and cancels jitter observing
+	            iObserver->SendJitterEvent( event, KErrNone );
+	            aReportSent = ETrue; 
+	   			}   
+	        aReportIntervalReached = ETrue; 
+	        }
+	    }
+	 else
+	    {
+	    #ifdef TRACE_JITCALC
+	        RDebug::Print( _L("CMccJitterCalculator::CheckPacketLoss Report type is not valid!") );
+	    #endif
+	    
+	    TMccRtpEventDataExtended event( ( iCurJitter >> KNum4 ), 
+	                              iPacketsReceived, 
+	                              iPrevPacketTransit,
+	                              KNumZero,
+	                              KNumZero,
+								  KNumZero );
+	    
+	    iObserver->SendJitterEvent( event, KErrArgument );
+	    aReportSent = ETrue; 
+	    }
+	}   
+
+// -----------------------------------------------------------------------------
+// CMccJitterCalculator::CalculateFer
+// Calculates a new FER value
+// -----------------------------------------------------------------------------
+//      
+TUint32 CMccJitterCalculator::CalculateFer( TUint32 aPrevValue,
+    TBool aAdd, TBool aFlag )
+    {
+    TUint32 ret = 0;
+    TInt64 temp_add = 0;
+
+    temp_add = aAdd * KNumHundred * KRtpFractationAccuracy;
+
+    TInt64 diff = temp_add - (TInt64)aPrevValue;
+    TInt32 tempValue = static_cast<TInt32>( diff / KDivider );
+    
+    if ( aFlag )
+        {
+        ret =  TUint32( aPrevValue + tempValue );
+        }
+    else
+        {
+        if ( aPrevValue > tempValue )
+            {
+            ret = TUint32( aPrevValue - tempValue );
+            }
+        else
+            {
+            // removed FER would have gone over thus zero
+            ret = 0;
+            }
+        }
+    
+    return ret;
+    }
+
 //  End of File  
--- a/multimediacommscontroller/mmccrtpsourcesink/src/mccrtpdatasink.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccrtpsourcesink/src/mccrtpdatasink.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -778,24 +778,6 @@
     }
 
 // ---------------------------------------------------------------------------
-// CMccRtpDataSink::SetMediaClock
-// ---------------------------------------------------------------------------
-//    
-void CMccRtpDataSink::SetMediaClock( CMccRtpMediaClock& aRtpMediaClock )
-    {
-    TRACE_RTP_SINK_PRINT( "CMccRtpDataSink::SetMediaClock" )
-    
-    if ( !iRtpMediaClock )
-        {
-        iRtpMediaClock = &aRtpMediaClock;
-        }
-    else
-        {
-        TRACE_RTP_SINK_PRINT( "CMccRtpDataSink::SetMediaClock - Allready set!" )
-        }
-    }
-
-// ---------------------------------------------------------------------------
 // FROM SRTP API
 // This function is called by SRTP Stream initiated with 
 // MSRTPReKeyingObserver when a master key is stale and needs 
--- a/multimediacommscontroller/mmccrtpsourcesink/src/mccrtpdatasource.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccrtpsourcesink/src/mccrtpdatasource.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -19,7 +19,7 @@
 
 
 // INCLUDE FILES
-#include <in_sock.h>
+#include <in_sock.h> 
 #include <mmf/common/mmfcontroller.h>
 
 #include "rtpapi.h"
@@ -254,7 +254,8 @@
         if ( iJitCalc->IsObserving() )
             {
             iJitCalc->RtpPacketReceived( aHeaderInfo.iTimestamp,
-                                         aHeaderInfo.iMarker );
+                                         aHeaderInfo.iMarker,
+                                         aHeaderInfo.iSeqNum );
             }
             
         // First packet after SourcePlayL, notify event handler by sending
@@ -851,20 +852,22 @@
 // CMccRtpDataSource::SendJitterEvent()
 // -----------------------------------------------------------------------------
 //	
-void CMccRtpDataSource::SendJitterEvent( TMccRtpEventData aEvent, TInt aError )
+void CMccRtpDataSource::SendJitterEvent( TMccRtpEventDataExtended aEvent, TInt aError )
     {
     TRACE_RTP_SOURCE_PRINT( "CMccRtpDataSource::SendJitterEvent" )
-	    
-	SendInternalRtpEventToClient( iEventHandler,
-	                              KMccRtpSourceUid, 
-                                  EMccInternalJitterEventStatusReport, 
-                                  KMccMediaQualityStatus,
-                                  MCC_RTPSOURCE_ENDPOINT_ID,
-                                  aError,
-                                  aEvent.iJitterEstimate,
-                                  aEvent.iPacketsReceived,
-                                  aEvent.iPrevTransTime,
-                                  aEvent.iTriggeredJitterLevel );
+
+	SendJitterEventToClient( iEventHandler,
+	                         KMccRtpSourceUid, 
+                             EMccInternalJitterEventStatusReport, 
+                             KMccMediaQualityStatus,
+                             MCC_RTPSOURCE_ENDPOINT_ID,
+                             aError,
+                             aEvent.iJitterEstimate,
+                             aEvent.iPacketsReceived,
+                             aEvent.iPrevTransTime,
+                             aEvent.iTriggeredJitterLevel,
+                             aEvent.iPacketLoss,
+                             aEvent.iTriggeredPacketLoss );
     }  
 
 // -----------------------------------------------------------------------------
--- a/multimediacommscontroller/mmccrtpsourcesink/src/mccrtpinterface.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccrtpsourcesink/src/mccrtpinterface.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -204,11 +204,17 @@
 // Configures the RTP source/sink
 // -----------------------------------------------------------------------------
 //
-void MMccRtpInterface::ConfigureL( const TDesC8& aConfig )
+void MMccRtpInterface::ConfigureL( const TDesC8& aConfig, 
+									CMccRtpMediaClock* aRtpMediaClock )
     {
     TRACE_RTP_INTERFACE_PRINT( "MMccRtpInterface::ConfigureL, Entry" )
     __ASSERT_ALWAYS( NULL != iRtpKeepalive, User::Leave( KErrNotReady ) );
     
+    if ( !iRtpMediaClock )
+        {
+        iRtpMediaClock = aRtpMediaClock;
+        }
+    
     if ( aConfig.Size() == sizeof( TMccCodecInfo ) )
         {
         TMccCodecInfoBuffer infoBuffer;
@@ -228,17 +234,28 @@
                 ( iCodecInfo.iKeepalivePT != codecInfo.iKeepalivePT ||
                 iCodecInfo.iKeepaliveInterval != codecInfo.iKeepaliveInterval ||
                 iCodecInfo.iKeepaliveData != codecInfo.iKeepaliveData ) &&
-                0 != codecInfo.iKeepaliveInterval;
+                0 != codecInfo.iKeepaliveInterval ||
+				iRtpKeepaliveUpdatePending;
             
             if ( updateNeeded )
                 {
-                TRACE_RTP_INTERFACE_PRINT( 
-                    "MMccRtpInterface::ConfigureL - Update" )
-                
-                iCodecInfo.iKeepalivePT = codecInfo.iKeepalivePT;
-                iCodecInfo.iKeepaliveInterval = codecInfo.iKeepaliveInterval;
-                iCodecInfo.iKeepaliveData = codecInfo.iKeepaliveData;
-                iRtpKeepalive->UpdateParamsL( *this, codecInfo );
+				if ( iRtpMediaClock )
+					{
+	                TRACE_RTP_INTERFACE_PRINT( 
+	                    "MMccRtpInterface::ConfigureL - Update" )
+	                
+	                iCodecInfo.iKeepalivePT = codecInfo.iKeepalivePT;
+	                iCodecInfo.iKeepaliveInterval = codecInfo.iKeepaliveInterval;
+	                iCodecInfo.iKeepaliveData = codecInfo.iKeepaliveData;
+	                __ASSERT_ALWAYS( NULL != iRtpMediaClock, User::Leave( KErrNotReady ) );
+	                iRtpKeepalive->UpdateParamsL( *this, codecInfo, *iRtpMediaClock );
+					
+					iRtpKeepaliveUpdatePending = EFalse;
+					}
+				else
+					{
+					iRtpKeepaliveUpdatePending = ETrue;
+					}
                 }
             }
         }
@@ -363,6 +380,62 @@
     }
         
 // -----------------------------------------------------------------------------
+// MMccRtpInterface::SendJitterEventToClient
+// -----------------------------------------------------------------------------
+// 
+void MMccRtpInterface::SendJitterEventToClient( MAsyncEventHandler* aEventHandler,
+				                              	TUid aEventOriginator,
+				                            	TMccInternalEventType aInternalEventType,
+				                            	TMccEventType aEventType,
+				                            	TUint32 aEndpointId,
+				                            	TInt aError, 
+				                            	TUint64 aJitterEstimate,
+				                           	 	TUint32 aPacketsReceived,
+				                            	TInt64 aPrevTransTime,
+				                            	TUint64 aTriggeredJitterLevel,
+												TInt aPacketLoss,
+												TInt aTriggeredPacketLoss )
+	{
+	
+	TRACE_RTP_SOURCE_PRINT( "MMccRtpInterface::SendJitterEventToClient" )
+    
+    if ( aEventHandler )
+        {
+        ClearMccEvent();
+        
+        iMccEvent.iEventCategory = KMccEventCategoryRtp;
+        iMccEvent.iStreamId = iMccStreamId;
+        iMccEvent.iEndpointId = aEndpointId;
+        iMccEvent.iEventType = aEventType;
+        iMccEvent.iErrorCode = aError;
+        
+        // Save some stack memory
+        {
+        TMccRtpEventDataExtended eventData;
+        eventData.iJitterEstimate = aJitterEstimate;
+        eventData.iPacketsReceived = aPacketsReceived;
+        eventData.iPrevTransTime = aPrevTransTime;
+        eventData.iTriggeredJitterLevel = aTriggeredJitterLevel;
+        eventData.iPacketLoss = aPacketLoss;
+        eventData.iTriggeredPacketLoss = aTriggeredPacketLoss;
+        
+        iMccEvent.iEventData.Copy( TMccRtpEventDataExtendedPackage( eventData ) );
+        }
+        
+        TMccInternalEvent internalEvent( aEventOriginator, 
+                                         aInternalEventType,
+                                         iMccEvent );
+        
+        aEventHandler->SendEventToClient( internalEvent );
+        }
+    else
+        {
+	    TRACE_RTP_INTERFACE_PRINT("MMccRtpInterface::SendInternalRtpEventToClient, \
+aEventHandler=NULL")
+        }  
+	}        
+        
+// -----------------------------------------------------------------------------
 // MMccRtpInterface::SendInternalRtpEventToClient
 // -----------------------------------------------------------------------------
 //   
--- a/multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/group/UT_MccRtpSourceSink.mmp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/group/UT_MccRtpSourceSink.mmp	Thu Aug 19 10:18:22 2010 +0300
@@ -53,6 +53,9 @@
 SOURCE              mmcccryptocontext.cpp
 SOURCE              mcctimermanager.cpp
 
+SOURCEPATH          ../../../../mmccsubcontroller/src
+SOURCE              mccrtpmediaclock.cpp
+
 SOURCEPATH          ../../../../tsrc/amrpayloadformatstub/src
 SOURCE              AmrPayloadFormatRead_STUB.cpp
 SOURCE              AmrPayloadFormatWrite_STUB.cpp
--- a/multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/inc/UT_CMccJitterCalculator.h	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/inc/UT_CMccJitterCalculator.h	Thu Aug 19 10:18:22 2010 +0300
@@ -58,7 +58,7 @@
 
 	public: 	// From observer interface
 	
-	    void SendJitterEvent( TMccRtpEventData aEvent, TInt aError );
+	    void SendJitterEvent( TMccRtpEventDataExtended aEvent, TInt aError );
 		
 	public:     // Helpers
 
@@ -73,12 +73,18 @@
          void UT_CMccJitterCalculator_JitterObservingL();
          
          void UT_CMccJitterCalculator_RtpPacketReceivedL();
+         
+         void UT_CMccJitterCalculator_CalculateFerL();
+         
+         void UT_CMccJitterCalculator_CountPacketLossPercentageL();
+         
+         void UT_CMccJitterCalculator_ResetCountersL();
         
         
     private:    // Data
     
         CMccJitterCalculator* iCalculator;
-        TMccRtpEventData iLastEvent;
+        TMccRtpEventDataExtended iLastEvent;
         TInt iLastError;
 
 		EUNIT_DECLARE_TEST_TABLE; 
--- a/multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/inc/UT_CMccRtpDataSink.h	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/inc/UT_CMccRtpDataSink.h	Thu Aug 19 10:18:22 2010 +0300
@@ -34,6 +34,7 @@
 class CMccRtpDataSink;
 class CMccRtpKeepaliveContainer;
 class TMccInternalEvent;
+class CMccRtpMediaClock;
 //  CLASS DEFINITION
 /**
  *
@@ -203,6 +204,7 @@
         CMccRtpKeepaliveContainer* iRtpKeepaliveMechanism;
         CSRTPSession* iSecSession;
         TUint iEventType;
+        CMccRtpMediaClock* iRtpMediaClock;
 		
     };
 
--- a/multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/inc/UT_CMccRtpDataSource.h	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/inc/UT_CMccRtpDataSource.h	Thu Aug 19 10:18:22 2010 +0300
@@ -36,6 +36,7 @@
 class CMccRtpDataSource;
 class CMccRtpKeepaliveContainer;
 class CMccTestEventHandler;
+class CMccRtpMediaClock;
 
 //  CLASS DEFINITION
 /**
@@ -186,7 +187,7 @@
         CMccRtpKeepaliveContainer* iRtpKeepaliveMechanism;
         CMccTestEventHandler* iEventHandler;
         CSRTPSession* iSecSession; 
-
+		CMccRtpMediaClock* iRtpMediaClock;
 		
     };
 
--- a/multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/inc/UT_CMccRtpInterface.h	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/inc/UT_CMccRtpInterface.h	Thu Aug 19 10:18:22 2010 +0300
@@ -34,6 +34,7 @@
 class CRtpAPI;
 class MMccRtpInterface;
 class CMccRtpKeepaliveContainer;
+class CMccRtpMediaClock;
 
 //  CLASS DEFINITION
 /**
@@ -97,6 +98,7 @@
         CRtpAPI* iRtpApi;
         MMccRtpInterface* iInterface;
         CMccRtpKeepaliveContainer* iRtpKeepaliveMechanism;
+        CMccRtpMediaClock* iRtpMediaClock;
     };
 
 #endif      //  __UT_CMccRTPINTERFACE_H__
--- a/multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/src/UT_CMccJitterCalculator.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/src/UT_CMccJitterCalculator.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -66,7 +66,7 @@
     }
 
 // Observer impl
-void UT_CMccJitterCalculator::SendJitterEvent( TMccRtpEventData aEvent, TInt aError )
+void UT_CMccJitterCalculator::SendJitterEvent( TMccRtpEventDataExtended aEvent, TInt aError )
     {
     iLastEvent = aEvent;
     iLastError = aError;
@@ -126,10 +126,15 @@
     // Not active
     iCalculator->JitterObserving();
     
+    iCalculator->iStartingSeqNum = 80;
+    iCalculator->iCurrentSeqNum = 100; 
+    iCalculator->iReceivedPacketCounter = 20; // 100-80=20, no packets lost
+    
     iCalculator->iPacketsReceived = 5;
     iCalculator->iJitterLevelFromClient = 10000;
     iCalculator->iCurJitter = 10000;
     iCalculator->iJitterObsOn = ETrue;
+    iCalculator->iFrameLossObsOn = ETrue;
     
     // Time based reporting   
     // 
@@ -140,66 +145,264 @@
     iCalculator->iReportInterval = 100000;
     iCalculator->JitterObserving();
     EUNIT_ASSERT_EQUALS( iLastEvent.iPacketsReceived, 0 );
+    EUNIT_ASSERT_EQUALS( iLastEvent.iPacketLoss, 0 );
     
     // Enough time elapsed but not over jitter level defined by client
     iCalculator->iReportInterval = 0;
     iCalculator->JitterObserving();
     EUNIT_ASSERT_EQUALS( iLastEvent.iPacketsReceived, 0 );
+    EUNIT_ASSERT_EQUALS( iLastEvent.iPacketLoss, 0 );
     
-    // Jitter level defined by client exceeded
+    // Jitter and packet loss level defined by client exceeded
+    iCalculator->iStartingSeqNum = 100;
+    iCalculator->iCurrentSeqNum = 125; 
+    iCalculator->iPrevFerValue = 93000; // 9%
+
+    iCalculator->iPrevExpectedPackets = 20;
+    iCalculator->iReceivedPacketCounter = 20; // 5 packets is lost. 
+
     iCalculator->iJitterLevelFromClient = 10;
+    User::After( 5000 );
     iCalculator->JitterObserving();
     EUNIT_ASSERT_EQUALS( iLastEvent.iPacketsReceived, 5 ); // just making sure that callback was called
+    EUNIT_ASSERT_EQUALS( iLastEvent.iPacketLoss, 19 );
     
     // Quality based reporting
     //
+    EUNIT_ASSERT_EQUALS( iCalculator->iReceivedPacketCounter, 20 ); // counter is not zeroed
+    
     iCalculator->iReportIntervalType = EMccQualityPacketBased;
+    iCalculator->iJitterObsOn = ETrue;
+    iCalculator->iFrameLossObsOn = ETrue;
     iLastEvent.iPacketsReceived = 0;
+    iLastEvent.iPacketLoss = 0;
     iCalculator->iReportInterval = 2;
-    iCalculator->iJitterObsOn = ETrue;
+    iCalculator->iPacketsReceived = 2;
+
+    iCalculator->iStartingSeqNum = 120;
+    iCalculator->iCurrentSeqNum = 121; 
+    iCalculator->iReceivedPacketCounter = 1; 
+    iCalculator->iCurJitter = 10000;
+    iCalculator->iJitterLevelFromClient = 10000;
+    
+    iCalculator->JitterObserving();
+    //Check that nothing was changed in iLastEvent:
+    EUNIT_ASSERT_EQUALS( iLastEvent.iPacketsReceived, 0 );
+    EUNIT_ASSERT_EQUALS( iLastEvent.iPacketLoss, 0 );
     
-    // Not the packet when calculation is done
-    iCalculator->iReceivedPacketCounter = 0;
+    // One packet more...
+    iCalculator->iPrevFerValue = 0; // 0%
+    iCalculator->iCurrentSeqNum++;
+    iCalculator->iReceivedPacketCounter++; 
     iCalculator->JitterObserving();
-    EUNIT_ASSERT_EQUALS( iCalculator->iReceivedPacketCounter, 1 );
+    //Check that nothing was changed in iLastEvent:
+    EUNIT_ASSERT_EQUALS( iLastEvent.iPacketsReceived, 0 );
+    EUNIT_ASSERT_EQUALS( iLastEvent.iPacketLoss, 0 );
     
-    // Now the interval is reached
+    //Do the packet loss, with reporting:
+    iCalculator->iStartingSeqNum = 122;
+    iCalculator->iCurrentSeqNum = 126; 
+    iCalculator->iPrevFerValue = 98000; // 9%
+    iCalculator->iPrevExpectedPackets = 1;
+    
+    iCalculator->iReceivedPacketCounter = 2; 
+    iCalculator->iCurJitter = 10000;
+    iCalculator->iJitterLevelFromClient = 10;
     iCalculator->JitterObserving();
-    EUNIT_ASSERT_EQUALS( iLastEvent.iPacketsReceived, 5 ); // just making sure that callback was called
-    EUNIT_ASSERT_EQUALS( iCalculator->iReceivedPacketCounter, 0 ); // counter is zeroed
+    //Check that values were changed in iLastEvent:
+    EUNIT_ASSERT_EQUALS( iLastEvent.iPacketsReceived, 2 );
+    EUNIT_ASSERT_EQUALS( iLastEvent.iPacketLoss, 20 );
     
     // Other reporting
     iCalculator->iReportIntervalType = 998;
     iLastEvent.iPacketsReceived = 0;
     iCalculator->iJitterObsOn = ETrue;
+    iCalculator->iFrameLossObsOn = ETrue;
     iCalculator->JitterObserving();
-    EUNIT_ASSERT_EQUALS( iLastEvent.iPacketsReceived, 5 ); // just making sure that callback was called
+    EUNIT_ASSERT_EQUALS( iLastEvent.iPacketsReceived, 2 ); // just making sure that callback was called
+    EUNIT_ASSERT_EQUALS( iLastError, KErrArgument ); 
     }
 
 void UT_CMccJitterCalculator::UT_CMccJitterCalculator_RtpPacketReceivedL()
     {
+    iCalculator->iReportIntervalType = EMccQualityPacketBased;
     // TBD: real assert for values
     
     const TInt KTestConversion = 8000;
+    TUint testSeqNum = 222;
+    iCalculator->iCurrentSeqNum = 0;
+    iCalculator->iStartingSeqNum = 0;
+    iCalculator->iReceivedPacketCounter = 0;
     
     // First packet
-    const TInt firstPacketTimestamp = 1000;
-    iCalculator->RtpPacketReceived( firstPacketTimestamp, EFalse );
+    const TInt PacketTimestamp1 = 1000;
+    iCalculator->RtpPacketReceived( PacketTimestamp1, EFalse, testSeqNum );
     EUNIT_ASSERT( iCalculator->iPrevPacketTransit != 0 );
+    EUNIT_ASSERT( iCalculator->iCurrentSeqNum == 222 );
+    EUNIT_ASSERT( iCalculator->iStartingSeqNum == 221 );
+    EUNIT_ASSERT( iCalculator->iReceivedPacketCounter == 1 );
     
+    testSeqNum++; //Increase seqnum for next packet. 
     // Second packet (fake that it is the one when reporting)
     iCalculator->iPacketsReceived = 15; // ( KJitterReportInterval - 1 )
-    const TInt secondPacketTimestamp = 3000;
-    iCalculator->RtpPacketReceived( secondPacketTimestamp, EFalse );
+    const TInt PacketTimestamp2 = 3000;
+    iCalculator->RtpPacketReceived( PacketTimestamp2, EFalse, testSeqNum );
     EUNIT_ASSERT( iCalculator->iCurJitter != 0 );
     EUNIT_ASSERT_EQUALS( (TInt)iLastEvent.iPacketsReceived, 16 ); // just making sure that callback was called
+    EUNIT_ASSERT( iCalculator->iCurrentSeqNum == 223 );
+    EUNIT_ASSERT( iCalculator->iStartingSeqNum == 221 );
+    EUNIT_ASSERT( iCalculator->iReceivedPacketCounter == 2 );
+    
+    
+    iCalculator->iReportIntervalType = EMccQualityTimeBased;
+    iCalculator->iFrameLossObsOn = EFalse;
+    testSeqNum++; //Increase seqnum for next packet. 
+
+    const TInt packetTimestamp3 = 4000;
+    iCalculator->RtpPacketReceived( packetTimestamp3, EFalse, testSeqNum );
+    EUNIT_ASSERT( iCalculator->iCurJitter != 0 );
+    EUNIT_ASSERT_EQUALS( (TInt)iLastEvent.iPacketsReceived, 16 ); // just making sure that callback wasn't called
+    EUNIT_ASSERT( iCalculator->iCurrentSeqNum == 223 );
+    EUNIT_ASSERT( iCalculator->iStartingSeqNum == 221 );
+    EUNIT_ASSERT( iCalculator->iReceivedPacketCounter == 2 );
+    
+    // Sequence number start from 0
+    iCalculator->iReportIntervalType = EMccQualityPacketBased;
+    iCalculator->iFrameLossObsOn = ETrue;
+    testSeqNum = 0;
+    const TInt packetTimestamp4 = 5000;
+    iCalculator->RtpPacketReceived( packetTimestamp4, EFalse, testSeqNum );
+    EUNIT_ASSERT( iCalculator->iCurJitter != 0 );
+    EUNIT_ASSERT_EQUALS( (TInt)iLastEvent.iPacketsReceived, 16 ); // just making sure that callback wasn't called
+    EUNIT_ASSERT_EQUALS( iCalculator->iCurrentSeqNum, 0);
+    EUNIT_ASSERT( iCalculator->iStartingSeqNum == 0 );
+    EUNIT_ASSERT( iCalculator->iReceivedPacketCounter == 3 );
+    
+    // Sequence number start from 1
+    testSeqNum = 1;
+    const TInt packetTimestamp5 = 6000;
+    iCalculator->RtpPacketReceived( packetTimestamp5, EFalse, testSeqNum );
+    EUNIT_ASSERT( iCalculator->iCurJitter != 0 );
+    EUNIT_ASSERT_EQUALS( (TInt)iLastEvent.iPacketsReceived, 16 ); // just making sure that callback wasn't called
+    EUNIT_ASSERT_EQUALS( iCalculator->iCurrentSeqNum, 1);
+    EUNIT_ASSERT( iCalculator->iStartingSeqNum == 0 );
+    EUNIT_ASSERT( iCalculator->iReceivedPacketCounter == 4 );
+    
     }
     
+
+void UT_CMccJitterCalculator::UT_CMccJitterCalculator_CalculateFerL()
+    {
+    TUint32 returnValue( 0 );
+    
+    // packet  lost
+    TUint32 prevValue( 0 );
+    TBool valueToadd( ETrue );
+    TBool flagToAdd( ETrue );
+    returnValue = iCalculator->CalculateFer( prevValue, valueToadd, flagToAdd );
+    EUNIT_ASSERT_EQUALS( returnValue, 2000 );
+    
+    // packet  lost
+    // returnValue == 2000
+    returnValue = iCalculator->CalculateFer( returnValue, valueToadd, flagToAdd );
+    EUNIT_ASSERT_EQUALS( returnValue, 3992 );
+    
+    // no packet lost - late packet - remove FER
+    // decrease fer
+    flagToAdd = EFalse;
+    // returnValue == 3996
+    returnValue = iCalculator->CalculateFer( returnValue, valueToadd, flagToAdd );
+    
+    EUNIT_ASSERT_EQUALS( returnValue, 2008 );
+    
+    // no packet lost - late packet - remove FER
+    // decrease fer
+    flagToAdd = EFalse;
+    // returnValue == 5
+    returnValue = 5;
+    returnValue = iCalculator->CalculateFer( returnValue, valueToadd, flagToAdd );
+    
+    EUNIT_ASSERT_EQUALS( returnValue, 0);
+    }
+
+void UT_CMccJitterCalculator::UT_CMccJitterCalculator_CountPacketLossPercentageL()
+    {
+    TInt percentage( 0 );
+    
+    iCalculator->iHomeTime.HomeTime();
+    
+    // Not active
+    iCalculator->JitterObserving();
+    
+    iCalculator->iPrevFerValue = 0;
+    iCalculator->iStartingSeqNum = 80;
+    iCalculator->iCurrentSeqNum = 100;
+    
+    // no packets lost
+    iCalculator->iPrevExpectedPackets = 20;
+    iCalculator->iReceivedPacketCounter = 20;
+
+    iCalculator->CountPacketLossPercentage();
+    
+    EUNIT_ASSERT_EQUALS( iCalculator->iPrevFerValue, 0 );
+    EUNIT_ASSERT_EQUALS( iCalculator->iPrevExpectedPackets, 20 );
+    EUNIT_ASSERT_EQUALS( iCalculator->iPrevPacketsReceived, 20 );
+    
+    
+    // no packets lost, inorder
+    iCalculator->iCurrentSeqNum = 102;  
+    iCalculator->iPrevExpectedPackets = 22;
+
+    iCalculator->CountPacketLossPercentage();
+    
+    EUNIT_ASSERT_EQUALS( iCalculator->iPrevFerValue, 0 );
+    EUNIT_ASSERT_EQUALS( iCalculator->iPrevExpectedPackets, 22 );
+    EUNIT_ASSERT_EQUALS( iCalculator->iPrevPacketsReceived, 20 );
+    
+	
+    // packet  lost - add FER by number of packets lost.
+    // 5 packets lost
+    iCalculator->iPrevFerValue = 0;
+    iCalculator->iStartingSeqNum = 80;
+    iCalculator->iCurrentSeqNum = 105;
+
+    iCalculator->iPrevExpectedPackets = 20;
+    iCalculator->iReceivedPacketCounter = 20;
+
+    percentage = iCalculator->CountPacketLossPercentage();
+    
+    EUNIT_ASSERT_EQUALS( percentage, 1 );
+    EUNIT_ASSERT_EQUALS( iCalculator->iPrevFerValue, 7952 );
+    EUNIT_ASSERT_EQUALS( iCalculator->iPrevExpectedPackets, 25 );
+    EUNIT_ASSERT_EQUALS( iCalculator->iPrevPacketsReceived, 20 );
+    }
+
+void UT_CMccJitterCalculator::UT_CMccJitterCalculator_ResetCountersL()
+    {
+    
+    iCalculator->iPacketsReceived = 20;
+    iCalculator->iCurJitter = 200;
+    iCalculator->iPrevPacketTransit = 100;
+    iCalculator->iCurrentSeqNum = 25;
+    iCalculator->iStartingSeqNum = 2;
+    iCalculator->iReceivedPacketCounter = 30;
+
+    iCalculator->ResetCounters();
+    
+    EUNIT_ASSERT_EQUALS( iCalculator->iPacketsReceived, 0 );
+    EUNIT_ASSERT_EQUALS( iCalculator->iCurJitter, 0 );
+    EUNIT_ASSERT_EQUALS( iCalculator->iPrevPacketTransit, 0 );
+    EUNIT_ASSERT_EQUALS( iCalculator->iCurrentSeqNum, 0 );
+    EUNIT_ASSERT_EQUALS( iCalculator->iStartingSeqNum, 0 );
+    EUNIT_ASSERT_EQUALS( iCalculator->iReceivedPacketCounter, 0 );
+    }
+
+
 //  TEST TABLE
 
 EUNIT_BEGIN_TEST_TABLE( 
     UT_CMccJitterCalculator,
-    "Add test suite description here.",
+    "CMccJitterCalculator",
     "UNIT" )
     
 EUNIT_TEST(
@@ -223,6 +426,29 @@
     "FUNCTIONALITY",
     SetupL, UT_CMccJitterCalculator_RtpPacketReceivedL, Teardown)
     
+
+EUNIT_TEST(
+    "CalculateFer - test ",
+    "CMccJitterCalculator",
+    "CalculateFer",
+    "FUNCTIONALITY",
+    SetupL, UT_CMccJitterCalculator_CalculateFerL, Teardown)
+
+EUNIT_TEST(
+    "CountPacketLossPercentage - test ",
+    "CMccJitterCalculator",
+    "CountPacketLossPercentage",
+    "FUNCTIONALITY",
+    SetupL, UT_CMccJitterCalculator_CountPacketLossPercentageL, Teardown)
+    
+EUNIT_TEST(
+    "ResetCounters - test ",
+    "CMccJitterCalculator",
+    "ResetCounters",
+    "FUNCTIONALITY",
+    SetupL, UT_CMccJitterCalculator_ResetCountersL, Teardown)
+    
+    
 EUNIT_END_TEST_TABLE
 
 //  END OF FILE
--- a/multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/src/UT_CMccRtpDataSink.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/src/UT_CMccRtpDataSink.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -42,6 +42,7 @@
 #include <srtpmastersalt.h>
 #include <srtpstreamout.h>
 #include "mccunittestmacros.h"
+#include "mccrtpmediaclock.h"
 
 
 #define MCCEVENTDATAPCKG_TO_RTCPEVENTDATAPCKG( event )\
@@ -115,6 +116,7 @@
                                          *iRtpApi, 
                                          rtpSessionId ); 
                                          
+    iRtpMediaClock = CMccRtpMediaClock::NewL();                                     
     } 
 
 void UT_CMccRtpDataSink::Teardown()
@@ -136,6 +138,12 @@
         delete iRtpApi;
         iRtpApi = NULL;
         }
+        
+    if ( iRtpMediaClock )
+        {
+        delete iRtpMediaClock;
+        iRtpMediaClock = NULL;
+        }
     }
 
 // HELPERS
@@ -156,7 +164,7 @@
     TMccCodecInfo cInfo;
     TMccCodecInfoBuffer cInfoBuf( cInfo );
     
-    MCC_EUNIT_ASSERT_NO_LEAVE( iSink->ConfigureL( cInfoBuf ) );
+    MCC_EUNIT_ASSERT_NO_LEAVE( iSink->ConfigureL( cInfoBuf, iRtpMediaClock ) );
     }
 
 
@@ -218,7 +226,7 @@
     
     TMccCodecInfo cInfo;
     TMccCodecInfoBuffer cInfoBuf( cInfo );
-    MCC_EUNIT_ASSERT_NO_LEAVE( iSink->ConfigureL( cInfoBuf ) );
+    MCC_EUNIT_ASSERT_NO_LEAVE( iSink->ConfigureL( cInfoBuf, iRtpMediaClock ) );
     MCC_EUNIT_ASSERT_EQUALS( iSink->SinkThreadLogon( *this ), KErrNone );
     iSink->SetCurrentUser( this );
     EUNIT_ASSERT_NO_LEAVE( iSink->SinkPrimeL() );
@@ -289,7 +297,7 @@
     MCC_EUNIT_ASSERT_EQUALS( iSink->SinkThreadLogon( *this ), KErrNone );
     iSink->SetCurrentUser( this );
     EUNIT_ASSERT_NO_LEAVE( iSink->SetSessionParamsL( params ) );
-    MCC_EUNIT_ASSERT_NO_LEAVE( iSink->ConfigureL( cInfoBuf ) );
+    MCC_EUNIT_ASSERT_NO_LEAVE( iSink->ConfigureL( cInfoBuf, iRtpMediaClock ) );
     EUNIT_ASSERT_NO_LEAVE( iSink->SinkPrimeL() );
     iSink->SinkThreadLogoff();
     }
@@ -366,7 +374,7 @@
     TMccCodecInfo cInfo;
     TMccCodecInfoBuffer cInfoBuf( cInfo );
     
-    MCC_EUNIT_ASSERT_NO_LEAVE( iSink->ConfigureL( cInfoBuf ) );
+    MCC_EUNIT_ASSERT_NO_LEAVE( iSink->ConfigureL( cInfoBuf, iRtpMediaClock ) );
     EUNIT_ASSERT_NO_LEAVE( iSink->SinkPrimeL() );
     EUNIT_ASSERT( iRtpKeepaliveMechanism->iStopped == EFalse );
   
@@ -615,7 +623,7 @@
     TMccCodecInfo cInfo;
     TMccCodecInfoBuffer cInfoBuf( cInfo );
     
-    MCC_EUNIT_ASSERT_NO_LEAVE( iSink->ConfigureL( cInfoBuf ) );
+    MCC_EUNIT_ASSERT_NO_LEAVE( iSink->ConfigureL( cInfoBuf, iRtpMediaClock ) );
     EUNIT_ASSERT_NO_LEAVE( iSink->SinkPrimeL() ); 
 
     // Create a comfort noise stream
@@ -638,12 +646,12 @@
     TMccCodecInfo cInfo;
     TMccCodecInfoBuffer cInfoBuf( cInfo );
     
-    MCC_EUNIT_ASSERT_NO_LEAVE( iSink->ConfigureL( cInfoBuf ) );
+    MCC_EUNIT_ASSERT_NO_LEAVE( iSink->ConfigureL( cInfoBuf, iRtpMediaClock ) );
 
     // This should leave because the string is too short
     TBuf8<5> dummy;
     dummy.Format( _L8( "foo42" ) );
-    EUNIT_ASSERT_LEAVE( iSink->ConfigureL( dummy ) );
+    EUNIT_ASSERT_LEAVE( iSink->ConfigureL( dummy, iRtpMediaClock ) );
 
     // Get a new sink
     //Teardown();
@@ -690,7 +698,7 @@
     cInfo2.iAlgoUsed = EGenRedUsed;
     TMccCodecInfoBuffer cInfoBuf2( cInfo2 );
 
-    EUNIT_ASSERT_NO_LEAVE( iSink->ConfigureL( cInfoBuf2 ) );
+    EUNIT_ASSERT_NO_LEAVE( iSink->ConfigureL( cInfoBuf2, iRtpMediaClock ) );
     }
 
 void UT_CMccRtpDataSink::UT_CMccRtpDataSink_RemoveStreamLL()
@@ -741,7 +749,7 @@
     TMccCodecInfo cInfo;
     TMccCodecInfoBuffer cInfoBuf( cInfo );
     
-    MCC_EUNIT_ASSERT_NO_LEAVE( iSink->ConfigureL( cInfoBuf ) );
+    MCC_EUNIT_ASSERT_NO_LEAVE( iSink->ConfigureL( cInfoBuf, iRtpMediaClock ) );
 
     // Wrong state
     EUNIT_ASSERT_LEAVE( iSink->SinkPlayL() );
@@ -770,7 +778,7 @@
     TMccCodecInfo cInfo;
     TMccCodecInfoBuffer cInfoBuf( cInfo );
     
-    MCC_EUNIT_ASSERT_NO_LEAVE( iSink->ConfigureL( cInfoBuf ) );
+    MCC_EUNIT_ASSERT_NO_LEAVE( iSink->ConfigureL( cInfoBuf, iRtpMediaClock ) );
 
     // Wrong state
     EUNIT_ASSERT_LEAVE( iSink->SinkPauseL() );
@@ -797,7 +805,7 @@
     TMccCodecInfo cInfo;
     TMccCodecInfoBuffer cInfoBuf( cInfo );
     
-    MCC_EUNIT_ASSERT_NO_LEAVE( iSink->ConfigureL( cInfoBuf ) );
+    MCC_EUNIT_ASSERT_NO_LEAVE( iSink->ConfigureL( cInfoBuf, iRtpMediaClock ) );
     iSink->SinkPrimeL();
     iSink->SinkPlayL();
 
--- a/multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/src/UT_CMccRtpDataSource.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/src/UT_CMccRtpDataSource.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -36,6 +36,7 @@
 #include <srtpstreamin.h>
 #include "UT_CMccRtpInterface.h"
 #include "mccunittestmacros.h"
+#include "mccrtpmediaclock.h"
 
 // CONSTANTS
 _LIT8(KRFC3711_TestMasterKey128bits,    "E1F97A0D3E018BE0D64FA32C06DE4139");
@@ -103,7 +104,8 @@
         CMccRtpKeepaliveContainer::NewL( *eventHandler, 
                                          *iRtpApi, 
                                          rtpSessionId ); 
-                                         
+      
+    iRtpMediaClock = CMccRtpMediaClock::NewL();                                    
     } 
 
 void UT_CMccRtpDataSource::Teardown()
@@ -128,6 +130,12 @@
         }
         
     delete iEventHandler;
+    
+    if ( iRtpMediaClock )
+        {
+        delete iRtpMediaClock;
+        iRtpMediaClock = NULL;
+        }
     }
 
 
@@ -165,7 +173,7 @@
     cInfo.iBitrate = 8000;
     cInfo.iPayloadType = KDefaultAmrNbPT;
     TMccCodecInfoBuffer cInfoBuf( cInfo );
-    EUNIT_ASSERT_NO_LEAVE( iSource->ConfigureL( cInfoBuf ) );
+    EUNIT_ASSERT_NO_LEAVE( iSource->ConfigureL( cInfoBuf, iRtpMediaClock ) );
     }
     
 // TEST FUNCTIONS
@@ -209,7 +217,7 @@
     cInfo.iPayloadType = KDefaultAmrNbPT;
     TMccCodecInfoBuffer cInfoBuf( cInfo );
     
-    EUNIT_ASSERT_NO_LEAVE( iSource->ConfigureL( cInfoBuf ) );
+    EUNIT_ASSERT_NO_LEAVE( iSource->ConfigureL( cInfoBuf, iRtpMediaClock ) );
     //iSource->NegotiateSourceL( *iEventHandler );
     EUNIT_ASSERT_NO_LEAVE( iSource->NegotiateSourceL( *amrPfRead ) );
     EUNIT_ASSERT_NO_LEAVE( iSource->SourcePrimeL() );
@@ -375,7 +383,7 @@
     cInfo.iPayloadType = KDefaultAmrNbPT;
     TMccCodecInfoBuffer cInfoBuf( cInfo );
     
-    EUNIT_ASSERT_NO_LEAVE( iSource->ConfigureL( cInfoBuf ) );
+    EUNIT_ASSERT_NO_LEAVE( iSource->ConfigureL( cInfoBuf, iRtpMediaClock ) );
 
     MCC_EUNIT_ASSERT_EQUALS( iSource->SourceThreadLogon( *iEventHandler ), KErrNone );
     EUNIT_ASSERT_NO_LEAVE( iSource->SourcePrimeL() );
@@ -400,7 +408,7 @@
     cInfo.iPayloadType = KDefaultAmrNbPT;
     TMccCodecInfoBuffer cInfoBuf( cInfo );
     
-    EUNIT_ASSERT_NO_LEAVE( iSource->ConfigureL( cInfoBuf ) );
+    EUNIT_ASSERT_NO_LEAVE( iSource->ConfigureL( cInfoBuf, iRtpMediaClock ) );
 
     MCC_EUNIT_ASSERT_EQUALS( iSource->SourceThreadLogon( *iEventHandler ), KErrNone );
     EUNIT_ASSERT_NO_LEAVE( iSource->SourcePrimeL() );
@@ -521,7 +529,7 @@
     cInfo.iPayloadType = KDefaultAmrNbPT;
     TMccCodecInfoBuffer cInfoBuf( cInfo );
     
-    EUNIT_ASSERT_NO_LEAVE( iSource->ConfigureL( cInfoBuf ) );
+    EUNIT_ASSERT_NO_LEAVE( iSource->ConfigureL( cInfoBuf, iRtpMediaClock ) );
     MCC_EUNIT_ASSERT_EQUALS( iSource->SourceThreadLogon( *iEventHandler ), KErrNone );
     EUNIT_ASSERT_NO_LEAVE( iSource->SourcePrimeL() );
 
@@ -607,7 +615,7 @@
     cInfo.iFourCC = TFourCC( KMccFourCCIdG711 );
     cInfo.iEnableDTX = ETrue;
     TMccCodecInfoBuffer cInfoBuf( cInfo );
-    EUNIT_ASSERT_NO_LEAVE( iSource->ConfigureL( cInfoBuf ) );
+    EUNIT_ASSERT_NO_LEAVE( iSource->ConfigureL( cInfoBuf, iRtpMediaClock ) );
 
     header.iPayloadType = KPcmuPayloadType;
 
@@ -639,7 +647,7 @@
     TMccCodecInfo cInfo;
     TMccCodecInfoBuffer cInfoBuf( cInfo );
     
-    EUNIT_ASSERT_NO_LEAVE( iSource->ConfigureL( cInfoBuf ) );
+    EUNIT_ASSERT_NO_LEAVE( iSource->ConfigureL( cInfoBuf, iRtpMediaClock ) );
 
     // Get a new Source
     Teardown();
@@ -649,7 +657,7 @@
     TBuf8<5> dummy;
     dummy.Format( _L8( "foo42" ) );
     EUNIT_ASSERT_NO_LEAVE( iSource->SetSessionParamsL( params ) );
-    EUNIT_ASSERT_LEAVE( iSource->ConfigureL( dummy ) );
+    EUNIT_ASSERT_LEAVE( iSource->ConfigureL( dummy, iRtpMediaClock ) );
 
     // Get a new Source
     Teardown();
@@ -670,7 +678,7 @@
     cInfo2.iAlgoUsed = EGenRedUsed;
     TMccCodecInfoBuffer cInfoBuf2( cInfo2 );
 
-    EUNIT_ASSERT_NO_LEAVE( iSource->ConfigureL( cInfoBuf2 ) );
+    EUNIT_ASSERT_NO_LEAVE( iSource->ConfigureL( cInfoBuf2, iRtpMediaClock ) );
     }
 
 void UT_CMccRtpDataSource::UT_CMccRtpDataSource_DoCreateSrtpStreamL()
@@ -701,7 +709,7 @@
     EUNIT_ASSERT_EQUALS( iEventHandler->iLastEvent.iEventType, KMccStreamResumed );
     
     // Jitter event when no event handler
-    TMccRtpEventData eventData;
+    TMccRtpEventDataExtended eventData;
     iSource->SendJitterEvent( eventData, KErrNone );
     EUNIT_ASSERT_EQUALS( iEventHandler->iLastEvent.iEventType, KMccStreamResumed );
 
@@ -779,6 +787,19 @@
     iSource->SendSecureRtpEventToClient( 
         iEventHandler, KMccRtpSourceUid, EMccInternalEventNone, KMccStreamPaused, 0 );
     EUNIT_ASSERT_EQUALS( iEventHandler->iLastEvent.iEventType, KMccStreamPaused );
+    
+    // SendJitterEventToClient()
+    iSource->SendJitterEventToClient( iEventHandler, KMccRtpSourceUid, 
+    	EMccInternalEventNone, KMccEventNone, 0, 0, 1,2,3,4,5,6 );
+    EUNIT_ASSERT_EQUALS( iEventHandler->iLastEvent.iEventType, KMccEventNone );
+    const TMccRtpEventDataExtended& rtpEvent = 
+    	(*reinterpret_cast<const TMccRtpEventDataExtendedPackage*>( &iEventHandler->iLastEvent.iEventData ))();
+    EUNIT_ASSERT_EQUALS( rtpEvent.iJitterEstimate, 1 );
+    EUNIT_ASSERT_EQUALS( rtpEvent.iPacketsReceived, 2 );
+    EUNIT_ASSERT_EQUALS( rtpEvent.iPrevTransTime, 3 );
+    EUNIT_ASSERT_EQUALS( rtpEvent.iTriggeredJitterLevel, 4 );
+    EUNIT_ASSERT_EQUALS( rtpEvent.iPacketLoss, 5 );
+    EUNIT_ASSERT_EQUALS( rtpEvent.iTriggeredPacketLoss, 6 );
     }
     
 void UT_CMccRtpDataSource::UT_CMccRtpDataSource_DoStandbyDecisionL()
--- a/multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/src/UT_CMccRtpInterface.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/src/UT_CMccRtpInterface.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -29,6 +29,7 @@
 #include "mccrtpinterface.h"
 #include "mccrtpdatasink.h"
 #include "mccrtpkeepalivecontainer.h"
+#include "mccrtpmediaclock.h"
 
 // CONSTRUCTION
 UT_CMccRtpInterface* UT_CMccRtpInterface::NewL()
@@ -93,6 +94,8 @@
         CMccRtpKeepaliveContainer::NewL( *eventHandler, 
                                          *iRtpApi, 
                                          iRtpSessionId ); 
+    
+    iRtpMediaClock = CMccRtpMediaClock::NewL();                                      
     } 
 
 void UT_CMccRtpInterface::Teardown(  )
@@ -105,13 +108,19 @@
     
     delete iRtpApi;
     iRtpApi = NULL;
+    
+    if ( iRtpMediaClock )
+        {
+        delete iRtpMediaClock;
+        iRtpMediaClock = NULL;
+        }
     }
 
 void UT_CMccRtpInterface::UT_CMccRtpInterface_ConfigureLL()
     {
     TMccCodecInfo cInfo;
     EUNIT_ASSERT_SPECIFIC_LEAVE( 
-        iInterface->ConfigureL( TMccCodecInfoBuffer( cInfo ) ), KErrNotReady );
+        iInterface->ConfigureL( TMccCodecInfoBuffer( cInfo ), iRtpMediaClock ), KErrNotReady );
     
     TMccRtpSessionParams params;
     params.iRtpAPI = iRtpApi;
@@ -121,23 +130,23 @@
     iInterface->SetSessionParamsL( params );
     TBuf8<1> kaData;
     EUNIT_ASSERT_SPECIFIC_LEAVE( 
-        iInterface->ConfigureL( kaData ), KErrArgument );
+        iInterface->ConfigureL( kaData, iRtpMediaClock ), KErrArgument );
     
     cInfo.iKeepalivePT = 13;
     cInfo.iKeepaliveInterval = 0;
     cInfo.iKeepaliveData = kaData;
-    iInterface->ConfigureL( TMccCodecInfoBuffer( cInfo ) );
+    iInterface->ConfigureL( TMccCodecInfoBuffer( cInfo ), iRtpMediaClock );
     EUNIT_ASSERT( TMccCodecInfo::Compare( cInfo, iInterface->iCodecInfo ) );
     
     TMccCodecInfo backup = iInterface->iCodecInfo;
     cInfo.iKeepaliveInterval = 28;
-    iInterface->ConfigureL( TMccCodecInfoBuffer( cInfo ) );
+    iInterface->ConfigureL( TMccCodecInfoBuffer( cInfo ), iRtpMediaClock );
     EUNIT_ASSERT( 
         cInfo.iKeepaliveInterval == iInterface->iCodecInfo.iKeepaliveInterval );
     
     backup = iInterface->iCodecInfo;
     cInfo.iKeepaliveInterval = 0;
-    iInterface->ConfigureL( TMccCodecInfoBuffer( cInfo ) );
+    iInterface->ConfigureL( TMccCodecInfoBuffer( cInfo ), iRtpMediaClock );
     EUNIT_ASSERT( TMccCodecInfo::Compare( backup, iInterface->iCodecInfo ) );
     }
 
--- a/multimediacommscontroller/mmccshared/inc/mccinternalcodecs.h	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccshared/inc/mccinternalcodecs.h	Thu Aug 19 10:18:22 2010 +0300
@@ -563,8 +563,8 @@
         // MMF Priority settings
         TMMFPrioritySettings iPriority;       
         
-        // Rtp keepalive interval (secs)
-        TUint8 iKeepaliveInterval;
+        // Rtp keepalive interval (microsecs)
+        TUint32 iKeepaliveInterval;
     
         // Rtp keepalive payload type
         TUint8 iKeepalivePT;
--- a/multimediacommscontroller/mmccsubcontroller/group/subcontroller.mmp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccsubcontroller/group/subcontroller.mmp	Thu Aug 19 10:18:22 2010 +0300
@@ -82,15 +82,15 @@
 LIBRARY     insock.lib
 LIBRARY     3gpmp4lib.lib
 LIBRARY     efsrv.lib
-LIBRARY     speechencoderconfig.lib
-LIBRARY	    errorconcealmentintfc.lib
-LIBRARY     audiooutputrouting.lib
-LIBRARY     g711decoderintfc.lib
-LIBRARY     g711encoderintfc.lib
-LIBRARY     g729decoderintfc.lib
-LIBRARY     g729encoderintfc.lib
-LIBRARY     ilbcdecoderintfc.lib
-LIBRARY     ilbcencoderintfc.lib
+LIBRARY     SpeechEncoderConfig.lib
+LIBRARY	    ErrorConcealmentIntfc.lib
+LIBRARY     AudioOutputRouting.lib
+LIBRARY     G711DecoderIntfc.lib
+LIBRARY     G711EncoderIntfc.lib
+LIBRARY     G729DecoderIntfc.lib
+LIBRARY     G729EncoderIntfc.lib
+LIBRARY     IlbcDecoderIntfc.lib
+LIBRARY     IlbcEncoderIntfc.lib
 LIBRARY     srtp.lib
 // Other MCC libraries
 LIBRARY     mmccjitterbuffer.lib
--- a/multimediacommscontroller/mmccsubcontroller/inc/mccrtpkeepalive.h	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccsubcontroller/inc/mccrtpkeepalive.h	Thu Aug 19 10:18:22 2010 +0300
@@ -67,7 +67,7 @@
                                        CRtpAPI& aRtpAPI,
                                        TRtpId aRtpSessionId,
                                        TUint8 aKeepalivePayloadType,
-                                       TUint8 aKeepaliveInterval,
+                                       TUint32 aKeepaliveInterval,
                                        const TDesC8& aKeepaliveData,
                                        TBool aRemoteAddressSet );
         
@@ -139,8 +139,9 @@
          * @return void
          */
         void UpdateParamsL( TUint8 aKeepalivePT,
-                            TUint8 aKeepaliveInterval,
-                            const TDesC8& aKeepaliveData );
+                            TUint32 aKeepaliveInterval,
+                            const TDesC8& aKeepaliveData, 
+							CMccRtpMediaClock* aRtpMediaClock );
         
     protected:  // New functions
     
@@ -180,7 +181,7 @@
         * By default Symbian 2nd phase constructor is private.
         */
         void ConstructL( TUint8 aKeepalivePayloadType,
-                         TUint8 aKeepaliveInterval,
+                         TUint32 aKeepaliveInterval,
                          const TDesC8& aKeepaliveData );       
 
     public:     // Data
--- a/multimediacommscontroller/mmccsubcontroller/inc/mccrtpkeepalivecontainer.h	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccsubcontroller/inc/mccrtpkeepalivecontainer.h	Thu Aug 19 10:18:22 2010 +0300
@@ -87,10 +87,12 @@
          * @since Series 60 3.2
          * @param aUser rtp interface instance
          * @param aCodecInfo codec info instance
+         * @param aRtpMediaClock rtp media clock instance
          * @return void
          */
         virtual void UpdateParamsL( MMccRtpInterface& aUser, 
-                                    const TMccCodecInfo& aCodecInfo ) = 0;
+                                    const TMccCodecInfo& aCodecInfo,
+                                    CMccRtpMediaClock& aRtpMediaClock ) = 0;
     };
 
 NONSHARABLE_CLASS( CMccRtpKeepaliveContainer ) : public CBase, 
@@ -149,10 +151,12 @@
          * @since Series 60 3.2
          * @param aUser rtp interface instance
          * @param aConfig Configuration
+         * @param aRtpMediaClock rtp media clock instance
          * @return void
          */
         virtual void UpdateParamsL( MMccRtpInterface& aUser, 
-                                    const TMccCodecInfo& aConfig );                            
+                                    const TMccCodecInfo& aConfig,
+                                    CMccRtpMediaClock& aRtpMediaClock );                            
     
     public: // Functions
        
--- a/multimediacommscontroller/mmccsubcontroller/inc/mccsymdlstream.h	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccsubcontroller/inc/mccsymdlstream.h	Thu Aug 19 10:18:22 2010 +0300
@@ -50,7 +50,8 @@
                 MAsyncEventHandler* aEventhandler,  
                 MMccResources* aMccResources, 
                 CMccRtpManager* aManager,
-                TInt aStreamType );
+                TInt aStreamType,
+                CMccRtpMediaClock& aClock );
         
         /**
         * Destructor.
@@ -200,7 +201,8 @@
                          MAsyncEventHandler* aEventhandler, 
                          MMccResources* aMccResources, 
                          CMccRtpManager* aManager, 
-                         TInt aStreamType );
+                         TInt aStreamType,
+                         CMccRtpMediaClock& aClock );
         
         /**
         * 2nd phase constructor
--- a/multimediacommscontroller/mmccsubcontroller/inc/mccsymsimpledlstream.h	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccsubcontroller/inc/mccsymsimpledlstream.h	Thu Aug 19 10:18:22 2010 +0300
@@ -49,7 +49,8 @@
                                              MMccResources* aMccResources,
                                              CMccRtpManager* aManager, 
                                              TFourCC aFourCC, 
-                                             TInt aStreamType );
+                                             TInt aStreamType,
+                                             CMccRtpMediaClock& aClock );
         
         /**
         * Destructor.
@@ -186,7 +187,8 @@
                                MMccResources* aMccResources,
                                CMccRtpManager* aManager, 
                                TFourCC aFourCC, 
-                               TInt aStreamType );
+                               TInt aStreamType,
+                               CMccRtpMediaClock& aClock );
         
         /**
         * 2nd phase constructor
--- a/multimediacommscontroller/mmccsubcontroller/src/mccdtmfulstream.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccsubcontroller/src/mccdtmfulstream.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -187,9 +187,6 @@
                 
         CreatePayloadFormatEncoderL();
         
-        CMccRtpDataSink* dataSink = static_cast<CMccRtpDataSink*>( iDatasink );        
-        dataSink->SetMediaClock( *iRtpMediaClock ); 
-        
         SetCodecState( EStateCodecNegotiated );        	
         }
     else if ( CurrentCodecState() == EStateCodecNegotiated )
--- a/multimediacommscontroller/mmccsubcontroller/src/mccrtpkeepalive.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccsubcontroller/src/mccrtpkeepalive.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -62,7 +62,7 @@
     CRtpAPI& aRtpAPI,
     TRtpId aRtpSessionId,
     TUint8 aKeepalivePayloadType,
-    TUint8 aKeepaliveInterval,
+    TUint32 aKeepaliveInterval,
     const TDesC8& aKeepaliveData,
     TBool aRemoteAddressSet )
     {
@@ -220,7 +220,7 @@
 // ---------------------------------------------------------------------------
 //   
 void CMccRtpKeepalive::UpdateParamsL( TUint8 aKeepalivePT, 
-    TUint8 aKeepaliveInterval, const TDesC8& aKeepaliveData )
+    TUint32 aKeepaliveInterval, const TDesC8& aKeepaliveData, CMccRtpMediaClock* aRtpMediaClock )
     {
     __SUBCONTROLLER_INT1( 
         "CMccRtpKeepalive::UpdateParamsL(), PT:", aKeepalivePT )
@@ -236,8 +236,8 @@
     delete iKeepaliveData;
     iKeepaliveData = tmp;    
     
-    const TUint KMccSecsToMicroSecs = 1000000;
-    iKeepaliveInterval = aKeepaliveInterval * KMccSecsToMicroSecs;
+    iKeepaliveInterval = aKeepaliveInterval;
+	iRtpMediaClock = aRtpMediaClock;
     }
 
 // ---------------------------------------------------------------------------
@@ -412,7 +412,7 @@
         
     if ( !IsActive() && ( 0 < iKeepaliveInterval ) )
         {
-        if ( iRemoteAddressSet )
+        if ( iRemoteAddressSet && iRtpMediaClock )
             {
             __SUBCONTROLLER( "CMccRtpKeepalive::StartSending(), issue send timer" )
             
@@ -548,7 +548,7 @@
 //
 void CMccRtpKeepalive::ConstructL( 
     TUint8 aKeepalivePayloadType,
-    TUint8 aKeepaliveInterval,
+    TUint32 aKeepaliveInterval,
     const TDesC8& aKeepaliveData )
     {
     __SUBCONTROLLER( "CMccRtpKeepalive::ConstructL()" )
@@ -561,7 +561,7 @@
     iRtpHeaderInfo.iMarker = 0;
     
     UpdateParamsL( aKeepalivePayloadType, aKeepaliveInterval, 
-        aKeepaliveData );
+        aKeepaliveData, NULL );
     
     iSequenceNum = Random();
     
--- a/multimediacommscontroller/mmccsubcontroller/src/mccrtpkeepalivecontainer.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccsubcontroller/src/mccrtpkeepalivecontainer.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -178,7 +178,7 @@
 // ---------------------------------------------------------------------------
 //  
 void CMccRtpKeepaliveContainer::UpdateParamsL( MMccRtpInterface& aUser,
-    const TMccCodecInfo& aCodecInfo )
+    const TMccCodecInfo& aCodecInfo, CMccRtpMediaClock& aRtpMediaClock )
     {
     __SUBCONTROLLER( "CMccRtpKeepaliveContainer::UpdateParamsL(), Entry" )
     
@@ -191,13 +191,18 @@
         // previous keep-alive data.
         handler->Cancel();
         handler->UpdateParamsL( aCodecInfo.iKeepalivePT, 
-            aCodecInfo.iKeepaliveInterval, aCodecInfo.iKeepaliveData );
+            aCodecInfo.iKeepaliveInterval, aCodecInfo.iKeepaliveData, &aRtpMediaClock );
         
         if ( aCodecInfo.iKeepaliveInterval > 0 && !handler->IsActive() )
             {
             handler->ResetKeepaliveTimer();
             }
         }
+    else
+    	{
+    	TMccCodecInfo cInfo = aCodecInfo;
+		StartKeepaliveL( aUser, cInfo, aRtpMediaClock );
+    	}
     
     __SUBCONTROLLER( "CMccRtpKeepaliveContainer::UpdateParamsL(), exit" )
     }
--- a/multimediacommscontroller/mmccsubcontroller/src/mccrtpmanager.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccsubcontroller/src/mccrtpmanager.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -516,7 +516,7 @@
         dSink.SetSessionParamsL( sessParams );
         
         TMccCodecInfoBuffer infoBuffer( aCodecInfo );
-        dSink.ConfigureL( infoBuffer );
+        dSink.ConfigureL( infoBuffer, NULL );
         
         UpdateL( &aCodecInfo );
         }
@@ -549,7 +549,7 @@
         dSource.SetSessionParamsL( sessParams );
         
         TMccCodecInfoBuffer infoBuffer( aCodecInfo );
-        dSource.ConfigureL( infoBuffer );
+        dSource.ConfigureL( infoBuffer, NULL );
         
         UpdateL( &aCodecInfo );
         }
--- a/multimediacommscontroller/mmccsubcontroller/src/mccsymdlstream.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccsubcontroller/src/mccsymdlstream.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -49,7 +49,8 @@
     MAsyncEventHandler* aEventhandler, 
     MMccResources* aMccResources, 
     CMccRtpManager* aManager, 
-    TInt aStreamType ) : 
+    TInt aStreamType,
+    CMccRtpMediaClock& aClock ) : 
     CMccSymStreamBase( aMccStreamId, 
                        aEventhandler, 
                        aMccResources, 
@@ -58,6 +59,7 @@
     iJitterBuffer( NULL ), 
     iFormatDecode( NULL )
     {
+    iRtpMediaClock = &aClock;
     }
 
 // -----------------------------------------------------------------------------
@@ -70,14 +72,16 @@
     MAsyncEventHandler* aEventhandler, 
     MMccResources* aMccResources,
     CMccRtpManager* aManager, 
-    TInt aStreamType ) 
+    TInt aStreamType,
+    CMccRtpMediaClock& aClock ) 
     {
     CMccSymDlStream* s = 
             new ( ELeave ) CMccSymDlStream( aMccStreamId, 
                                             aEventhandler, 
                                             aMccResources,
                                             aManager, 
-                                            aStreamType );
+                                            aStreamType,
+                                            aClock );
     CleanupStack::PushL( s );
     s->ConstructL();
     return s;
@@ -261,6 +265,10 @@
     else if ( CurrentCodecState() == EStateCodecLoaded ||
               CurrentCodecState() == EStateCodecLoadedAndUpdating )
         {
+        iJitterBuffer->SetupL( iCodecInfo.iMaxPtime, 
+                       		   iCodecInfo.iJitterBufThreshold, 
+                       		   iCodecInfo );
+        
         // Update codec info
         if ( iDatasource->DataSourceType() == KMccRtpSourceUid )
        	    {
@@ -269,7 +277,7 @@
             
             // For updating keep alive parameters
             TMccCodecInfoBuffer infoBuffer( iCodecInfo );     
-            dataSource->ConfigureL( infoBuffer );
+            dataSource->ConfigureL( infoBuffer, iRtpMediaClock );
        	    }
         SetCodecState( EStateCodecLoadedAndUpdating );
     	UpdateCodecInformationL( orig, iCodecInfo );
--- a/multimediacommscontroller/mmccsubcontroller/src/mccsymsimpledlstream.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccsubcontroller/src/mccsymsimpledlstream.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -50,7 +50,8 @@
     MMccResources* aMccResources,
     CMccRtpManager* aManager, 
     TFourCC aFourCC,
-    TInt aStreamType ) : 
+    TInt aStreamType,
+    CMccRtpMediaClock& aClock ) : 
     CMccSymStreamBase( aMccStreamId, 
                        aEventhandler, 
                        aMccResources, 
@@ -58,6 +59,7 @@
                        aStreamType )
     {
     iFourCC = aFourCC;
+    iRtpMediaClock = &aClock;
     }
 
 // -----------------------------------------------------------------------------
@@ -71,7 +73,8 @@
     MMccResources* aMccResources,
     CMccRtpManager* aManager, 
     TFourCC aFourCC,
-    TInt aStreamType ) 
+    TInt aStreamType,
+    CMccRtpMediaClock& aClock ) 
     {
     CMccSymSimpleDlStream* s = 
             new ( ELeave ) CMccSymSimpleDlStream( aMccStreamId, 
@@ -79,7 +82,8 @@
                                                   aMccResources, 
                                                   aManager, 
                                                   aFourCC, 
-                                                  aStreamType );
+                                                  aStreamType,
+                                                  aClock );
     CleanupStack::PushL( s );
     s->ConstructL();
 
@@ -234,7 +238,7 @@
             
             // For updating keep alive parameters
             TMccCodecInfoBuffer infoBuffer( iCodecInfo );     
-            dataSource->ConfigureL( infoBuffer );
+            dataSource->ConfigureL( infoBuffer, iRtpMediaClock );
        	    }
         SetCodecState( EStateCodecLoadedAndUpdating );
     	UpdateCodecInformationL( iCodecInfo );
--- a/multimediacommscontroller/mmccsubcontroller/src/mccsymsubthreadclient.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccsubcontroller/src/mccsymsubthreadclient.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -304,7 +304,8 @@
                                          this, 
                                          iMccResources,
                                          iRtpmanager, 
-                                         aStreamType );
+                                         aStreamType,
+                                         *iRtpMediaClock );
         }
     else if( ( sourceType == KMccRtpSourceUid && sinkType == KMccVideoSinkUid ) ||
              ( aStreamType == KMccAudioLocalStream || aStreamType == KMccVideoLocalStream ) )
@@ -315,7 +316,8 @@
                                                iMccResources,
                                                iRtpmanager, 
                                                aFourCC, 
-                                               aStreamType );
+                                               aStreamType,
+                                               *iRtpMediaClock );
                 
         }
     else
--- a/multimediacommscontroller/mmccsubcontroller/src/mccsymulstream.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccsubcontroller/src/mccsymulstream.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -253,12 +253,6 @@
         
         CreatePayloadFormatEncoderL();
         
-       	if ( iDatasink->DataSinkType() == KMccRtpSinkUid )
-       	    {
-            CMccRtpDataSink* dataSink = static_cast<CMccRtpDataSink*>( iDatasink );        
-            dataSink->SetMediaClock( *iRtpMediaClock ); 
-       	    }
-        
         // Just negotiate the codec, load it later
         static_cast<CMccUlDataPath*>( iDatapath )->NegotiateL( *iFormatEncode );
         
@@ -278,6 +272,15 @@
         }
     else if ( CurrentCodecState() == EStateCodecPrepared )
         {
+        if ( iDatasink->DataSinkType() == KMccRtpSinkUid )
+       	    {
+	        CMccRtpDataSink* dataSink = 
+	                static_cast<CMccRtpDataSink*>( iDatasink );
+	            
+	        // For updating keep alive parameters
+	        TMccCodecInfoBuffer infoBuffer( iCodecInfo ); 
+	    	dataSink->ConfigureL( infoBuffer, iRtpMediaClock );
+       	    }
         if ( CodecLoadingAllowed() )
             {
             // Load the codec
@@ -288,15 +291,6 @@
                                                
             UpdateCodecInformationL( iCodecInfo );
             }
-        else if ( iDatasink->DataSinkType() == KMccRtpSinkUid )
-       	    {
-            CMccRtpDataSink* dataSink = 
-                static_cast<CMccRtpDataSink*>( iDatasink );
-            
-            // For updating keep alive parameters
-            TMccCodecInfoBuffer infoBuffer( iCodecInfo );     
-            dataSink->ConfigureL( infoBuffer );
-       	    }
         }
     else if ( CurrentCodecState() == EStateCodecLoaded ||
               CurrentCodecState() == EStateCodecLoadedAndUpdating )
@@ -308,7 +302,7 @@
             
             // For updating keep alive parameters
             TMccCodecInfoBuffer infoBuffer( iCodecInfo );     
-            dataSink->ConfigureL( infoBuffer );
+            dataSink->ConfigureL( infoBuffer, iRtpMediaClock );
        	    }
         // Update codec info
         SetCodecState( EStateCodecLoadedAndUpdating );
--- a/multimediacommscontroller/mmccsubcontroller/tsrc/ut_subcontroller/Inc/UT_CMCCSymSimpleDlStream.h	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccsubcontroller/tsrc/ut_subcontroller/Inc/UT_CMCCSymSimpleDlStream.h	Thu Aug 19 10:18:22 2010 +0300
@@ -160,6 +160,8 @@
         CMccTestEventHandler* iEventHandler;
         
         CMccResourcePoolStub* iResources;
+        
+        CMccRtpMediaClock* iRtpMediaClock;
 		
         TUint32 iMccSessionId;
 
--- a/multimediacommscontroller/mmccsubcontroller/tsrc/ut_subcontroller/Inc/UT_CMccSymDlStream.h	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccsubcontroller/tsrc/ut_subcontroller/Inc/UT_CMccSymDlStream.h	Thu Aug 19 10:18:22 2010 +0300
@@ -142,6 +142,7 @@
         
         CMccResourcePoolStub* iResources;
         CMccMultiplexer* iMultiPlexer;
+        CMccRtpMediaClock* iRtpMediaClock;
 		
         TUint32 iMccSessionId;
 
--- a/multimediacommscontroller/mmccsubcontroller/tsrc/ut_subcontroller/Src/UT_CMCCSymSimpleDlStream.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccsubcontroller/tsrc/ut_subcontroller/Src/UT_CMCCSymSimpleDlStream.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -86,13 +86,15 @@
 
 void UT_CMccSymSimpleDlStream::SetupL(  )
     {
+    iRtpMediaClock = CMccRtpMediaClock::NewL();
+    
     iResources = CMccResourcePoolStub::NewL();
     iEventHandler = CMccTestEventHandler::NewL();
     iRtpManager = CMccRtpManager::NewL(*iEventHandler, *iResources, iMccSessionId );
     iStreamId = 1;
     
     CMccSymSimpleDlStream* stream = CMccSymSimpleDlStream::NewLC(
-    	iStreamId, this, iResources, iRtpManager, TFourCC(),  KMccVideoDownlinkStream );
+    	iStreamId, this, iResources, iRtpManager, TFourCC(),  KMccVideoDownlinkStream, *iRtpMediaClock );
     CleanupStack::Pop( stream );
     iSimpleDlStream = stream;
     stream = NULL;
@@ -131,6 +133,12 @@
     delete iEventHandler;
     delete iResources;
     REComSession::FinalClose();
+    
+    if ( iRtpMediaClock )
+        {
+        delete iRtpMediaClock;
+        iRtpMediaClock = NULL;
+        }
     }
 
 void UT_CMccSymSimpleDlStream::UT_CMccSymSimpleDlStream_CreatePayloadFormatDecoderLL(  )
--- a/multimediacommscontroller/mmccsubcontroller/tsrc/ut_subcontroller/Src/UT_CMccRtpKeepalive.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccsubcontroller/tsrc/ut_subcontroller/Src/UT_CMccRtpKeepalive.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -83,6 +83,8 @@
 
 void UT_CMccRtpKeepalive::SetupL()
     {
+    iRtpMediaClock = CMccRtpMediaClock::NewL();
+    
     iEventHandler = CMccTestEventHandler::NewL();
     iRtpApi = CRtpAPI::NewL( *iEventHandler );
     TPckgBuf<TInt> params( 30000 );
@@ -92,15 +94,15 @@
 	TMccCodecInfo codecInfo;
 	TMccCodecInfoBuffer infoBuffer( codecInfo );
 	CMccRtpDataSource* dSource = static_cast<CMccRtpDataSource*>( iRtpSource );
-	dSource->ConfigureL( infoBuffer );
+	dSource->ConfigureL( infoBuffer, iRtpMediaClock );
 	CMccRtpDataSink* dSink = static_cast<CMccRtpDataSink*>( iRtpSink );
-	dSink->ConfigureL( infoBuffer );
-	
-	iRtpMediaClock = CMccRtpMediaClock::NewL();
+	dSink->ConfigureL( infoBuffer, iRtpMediaClock );
     } 
 
 void UT_CMccRtpKeepalive::Setup2L()
     {
+    iRtpMediaClock = CMccRtpMediaClock::NewL();
+    
     iEventHandler = CMccTestEventHandler::NewL();
     iRtpApi = CRtpAPI::NewL( *iEventHandler );
     TPckgBuf<TInt> params( 30000 );
@@ -110,11 +112,10 @@
 	TMccCodecInfo codecInfo;
 	TMccCodecInfoBuffer infoBuffer( codecInfo );
 	CMccRtpDataSource* dSource = static_cast<CMccRtpDataSource*>( iRtpSource );
-	dSource->ConfigureL( infoBuffer );
+	dSource->ConfigureL( infoBuffer, iRtpMediaClock );
 	CMccRtpDataSink* dSink = static_cast<CMccRtpDataSink*>( iRtpSink );
-	dSink->ConfigureL( infoBuffer );
+	dSink->ConfigureL( infoBuffer, iRtpMediaClock );
 	
-	iRtpMediaClock = CMccRtpMediaClock::NewL();
 	iKeepaliveHandler = 
 	    CMccRtpKeepalive::NewL( *iEventHandler, *iRtpApi, TRtpId(), 96, 1000, KNullDesC8, ETrue );
 	    
@@ -177,11 +178,11 @@
         EUNIT_ASSERT_EQUALS( container->RemoteAddressSet(), KErrNone );
         
         // Update valid case
-        MCC_EUNIT_ASSERT_NO_LEAVE( container->UpdateParamsL( *static_cast<CMccRtpDataSink*>( iRtpSink ), codecInfo ) );
+        MCC_EUNIT_ASSERT_NO_LEAVE( container->UpdateParamsL( *static_cast<CMccRtpDataSink*>( iRtpSink ), codecInfo, *iRtpMediaClock ) );
         
         // Update with keealive interval 0
         codecInfo.iKeepaliveInterval = 0;
-        MCC_EUNIT_ASSERT_NO_LEAVE( container->UpdateParamsL( *static_cast<CMccRtpDataSink*>( iRtpSink ), codecInfo ) );
+        MCC_EUNIT_ASSERT_NO_LEAVE( container->UpdateParamsL( *static_cast<CMccRtpDataSink*>( iRtpSink ), codecInfo, *iRtpMediaClock ) );
         
         // Stop keepalive
         //
@@ -226,11 +227,11 @@
         EUNIT_ASSERT_EQUALS( container->RemoteAddressSet(), KErrNone );
         
         // Update valid case
-        container->UpdateParamsL( *static_cast<CMccRtpDataSink*>( iRtpSink ), codecInfo );
+        container->UpdateParamsL( *static_cast<CMccRtpDataSink*>( iRtpSink ), codecInfo, *iRtpMediaClock );
         
         // Update with keealive interval 0
         codecInfo.iKeepaliveInterval = 0;
-        container->UpdateParamsL( *static_cast<CMccRtpDataSink*>( iRtpSink ), codecInfo );
+        container->UpdateParamsL( *static_cast<CMccRtpDataSink*>( iRtpSink ), codecInfo, *iRtpMediaClock );
         
         
         // Stop keepalive
@@ -337,7 +338,7 @@
 	    CleanupStack::PushL( keepaliveHandler );    
     
         TUint8 keepalivePT(96); 
-        TUint8 keepaliveInterval(25);    
+        TUint32 keepaliveInterval(25000000);    
         const TUint8 KAmrKeepAlivePayload[6] = 
         { 
         0xF4, 0x00, 0x00, 0x00, 0x00, 0x00
@@ -346,11 +347,11 @@
         keepAliveData.Copy( KAmrKeepAlivePayload );
         
         // Valid case
-        EUNIT_ASSERT_LEAVE( keepaliveHandler->UpdateParamsL( keepalivePT, keepaliveInterval, keepAliveData ) );
+        EUNIT_ASSERT_LEAVE( keepaliveHandler->UpdateParamsL( keepalivePT, keepaliveInterval, keepAliveData, iRtpMediaClock ) );
 
         // Wrong payload type
         keepalivePT = 129;
-        EUNIT_ASSERT_LEAVE( keepaliveHandler->UpdateParamsL( keepalivePT, keepaliveInterval, keepAliveData ) );    
+        EUNIT_ASSERT_LEAVE( keepaliveHandler->UpdateParamsL( keepalivePT, keepaliveInterval, keepAliveData, iRtpMediaClock ) );    
         CleanupStack::PopAndDestroy( keepaliveHandler );
         }
     else
@@ -359,7 +360,7 @@
      	    CMccRtpKeepalive::NewL( *iEventHandler, *iRtpApi, TRtpId(), 96, 1000, KNullDesC8, ETrue );
         
         TUint8 keepalivePT(96); 
-        TUint8 keepaliveInterval(25);    
+        TUint32 keepaliveInterval(25000000);    
         const TUint8 KAmrKeepAlivePayload[6] = 
         { 
         0xF4, 0x00, 0x00, 0x00, 0x00, 0x00
@@ -368,11 +369,11 @@
         keepAliveData.Copy( KAmrKeepAlivePayload );
         
         // Valid case
-        MCC_EUNIT_ASSERT_NO_LEAVE( iKeepaliveHandler->UpdateParamsL( keepalivePT, keepaliveInterval, keepAliveData ) );
+        MCC_EUNIT_ASSERT_NO_LEAVE( iKeepaliveHandler->UpdateParamsL( keepalivePT, keepaliveInterval, keepAliveData, iRtpMediaClock ) );
 
         // Wrong payload type
         keepalivePT = 129;
-        MCC_EUNIT_ASSERT_SPECIFIC_LEAVE( iKeepaliveHandler->UpdateParamsL( keepalivePT, keepaliveInterval, keepAliveData ), KErrArgument );            
+        MCC_EUNIT_ASSERT_SPECIFIC_LEAVE( iKeepaliveHandler->UpdateParamsL( keepalivePT, keepaliveInterval, keepAliveData, iRtpMediaClock ), KErrArgument );            
         }
     }
 
@@ -445,8 +446,8 @@
         iKeepaliveHandler->iStatus = KErrNone;
         iKeepaliveHandler->iCurrentState = CMccRtpKeepalive::ESending;
         MCC_EUNIT_ASSERT_NO_LEAVE( iKeepaliveHandler->RunL() );
-        EUNIT_ASSERT( iKeepaliveHandler->iCurrentState == CMccRtpKeepalive::EWaitingTimer );
-        EUNIT_ASSERT( iKeepaliveHandler->IsActive() );
+        EUNIT_ASSERT( iKeepaliveHandler->iCurrentState == CMccRtpKeepalive::ESendingPending );
+        EUNIT_ASSERT( !iKeepaliveHandler->IsActive() );
         
         // Completed in not supported state
         iKeepaliveHandler->iStatus = KErrNone;
@@ -472,12 +473,14 @@
         };
         TBuf8<6> keepAliveData;
         keepAliveData.Copy( KAmrKeepAlivePayload );
-        EUNIT_ASSERT_LEAVE( iKeepaliveHandler->UpdateParamsL( keepalivePT, keepaliveInterval, keepAliveData ) );
+        EUNIT_ASSERT_LEAVE( iKeepaliveHandler->UpdateParamsL( keepalivePT, keepaliveInterval, keepAliveData, iRtpMediaClock ) );
         
         // Send completion ok when not active anymore, timer is started
         iKeepaliveHandler->Cancel();
         iKeepaliveHandler->iStatus = KErrNone;
         iKeepaliveHandler->iCurrentState = CMccRtpKeepalive::ESending;
+        iKeepaliveHandler->iRtpMediaClock = iRtpMediaClock;
+        
         MCC_EUNIT_ASSERT_NO_LEAVE( iKeepaliveHandler->RunL() );
         EUNIT_ASSERT( iKeepaliveHandler->iCurrentState == CMccRtpKeepalive::EWaitingTimer );
         EUNIT_ASSERT( iKeepaliveHandler->IsActive() );
@@ -508,10 +511,10 @@
         // Send completion ok when not active anymore, timer is started
         iKeepaliveHandler->Cancel();
         iKeepaliveHandler->iStatus = KErrNone;
-        iKeepaliveHandler->iCurrentState = CMccRtpKeepalive::ESending;
+        iKeepaliveHandler->iCurrentState = CMccRtpKeepalive::ESending;        
         iKeepaliveHandler->RunL();
-        EUNIT_ASSERT( iKeepaliveHandler->iCurrentState == CMccRtpKeepalive::EWaitingTimer );
-        EUNIT_ASSERT( iKeepaliveHandler->IsActive() );
+        EUNIT_ASSERT( iKeepaliveHandler->iCurrentState == CMccRtpKeepalive::ESendingPending );
+        EUNIT_ASSERT( !iKeepaliveHandler->IsActive() );
         
         // Completed in not supported state
         iKeepaliveHandler->iStatus = KErrNone;
@@ -537,7 +540,7 @@
         };
         TBuf8<6> keepAliveData;
         keepAliveData.Copy( KAmrKeepAlivePayload );
-        MCC_EUNIT_ASSERT_NO_LEAVE( iKeepaliveHandler->UpdateParamsL( keepalivePT, keepaliveInterval, keepAliveData ) );
+        MCC_EUNIT_ASSERT_NO_LEAVE( iKeepaliveHandler->UpdateParamsL( keepalivePT, keepaliveInterval, keepAliveData, iRtpMediaClock ) );
         
         // Send completion ok when not active anymore, timer is started
         iKeepaliveHandler->Cancel();
--- a/multimediacommscontroller/mmccsubcontroller/tsrc/ut_subcontroller/Src/UT_CMccSymDlStream.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/mmccsubcontroller/tsrc/ut_subcontroller/Src/UT_CMccSymDlStream.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -35,6 +35,7 @@
 #include "mccmultiplexer.h"
 #include "mmcccryptocontext.h"
 #include "mccjitterbuffer.h"
+#include "mccrtpmediaclock.h"
 
 #include "mccunittestmacros.h"
 
@@ -83,11 +84,13 @@
 //  METHODS
 void UT_CMccSymDlStream::SetupL()
     {
+    iRtpMediaClock = CMccRtpMediaClock::NewL();
+    
     iResources = CMccResourcePoolStub::NewL();
     iStreamId = 1;
     iHandler = CMccTestEventHandler::NewL();
     iRtpMan = CMccRtpManager::NewL( *iHandler, *iResources, iMccSessionId );
-    iStream = CMccSymDlStream::NewLC( iStreamId, iHandler, iResources, iRtpMan, 201 );
+    iStream = CMccSymDlStream::NewLC( iStreamId, iHandler, iResources, iRtpMan, 201, *iRtpMediaClock );
     CleanupStack::Pop( iStream );
     
     TPckgBuf<TInt> params( 30000 );
@@ -118,11 +121,13 @@
     
 void UT_CMccSymDlStream::Setup2L()
     {
+    iRtpMediaClock = CMccRtpMediaClock::NewL();
+    
     iResources = CMccResourcePoolStub::NewL();
     iStreamId = 1;
     iHandler = CMccTestEventHandler::NewL();
     iRtpMan = CMccRtpManager::NewL( *iHandler, *iResources, iMccSessionId );
-    iStream = CMccSymDlStream::NewLC( iStreamId, iHandler, iResources, iRtpMan, 201 );
+    iStream = CMccSymDlStream::NewLC( iStreamId, iHandler, iResources, iRtpMan, 201, *iRtpMediaClock );
     CleanupStack::Pop( iStream );
     
     TPckgBuf<TInt> params( 30000 );
@@ -134,11 +139,13 @@
 
 void UT_CMccSymDlStream::SetupIlbcL()
     {
+    iRtpMediaClock = CMccRtpMediaClock::NewL();
+    
     iResources = CMccResourcePoolStub::NewL();
     iStreamId = 1;
     iHandler = CMccTestEventHandler::NewL();
     iRtpMan = CMccRtpManager::NewL( *iHandler, *iResources,iMccSessionId );
-    iStream = CMccSymDlStream::NewLC( iStreamId, iHandler, iResources, iRtpMan, 201 );
+    iStream = CMccSymDlStream::NewLC( iStreamId, iHandler, iResources, iRtpMan, 201, *iRtpMediaClock );
     CleanupStack::Pop( iStream );
     
     TPckgBuf<TInt> params( 30000 );
@@ -185,6 +192,12 @@
     delete iSourceStub;
     delete iSinkStub;
     delete iResources;
+    
+    if ( iRtpMediaClock )
+        {
+        delete iRtpMediaClock;
+        iRtpMediaClock = NULL;
+        }
     }
 
 void UT_CMccSymDlStream::UT_CMccSymDlStream_SetPrioritySettingsLL(  )
--- a/multimediacommscontroller/tsrc/rtpsourcesinkstub/inc/mccrtpdatasource.h	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/tsrc/rtpsourcesinkstub/inc/mccrtpdatasource.h	Thu Aug 19 10:18:22 2010 +0300
@@ -310,7 +310,7 @@
 		 * @since	Series 60 3.2
          * Send jitter event through mcc rtp interface
          */
-        void SendJitterEvent( TMccRtpEventData aEvent, TInt aError );
+        void SendJitterEvent( TMccRtpEventDataExtended aEvent, TInt aError );
 
         
     protected:  // Functions from base classes
--- a/multimediacommscontroller/tsrc/rtpsourcesinkstub/src/MccRtpDataSource_STUB.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/tsrc/rtpsourcesinkstub/src/MccRtpDataSource_STUB.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -516,7 +516,7 @@
 // CMccRtpDataSource::SendJitterEvent()
 // -----------------------------------------------------------------------------
 //	
-void CMccRtpDataSource::SendJitterEvent( TMccRtpEventData /*aEvent*/, TInt /*aError*/ )
+void CMccRtpDataSource::SendJitterEvent( TMccRtpEventDataExtended /*aEvent*/, TInt /*aError*/ )
     {
 
     }
--- a/multimediacommscontroller/tsrc/rtpsourcesinkstub/src/mccrtpinterface_stub.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/tsrc/rtpsourcesinkstub/src/mccrtpinterface_stub.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -92,7 +92,7 @@
 // Configures the RTP source/sink
 // -----------------------------------------------------------------------------
 //
-void MMccRtpInterface::ConfigureL( const TDesC8& /*aConfig*/ )
+void MMccRtpInterface::ConfigureL( const TDesC8& /*aConfig*/, CMccRtpMediaClock* /*aRtpMediaClock*/ )
     {
     if ( KNullId == RtpStreamId() )
         {
--- a/multimediacommscontroller/tsrc/stubs/src/mccrtpkeepalivecontainer_STUB.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommscontroller/tsrc/stubs/src/mccrtpkeepalivecontainer_STUB.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -166,7 +166,7 @@
 // ---------------------------------------------------------------------------
 //  
 void CMccRtpKeepaliveContainer::UpdateParamsL( MMccRtpInterface& aUser,
-    const TMccCodecInfo& aCodecInfo )
+    const TMccCodecInfo& aCodecInfo, CMccRtpMediaClock& aRtpMediaClock )
     {
     }
 
--- a/multimediacommsengine/mmceshared/src/mcecomcodec.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommsengine/mmceshared/src/mcecomcodec.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -232,7 +232,7 @@
     TInt slashPos = aRtpmapValue.Find( _L8( "/" ) );
     if ( slashPos != KErrNotFound )
         {
-        return aRtpmapValue.Left(slashPos).Compare( iSdpName ) == 0;
+		return aRtpmapValue.Left(slashPos).CompareF( iSdpName ) == 0;
         }
 
     return aRtpmapValue.FindF(iSdpName) == 0;
--- a/multimediacommsengine/mmcesrv/group/mceserver.mmp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommsengine/mmcesrv/group/mceserver.mmp	Thu Aug 19 10:18:22 2010 +0300
@@ -223,7 +223,7 @@
 LIBRARY     esock.lib
 LIBRARY     bafl.lib
 LIBRARY     estor.lib
-LIBRARY     commonengine.lib
+LIBRARY     CommonEngine.lib
 LIBRARY     commdb.lib 
 LIBRARY     charconv.lib
 LIBRARY     sipclient.lib
--- a/multimediacommsengine/mmcesrv/mmceserver/src/mcesipconnection.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommsengine/mmcesrv/mmceserver/src/mcesipconnection.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -623,6 +623,8 @@
             session->Canceled();
             }
         }
+    
+    iSessionManager.Cleanup();
     MCESRV_DEBUG("CMceSipConnection::ConnectionStateChanged, Exit")
     }
 
--- a/multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/src/UT_CMCESIPConnection.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/src/UT_CMCESIPConnection.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -617,7 +617,31 @@
   	iConnection->ConnectionStateChanged( CSIPConnection::EUnavailable );
     EUNIT_ASSERT( !iSipSession->Body()->iIsConnectionActive );
   	
-  	
+    //cleanup orphan session test
+    CMceSipManager& manager = iServerCore->Manager();
+    iIds.iProfileID = 1;
+    iIds.iManagerType = KMceCSSIPSession;
+    iIds.iDialogType = KMceDlgTypeInvite;
+    
+    CDesC8ArrayFlat* params = new (ELeave) CDesC8ArrayFlat( KMceArrayGranularity );
+    CleanupStack::PushL( params );
+    params->AppendL( _L8("User <user2@host>") );
+    params->AppendL( _L8("User <user@host>") );
+
+    iConnection->Connection().SetState( CSIPConnection::EActive );
+    CMceCsSubSession* subsession = 
+    		manager.CreateSubSessionL( *iSession, iIds, *params );
+    CleanupStack::PushL( subsession );
+    
+    manager.AddOrphanSubSessionL(subsession);
+    CleanupStack::Pop( subsession );
+    EUNIT_ASSERT ( manager.OrphanSubSessionCount() == 1 );
+
+    iConnection->Connection().SetState( CSIPConnection::EInactive );
+  	iConnection->ConnectionStateChanged( CSIPConnection::EInactive );
+    EUNIT_ASSERT ( manager.OrphanSubSessionCount() == 0 );
+    
+    CleanupStack::PopAndDestroy();
     }
     
     
--- a/multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/stubs/src/sipprofile.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/stubs/src/sipprofile.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -270,7 +270,7 @@
 // -----------------------------------------------------------------------------
 //	
 CSIPProfile::CSIPProfile(CSIPProfileRegistryBase* aRegistry):
-	iSIPProfileRegistry(aRegistry), iEnabled(EFalse)
+	iSIPProfileRegistry(aRegistry), iEnabled(EFalse), iContextId(1)
 	{
 	}
 
--- a/multimediacommsengine/tsrc/mccstub/src/MmccCodecInformation.cpp	Thu Jul 15 19:04:32 2010 +0300
+++ b/multimediacommsengine/tsrc/mccstub/src/MmccCodecInformation.cpp	Thu Aug 19 10:18:22 2010 +0300
@@ -990,3 +990,13 @@
 
     }
     
+TUint32 CMccCodecInformation::KeepAliveTimerMicroSecs() const
+	{
+	return iKeepAliveTimerMicroSecs;
+	}
+TInt CMccCodecInformation::SetKeepAliveTimerMicroSecs( TUint32 aTimerValueMicroSecs )
+	{
+	iKeepAliveTimerMicroSecs = aTimerValueMicroSecs;
+	return KErrNone;
+	}
+    
--- a/natplugins/natpcliprovisioningnatfwadapter/group/wpnatfwtraversaladapter.mmp	Thu Jul 15 19:04:32 2010 +0300
+++ b/natplugins/natpcliprovisioningnatfwadapter/group/wpnatfwtraversaladapter.mmp	Thu Aug 19 10:18:22 2010 +0300
@@ -55,7 +55,7 @@
 USERINCLUDE     ../loc
 
 LIBRARY        	euser.lib 
-LIBRARY	        ProvisioningEngine.lib
+LIBRARY	        provisioningengine.lib
 LIBRARY         centralrepository.lib
 LIBRARY         charconv.lib
 LIBRARY         cmmanager.lib