multimediacommscontroller/mmccrtpsourcesink/src/mccrtpinterface.cpp
branchRCL_3
changeset 18 817c922b90eb
parent 0 1bce908db942
--- 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
 // -----------------------------------------------------------------------------
 //