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