Revision: 201024 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 15 Jul 2010 19:04:32 +0300
branchRCL_3
changeset 41 b9d283c5c7b5
parent 33 f40c1a748eb9
child 42 817c922b90eb
Revision: 201024 Kit: 2010127
multimediacommscontroller/mmccsubcontroller/src/mccsymulstream.cpp
multimediacommsengine/mmceshared/inc/mcecomaudiocodec.h
multimediacommsengine/mmceshared/src/mcecomaudiocodec.cpp
multimediacommsengine/mmcesrv/mmceserver/inc/mcestateoffering.h
multimediacommsengine/mmcesrv/mmceserver/src/mcestateoffering.cpp
multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/src/UT_CMCEStateOffering.cpp
--- a/multimediacommscontroller/mmccsubcontroller/src/mccsymulstream.cpp	Mon Jun 21 16:05:57 2010 +0300
+++ b/multimediacommscontroller/mmccsubcontroller/src/mccsymulstream.cpp	Thu Jul 15 19:04:32 2010 +0300
@@ -288,6 +288,15 @@
                                                
             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 )
--- a/multimediacommsengine/mmceshared/inc/mcecomaudiocodec.h	Mon Jun 21 16:05:57 2010 +0300
+++ b/multimediacommsengine/mmceshared/inc/mcecomaudiocodec.h	Thu Jul 15 19:04:32 2010 +0300
@@ -263,7 +263,13 @@
 	* Comfort noise
 	*/
 	TBool iComfortNoiseEnabled;
-	
+
+
+private:    // Friend classes
+
+    #ifdef TEST_EUNIT
+        friend class UT_CMceComAudioCodec;
+    #endif
     };
 
 
--- a/multimediacommsengine/mmceshared/src/mcecomaudiocodec.cpp	Mon Jun 21 16:05:57 2010 +0300
+++ b/multimediacommsengine/mmceshared/src/mcecomaudiocodec.cpp	Thu Jul 15 19:04:32 2010 +0300
@@ -522,6 +522,10 @@
             	
            	aStream.Data().BoundStreamL().RemoveCodecL( boundCnCodec );
             }
+			
+		// update keep alive payload type and data
+	    aMccCodec.SetKeepAlivePT( 120 );
+        aMccCodec.SetKeepAliveData( KNullDesC8 );
     	}
     	
     CleanupStack::PopAndDestroy( searchCodec );
--- a/multimediacommsengine/mmcesrv/mmceserver/inc/mcestateoffering.h	Mon Jun 21 16:05:57 2010 +0300
+++ b/multimediacommsengine/mmcesrv/mmceserver/inc/mcestateoffering.h	Thu Jul 15 19:04:32 2010 +0300
@@ -22,6 +22,7 @@
 #define CMCESTATEOFFERING_H
 
 #include "mcestate.h"
+#include "mcesrv.h"
 
 /**
 *  Represents MCE server state Offering
@@ -154,7 +155,12 @@
     void ExitSIPEventL( TMceStateTransitionEvent& aEvent );
     
     void EntryAnswerToOfferDecodedL( TMceStateTransitionEvent& aEvent );
+	
+private:
+	TInt iLastResponse;
+	TBool iReadyToSendACK;
 
+    MCESRV_UT_DEFINITIONS;
 	};
 
 #endif
--- a/multimediacommsengine/mmcesrv/mmceserver/src/mcestateoffering.cpp	Mon Jun 21 16:05:57 2010 +0300
+++ b/multimediacommsengine/mmcesrv/mmceserver/src/mcestateoffering.cpp	Thu Jul 15 19:04:32 2010 +0300
@@ -44,7 +44,9 @@
 // -----------------------------------------------------------------------------
 //
 CMceStateOffering::CMceStateOffering ()
-    : CMceState( KMceStateOffering )
+    : CMceState( KMceStateOffering ),
+      iLastResponse ( 0 ),
+	  iReadyToSendACK ( ETrue )
 	{
 	}
 
@@ -265,6 +267,7 @@
     TInt status = KErrNone;
     CMceSipSession& session = aEvent.Session();
     CSIPClientTransaction& response = session.Response();
+    iLastResponse = MceSip::ResponseCode( response );
      
     session.Extensions().UpdateL( response );
     session.Actions().CheckContactIsSecureL( response );
@@ -440,14 +443,35 @@
     TInt status = KErrNone;
 	CMceSipSession& session = aEvent.Session();
     CMceSipSession::TSubState subState = session.SubState();
+    TInt currentResponse = MceSip::ResponseCode( session.Response() );
 	
+	// If media handling is ongoing while 200OK arrives with certain SDP content
+    // don't send ACK thus the UAS will retransmit 200OK untile pervious meida handling
+    // finish.
+ 
+    if ( KMceSipRinging == iLastResponse &&
+    	 KMceSipOK == currentResponse && 
+    	 MceSip::HasContent( session.Response() ) )
+    	{
+		if ( session.WaitingMediaCallback() )
+    		{
+			iReadyToSendACK = EFalse;
+			MCESRV_DEBUG("Waiting media callback, do not send ACK for this 200OK")
+    		return;
+    		}
+    	else
+    		{
+			iReadyToSendACK = ETrue;
+			MCESRV_DEBUG("Ready to send ACK")
+    		}
+    	}
     //send ACK
     session.Actions().SendACKL( session.Response() );
 	session.Actions().CheckContactIsSecureL( session.Response() );
     session.ActiveBody().AnswerType() = KMceNegotiationAnswerTypeFinal;
     
-	// Handle the answer only if the media processing is not
-	// already ongoing
+    iLastResponse = currentResponse;
+
 	if ( !session.WaitingMediaCallback() )
 	    {
 	    if ( MceSip::HasContent( session.Response() ) )
@@ -773,6 +797,11 @@
 //
 void CMceStateOffering::ExitL( TMceStateTransitionEvent& aEvent )
 	{
+	if ( !iReadyToSendACK )
+		{
+		MCESRV_DEBUG("Not ready, don't change any state");
+		return;
+		}
 	
 	if ( IsExtensionRequestEvent( aEvent ))
 		{
--- a/multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/src/UT_CMCEStateOffering.cpp	Mon Jun 21 16:05:57 2010 +0300
+++ b/multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/src/UT_CMCEStateOffering.cpp	Thu Jul 15 19:04:32 2010 +0300
@@ -397,7 +397,7 @@
     EUNIT_ASSERT ( iSipSession->WaitingMediaCallback() );
     MCE_RESET_STUBS();
     
-    // 200 OK while waiting for media callback
+    // 200 OK while waiting for media callback non early media
     iSipSession->iSubState = CMceSipSession::EOffering;
     iStorage->iMediaManagerUpdateStatus = KMceAsync;
     
@@ -416,6 +416,31 @@
     EUNIT_ASSERT ( iSipSession->WaitingMediaCallback() );
     MCE_RESET_STUBS();
     
+    // 200 OK while waiting for media callback with early media
+    iSipSession->iSubState = CMceSipSession::EOffering;
+    iStorage->iMediaManagerUpdateStatus = KMceAsync;
+    iState->iLastResponse = KMceSipRinging;
+    MCETestHelper::SetResponseL( 
+            *iSipSession->iResponse, 
+            KMceSipOK, 
+            SipStrConsts::EPhraseOk, 
+            ETrue, ETrue, 1 );
+
+    TMceStateTransitionEvent event2_2( *iSipSession, EMceResponse );
+    iState->EntryL( event2_2 );
+    MCE_ENTRYL_POSTCONDITION
+        
+    MCE_ASSERT_STUBS( CMCETls::ENone /*mmaction*/, 
+                      CMCETls::ENone /*mmsdpaction*/, 
+                      SipStrConsts::EEmpty /*sentMethod*/, 
+                      KErrNotFound /*sentResponse*/);
+        
+    EUNIT_ASSERT ( iStorage->iAckSent == EFalse );
+    EUNIT_ASSERT ( event2_1.Code() == EMceResponse );
+    EUNIT_ASSERT ( iSipSession->PendingTransactions().Count() == 1 );
+    EUNIT_ASSERT ( iSipSession->WaitingMediaCallback() );
+    MCE_RESET_STUBS();
+    
     // 200 OK with wrong SDP
     iSipSession->iSubState = CMceSipSession::EOffering;
     iSipSession->SetWaitingMediaCallback( EFalse );
@@ -1005,8 +1030,20 @@
 	
 	TMceStateTransitionEvent event15( *iSipSession, EMceResponse );
     iState->ExitL( event15 );
-    EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering );   
-
+    EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering );  
+    
+    // EMceResponse with early media & waiting media call back
+    CSIPClientTransaction* clitransaction1_1 = 
+    MCETestHelper::ClientTransactionLC( SipStrConsts::EInfo, KMceSipOK, 
+        								SipStrConsts::EPhraseOk, ETrue );
+    iSipSession->SetPendingTransactionL( clitransaction1_1 );
+    CleanupStack::Pop( clitransaction1_1 );
+    iSipSession->iResponse = clitransaction1_1;
+    	
+    TMceStateTransitionEvent event15_1( *iSipSession, EMceResponse );
+    iState->iReadyToSendACK = EFalse;
+    iState->ExitL( event15_1 );
+    EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering );  
 
 	//EMceRedirectionResponse
 	CSIPClientTransaction* clitransaction2 =