multimediacommscontroller/mmccrtpsourcesink/tsrc/ut_rtpsourcesink/src/UT_CMccRtpInterface.cpp
branchRCL_3
changeset 59 b0e4b01681c5
parent 42 817c922b90eb
equal deleted inserted replaced
55:f72c4fccd381 59:b0e4b01681c5
    27 //  INTERNAL INCLUDES
    27 //  INTERNAL INCLUDES
    28 #include "rtpapi.h"
    28 #include "rtpapi.h"
    29 #include "mccrtpinterface.h"
    29 #include "mccrtpinterface.h"
    30 #include "mccrtpdatasink.h"
    30 #include "mccrtpdatasink.h"
    31 #include "mccrtpkeepalivecontainer.h"
    31 #include "mccrtpkeepalivecontainer.h"
    32 #include "mccrtpmediaclock.h"
       
    33 
    32 
    34 // CONSTRUCTION
    33 // CONSTRUCTION
    35 UT_CMccRtpInterface* UT_CMccRtpInterface::NewL()
    34 UT_CMccRtpInterface* UT_CMccRtpInterface::NewL()
    36     {
    35     {
    37     UT_CMccRtpInterface* self = UT_CMccRtpInterface::NewLC(); 
    36     UT_CMccRtpInterface* self = UT_CMccRtpInterface::NewLC(); 
    92     MAsyncEventHandler* eventHandler = NULL;
    91     MAsyncEventHandler* eventHandler = NULL;
    93     iRtpKeepaliveMechanism = 
    92     iRtpKeepaliveMechanism = 
    94         CMccRtpKeepaliveContainer::NewL( *eventHandler, 
    93         CMccRtpKeepaliveContainer::NewL( *eventHandler, 
    95                                          *iRtpApi, 
    94                                          *iRtpApi, 
    96                                          iRtpSessionId ); 
    95                                          iRtpSessionId ); 
    97     
       
    98     iRtpMediaClock = CMccRtpMediaClock::NewL();                                      
       
    99     } 
    96     } 
   100 
    97 
   101 void UT_CMccRtpInterface::Teardown(  )
    98 void UT_CMccRtpInterface::Teardown(  )
   102     {
    99     {
   103     delete iRtpKeepaliveMechanism;
   100     delete iRtpKeepaliveMechanism;
   106     delete static_cast<CMccRtpDataSink*>( iInterface );
   103     delete static_cast<CMccRtpDataSink*>( iInterface );
   107     iInterface = NULL;
   104     iInterface = NULL;
   108     
   105     
   109     delete iRtpApi;
   106     delete iRtpApi;
   110     iRtpApi = NULL;
   107     iRtpApi = NULL;
   111     
       
   112     if ( iRtpMediaClock )
       
   113         {
       
   114         delete iRtpMediaClock;
       
   115         iRtpMediaClock = NULL;
       
   116         }
       
   117     }
   108     }
   118 
   109 
   119 void UT_CMccRtpInterface::UT_CMccRtpInterface_ConfigureLL()
   110 void UT_CMccRtpInterface::UT_CMccRtpInterface_ConfigureLL()
   120     {
   111     {
   121     TMccCodecInfo cInfo;
   112     TMccCodecInfo cInfo;
   122     EUNIT_ASSERT_SPECIFIC_LEAVE( 
   113     EUNIT_ASSERT_SPECIFIC_LEAVE( 
   123         iInterface->ConfigureL( TMccCodecInfoBuffer( cInfo ), iRtpMediaClock ), KErrNotReady );
   114         iInterface->ConfigureL( TMccCodecInfoBuffer( cInfo ) ), KErrNotReady );
   124     
   115     
   125     TMccRtpSessionParams params;
   116     TMccRtpSessionParams params;
   126     params.iRtpAPI = iRtpApi;
   117     params.iRtpAPI = iRtpApi;
   127     params.iSessionId = iRtpSessionId;
   118     params.iSessionId = iRtpSessionId;
   128     params.iEnableRTCP = ETrue;
   119     params.iEnableRTCP = ETrue;
   129     params.iRtpKeepalive = iRtpKeepaliveMechanism;
   120     params.iRtpKeepalive = iRtpKeepaliveMechanism;
   130     iInterface->SetSessionParamsL( params );
   121     iInterface->SetSessionParamsL( params );
   131     TBuf8<1> kaData;
   122     TBuf8<1> kaData;
   132     EUNIT_ASSERT_SPECIFIC_LEAVE( 
   123     EUNIT_ASSERT_SPECIFIC_LEAVE( 
   133         iInterface->ConfigureL( kaData, iRtpMediaClock ), KErrArgument );
   124         iInterface->ConfigureL( kaData ), KErrArgument );
   134     
   125     
   135     cInfo.iKeepalivePT = 13;
   126     cInfo.iKeepalivePT = 13;
   136     cInfo.iKeepaliveInterval = 0;
   127     cInfo.iKeepaliveInterval = 0;
   137     cInfo.iKeepaliveData = kaData;
   128     cInfo.iKeepaliveData = kaData;
   138     iInterface->ConfigureL( TMccCodecInfoBuffer( cInfo ), iRtpMediaClock );
   129     iInterface->ConfigureL( TMccCodecInfoBuffer( cInfo ) );
   139     EUNIT_ASSERT( TMccCodecInfo::Compare( cInfo, iInterface->iCodecInfo ) );
   130     EUNIT_ASSERT( TMccCodecInfo::Compare( cInfo, iInterface->iCodecInfo ) );
   140     
   131     
   141     TMccCodecInfo backup = iInterface->iCodecInfo;
   132     TMccCodecInfo backup = iInterface->iCodecInfo;
   142     cInfo.iKeepaliveInterval = 28;
   133     cInfo.iKeepaliveInterval = 28;
   143     iInterface->ConfigureL( TMccCodecInfoBuffer( cInfo ), iRtpMediaClock );
   134     iInterface->ConfigureL( TMccCodecInfoBuffer( cInfo ) );
   144     EUNIT_ASSERT( 
   135     EUNIT_ASSERT( 
   145         cInfo.iKeepaliveInterval == iInterface->iCodecInfo.iKeepaliveInterval );
   136         cInfo.iKeepaliveInterval == iInterface->iCodecInfo.iKeepaliveInterval );
   146     
   137     
   147     backup = iInterface->iCodecInfo;
   138     backup = iInterface->iCodecInfo;
   148     cInfo.iKeepaliveInterval = 0;
   139     cInfo.iKeepaliveInterval = 0;
   149     iInterface->ConfigureL( TMccCodecInfoBuffer( cInfo ), iRtpMediaClock );
   140     iInterface->ConfigureL( TMccCodecInfoBuffer( cInfo ) );
   150     EUNIT_ASSERT( TMccCodecInfo::Compare( backup, iInterface->iCodecInfo ) );
   141     EUNIT_ASSERT( TMccCodecInfo::Compare( backup, iInterface->iCodecInfo ) );
   151     }
   142     }
   152 
   143 
   153 void UT_CMccRtpInterface::UT_CMccRtpInterface_SendRTCPReceiverReportL(  )
   144 void UT_CMccRtpInterface::UT_CMccRtpInterface_SendRTCPReceiverReportL(  )
   154     {
   145     {