multimediacommscontroller/mmccamrpayloadformat/tsrc/ut_amrpayloadformat/src/UT_CAmrPayloadFormatRead.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // ADD sentence "friend class UT_CAmrPayloadFormatRead" to AmrPayloadFormatRead.h
       
    21 // 
       
    22 
       
    23 
       
    24 //  CLASS HEADER
       
    25 #include "UT_CAmrPayloadFormatRead.h"
       
    26 
       
    27 #include "MccRtpDataSink.h"
       
    28 #include "mccuids.hrh"
       
    29 #include "Mccdldatapath.h"
       
    30 #include "MccRtpDataSource.h"
       
    31 #include "mccresourcepool.h"
       
    32 #include "mccredpayloadread.h"
       
    33 #include "amrpayloaddecoder.h"
       
    34 
       
    35 //  EXTERNAL INCLUDES
       
    36 #include <e32base.h>
       
    37 #include <mmf/server/mmfvideoframebuffer.h>
       
    38 #include <digia/eunit/eunitmacros.h>
       
    39 
       
    40 
       
    41 #ifdef EUNIT_ALLOC_TEST_ON
       
    42     #include <digia/eunit/CEunitAllocTestCaseDecorator.h>   //for using EUNIT_ALLOC_TEST
       
    43 #endif
       
    44 
       
    45 //  INTERNAL INCLUDES
       
    46 #include "amrpayloadformatread.h"
       
    47 
       
    48 const TUid KRtpDataSource            =  { KImplUidRtpDataSource   }; 
       
    49 const TUid KRtpDataSink              =  { KImplUidRtpDataSink     };
       
    50 
       
    51  
       
    52 
       
    53 // CONSTRUCTION
       
    54 UT_CAmrPayloadFormatRead* UT_CAmrPayloadFormatRead::NewL( )
       
    55     {
       
    56     UT_CAmrPayloadFormatRead* self = UT_CAmrPayloadFormatRead::NewLC();
       
    57     CleanupStack::Pop();
       
    58 
       
    59     return self;
       
    60     }
       
    61 
       
    62 UT_CAmrPayloadFormatRead* UT_CAmrPayloadFormatRead::NewLC()
       
    63     {
       
    64     UT_CAmrPayloadFormatRead* self = new( ELeave ) UT_CAmrPayloadFormatRead();
       
    65     CleanupStack::PushL( self );
       
    66 
       
    67 	self->ConstructL(); 
       
    68 
       
    69     return self;
       
    70     }
       
    71 
       
    72 // Destructor (virtual by CBase)
       
    73 UT_CAmrPayloadFormatRead::~UT_CAmrPayloadFormatRead()
       
    74     {
       
    75     }
       
    76 
       
    77 // Default constructor
       
    78 UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead()
       
    79     {
       
    80     }
       
    81 
       
    82 // Second phase construct
       
    83 void UT_CAmrPayloadFormatRead::ConstructL()
       
    84     {
       
    85     // The ConstructL from the base class CEUnitTestSuiteClass must be called.
       
    86     // It generates the test case table.
       
    87     CEUnitTestSuiteClass::ConstructL();
       
    88     }
       
    89 
       
    90 //  METHODS
       
    91 void UT_CAmrPayloadFormatRead::SetupAL(  )
       
    92     { 
       
    93     SetupL();
       
    94     iAlloc = ETrue; 
       
    95     }
       
    96 
       
    97 
       
    98 void UT_CAmrPayloadFormatRead::SetupL(  )
       
    99     {
       
   100     iFourCC.Set( TFourCC( ' ','A','M','R' ) );
       
   101 
       
   102     iAlloc = EFalse; 
       
   103 
       
   104     iRtpDataSourceStub = MDataSource::NewSourceL( KRtpDataSource, KNullDesC8 );
       
   105     iMediaId = KUidMediaTypeAudio;
       
   106     MAsyncEventHandler* eventHandler = NULL;
       
   107     CMccResourcePool* mccresource = NULL;
       
   108     iDLDataPathStub = CMccDlDataPath::NewL( eventHandler, mccresource, iMediaId ); 
       
   109 
       
   110     iRead = CAmrPayloadFormatRead::NewL( iRtpDataSourceStub );
       
   111     iBuf = CMMFDescriptorBuffer::NewL( 300 );
       
   112     iBuffi = CMMFDescriptorBuffer::NewL( 300 );
       
   113     iBuffi->Data().Append( _L("1234512345") ); 
       
   114     iConsumer = MDataSink::NewSinkL( KRtpDataSink, KNullDesC8 );
       
   115     
       
   116     iCodec.iFourCC.Set(TFourCC(' ','A','M','R') );
       
   117     iCodec.iBitrate = 12200;
       
   118     iCodec.iCodecMode = KAmrCodecModeOctetAlign;
       
   119     iCodec.iPtime = 160;
       
   120     iCodec.iMaxPtime = 200;
       
   121     iCodec.iPayloadType = 106;
       
   122     iCodec.iRedundancyCount = 0;
       
   123     iCodec.iEnableDTX = EFalse;
       
   124     //iCodec.iFwStream = ETrue;
       
   125     iCodec.iRedundantPayload = 0;
       
   126     iCodec.iHwFrameTime = 20;
       
   127     iCodec.iFrameSize = 32;
       
   128     iCodec.iAlgoUsed = 0;
       
   129     iCodec.iPayloadFormatEncoder = KImplUidAmrPayloadFormatEncode;
       
   130     iCodec.iPayloadFormatDecoder = KImplUidAmrPayloadFormatDecode;
       
   131     
       
   132   
       
   133     TMccCodecInfoBuffer buffer( iCodec );
       
   134     
       
   135     RDebug::Print( _L("- Algo used       = %d"), iCodec.iAlgoUsed ); // 0 jos redundanssi ei päällä, 2 jos haluat asettaa sen päälle
       
   136     RDebug::Print( _L("- Bitrate         = %d"), iCodec.iBitrate ); // 64000
       
   137     RDebug::Print( _L("- CNFrameSize     = %d"), iCodec.iCNFrameSize ); // 0
       
   138     RDebug::Print( _L("- CodecMode       = %d"), iCodec.iCodecMode ); // 3
       
   139     RDebug::Print( _L("- EnableDTX       = %d"), iCodec.iEnableDTX ); // 1
       
   140     RDebug::Print( _L("- FourCC          = %x"), iCodec.iFourCC ); // 31313747
       
   141     RDebug::Print( _L("- FrameSize       = %d"), iCodec.iFrameSize ); // 0
       
   142     RDebug::Print( _L("- HWFrameTime     = %d"), iCodec.iHwFrameTime ); // 20
       
   143     RDebug::Print( _L("- MaxPTime        = %d"), iCodec.iMaxPtime ); // 200
       
   144     RDebug::Print( _L("- PayloadType     = %d"), iCodec.iPayloadType ); // 106
       
   145     RDebug::Print( _L("- PTime           = %d"), iCodec.iPtime ); // 160
       
   146     RDebug::Print( _L("- RedundancyCount = %d"), iCodec.iRedundancyCount ); // 0 jos redundanssi ei päällä, 1 jos redundanssi päällä
       
   147     RDebug::Print( _L("- RedPayload      = %d"), iCodec.iRedundantPayload ); // 0 jos redundanssi ei päällä, 97-127 jos redundanssi päällä
       
   148   
       
   149     iRead->SetSourceDataTypeCode( iFourCC, KUidMediaTypeAudio );
       
   150     iRead->SourceThreadLogon( *this );
       
   151     
       
   152     iRead->ConfigurePayloadFormatL( buffer );
       
   153 
       
   154     iRead->NegotiateSourceL( *iDLDataPathStub );
       
   155     
       
   156     iRead->SourcePrimeL();
       
   157     iRead->SourcePlayL();
       
   158     } 
       
   159 
       
   160 
       
   161 void UT_CAmrPayloadFormatRead::SetupWbAL(  )
       
   162     { 
       
   163     SetupWbL();
       
   164     iAlloc = ETrue; 
       
   165     }
       
   166 
       
   167 
       
   168 void UT_CAmrPayloadFormatRead::SetupWbL(  )
       
   169     {
       
   170     iFourCC.Set( TFourCC( ' ','A','W','B' ) );
       
   171 
       
   172     iAlloc = EFalse; 
       
   173 
       
   174     iRtpDataSourceStub = MDataSource::NewSourceL( KRtpDataSource, KNullDesC8 );
       
   175     iMediaId = KUidMediaTypeAudio;
       
   176     MAsyncEventHandler* eventHandler = NULL;
       
   177     CMccResourcePool* mccresource = NULL;
       
   178     iDLDataPathStub = CMccDlDataPath::NewL( eventHandler, mccresource, iMediaId ); 
       
   179 
       
   180     iRead = CAmrPayloadFormatRead::NewL( iRtpDataSourceStub );
       
   181     iBuf = CMMFDescriptorBuffer::NewL( 300 );
       
   182     iBuffi = CMMFDescriptorBuffer::NewL( 300 );
       
   183     iBuffi->Data().Append( _L("1234512345") ); 
       
   184     iConsumer = MDataSink::NewSinkL( KRtpDataSink, KNullDesC8 );
       
   185     
       
   186     iCodec.iFourCC.Set(TFourCC(' ','A','W','B') );
       
   187     iCodec.iBitrate = 23850;
       
   188     iCodec.iCodecMode = KAmrCodecModeOctetAlign;
       
   189     iCodec.iPtime = 160;
       
   190     iCodec.iMaxPtime = 200;
       
   191     iCodec.iPayloadType = 106;
       
   192     iCodec.iRedundancyCount = 0;
       
   193     iCodec.iEnableDTX = EFalse;
       
   194     //iCodec.iFwStream = ETrue;
       
   195     iCodec.iRedundantPayload = 0;
       
   196     iCodec.iHwFrameTime = 20;
       
   197     iCodec.iFrameSize = 64;
       
   198     iCodec.iAlgoUsed = 0;
       
   199     iCodec.iPayloadFormatEncoder = KImplUidAmrPayloadFormatEncode;
       
   200     iCodec.iPayloadFormatDecoder = KImplUidAmrPayloadFormatDecode;
       
   201     
       
   202   
       
   203     TMccCodecInfoBuffer buffer( iCodec );
       
   204     
       
   205     RDebug::Print( _L("- Algo used       = %d"), iCodec.iAlgoUsed ); // 0 jos redundanssi ei päällä, 2 jos haluat asettaa sen päälle
       
   206     RDebug::Print( _L("- Bitrate         = %d"), iCodec.iBitrate ); // 64000
       
   207     RDebug::Print( _L("- CNFrameSize     = %d"), iCodec.iCNFrameSize ); // 0
       
   208     RDebug::Print( _L("- CodecMode       = %d"), iCodec.iCodecMode ); // 3
       
   209     RDebug::Print( _L("- EnableDTX       = %d"), iCodec.iEnableDTX ); // 1
       
   210     RDebug::Print( _L("- FourCC          = %x"), iCodec.iFourCC ); // 31313747
       
   211     RDebug::Print( _L("- FrameSize       = %d"), iCodec.iFrameSize ); // 0
       
   212     RDebug::Print( _L("- HWFrameTime     = %d"), iCodec.iHwFrameTime ); // 20
       
   213     RDebug::Print( _L("- MaxPTime        = %d"), iCodec.iMaxPtime ); // 200
       
   214     RDebug::Print( _L("- PayloadType     = %d"), iCodec.iPayloadType ); // 106
       
   215     RDebug::Print( _L("- PTime           = %d"), iCodec.iPtime ); // 160
       
   216     RDebug::Print( _L("- RedundancyCount = %d"), iCodec.iRedundancyCount ); // 0 jos redundanssi ei päällä, 1 jos redundanssi päällä
       
   217     RDebug::Print( _L("- RedPayload      = %d"), iCodec.iRedundantPayload ); // 0 jos redundanssi ei päällä, 97-127 jos redundanssi päällä
       
   218   
       
   219     iRead->SetSourceDataTypeCode( iFourCC, KUidMediaTypeAudio );
       
   220     iRead->SourceThreadLogon( *this );
       
   221     
       
   222     iRead->ConfigurePayloadFormatL( buffer );
       
   223 
       
   224     iRead->NegotiateSourceL( *iDLDataPathStub );
       
   225     
       
   226     iRead->SourcePrimeL();
       
   227     iRead->SourcePlayL();
       
   228     } 
       
   229 
       
   230 
       
   231 void UT_CAmrPayloadFormatRead::Teardown(  )
       
   232     {
       
   233 
       
   234     delete iBuffi;
       
   235     delete iDLDataPathStub;   
       
   236     delete iRtpDataSourceStub;
       
   237     delete iRead; 
       
   238     delete iBuf;  
       
   239     delete iConsumer;
       
   240     delete iFrameData;
       
   241     iFrameData = NULL;
       
   242     REComSession::FinalClose();
       
   243     }
       
   244 
       
   245 // HELPERS
       
   246 
       
   247 void UT_CAmrPayloadFormatRead::CreateFramesL( TInt aNumFrames, TBool aOkData )
       
   248     {
       
   249     iRead->iNumOfFrames = aNumFrames;
       
   250     iRead->iCurrentFrame = 0;
       
   251     __ASSERT_ALWAYS( iRead->iPayloadDecoder, User::Leave( KErrNotReady ) );
       
   252     for ( TInt i = 0; i < aNumFrames; i++ )
       
   253         {
       
   254         // Add some damaged frames
       
   255         TAmrFrame frame;
       
   256         if ( aOkData )
       
   257             {
       
   258             if ( !iFrameData )
       
   259                 {
       
   260                 iFrameData = HBufC8::NewL( 300 );
       
   261                 iFrameData->Des().Append( _L8("ð¼¼¼¼¼¼¼<‘(˜Èž\x01À‰å/áPv\x14€") );
       
   262                 iFrameData->Des().SetLength( iFrameData->Des().MaxLength() );
       
   263                 }
       
   264             frame.iFrameType = EAmrFrame12_2;
       
   265             frame.iFrameQualityInd = 1;
       
   266             frame.iFrameData = const_cast<TUint8*>( iFrameData->Des().Ptr() );
       
   267             }
       
   268         else
       
   269             {
       
   270             frame.iFrameType = EAmrFrameNoData;
       
   271             frame.iFrameQualityInd = 0;
       
   272             }
       
   273         iRead->iPayloadDecoder->iFrames[ i ] = frame;
       
   274         }
       
   275     }
       
   276 
       
   277 // TEST FUNCTIONS
       
   278 
       
   279 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_CancelDlRequestL(  )
       
   280     {
       
   281     EUNIT_ASSERT_NO_LEAVE( iRead->CancelDlRequest() );
       
   282     delete iRead->iFrameBufferOne;
       
   283     iRead->iFrameBufferOne = NULL;
       
   284     EUNIT_ASSERT_NO_LEAVE( iRead->CancelDlRequest() );
       
   285     }
       
   286 
       
   287 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_SendDataToSinkLL(  )
       
   288     {
       
   289     if ( !iAlloc )
       
   290         {       
       
   291         EUNIT_ASSERT_NO_LEAVE( iRead->FillBufferL( iBuffi, iDLDataPathStub, iMediaId ) );
       
   292         EUNIT_ASSERT_NO_LEAVE( iRead->SendDataToSinkL() );
       
   293         EUNIT_ASSERT_NO_LEAVE( iRead->FillBufferL( iBuffi, iDLDataPathStub, iMediaId ) );
       
   294         EUNIT_ASSERT_NO_LEAVE( iRead->SendDataToSinkL() );
       
   295         
       
   296         iRead->iBufferToReadExists = ETrue;
       
   297         iRead->iFrameBufferOne->SetLastBuffer( ETrue );
       
   298         EUNIT_ASSERT_NO_LEAVE( iRead->SendDataToSinkL() );
       
   299         iRead->iBufferToReadExists = ETrue;
       
   300         iRead->iFrameBufferOne->SetLastBuffer( ETrue );
       
   301         EUNIT_ASSERT_NO_LEAVE( iRead->SendDataToSinkL() );
       
   302         }        
       
   303     else
       
   304         {
       
   305         EUNIT_ASSERT_NO_LEAVE( iRead->FillBufferL( iBuffi, iDLDataPathStub, iMediaId ) );
       
   306         EUNIT_ASSERT_NO_LEAVE( iRead->SendDataToSinkL() );       
       
   307         } 
       
   308     }
       
   309 
       
   310 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_FillSinkBufferL(  )
       
   311     {
       
   312     if ( !iAlloc )
       
   313         {
       
   314         EUNIT_ASSERT_NO_LEAVE( iRead->FillSinkBufferL() );
       
   315         iRead->iBufferToReadExists = 1;
       
   316         EUNIT_ASSERT_NO_LEAVE( iRead->FillSinkBufferL() );  
       
   317         iRead->iCurrentBuffer = CAmrPayloadFormatRead::EBufferTwo;
       
   318         
       
   319         // No data
       
   320         iRead->iFrameBufferTwo->Data().SetLength( 0 );  
       
   321         EUNIT_ASSERT_NO_LEAVE( iRead->FillSinkBufferL() );  
       
   322         EUNIT_ASSERT( iRead->iStateMachine->CurrentState() == EDecodeIdle );
       
   323         
       
   324         // Some data to forward
       
   325         iRead->iBufferToRead = iBuf;
       
   326         iRead->iFrameBufferTwo->Data().SetLength( 1 );  
       
   327         CreateFramesL( 1, ETrue );
       
   328         EUNIT_ASSERT_NO_LEAVE( iRead->FillSinkBufferL() );
       
   329         }        
       
   330     else
       
   331         {
       
   332         EUNIT_ASSERT_NO_LEAVE( iRead->FillSinkBufferL() );
       
   333         
       
   334         } 
       
   335     }
       
   336 
       
   337 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_FillSourceBufferLL(  )
       
   338     {
       
   339     EUNIT_ASSERT_NO_LEAVE( iRead->FillSourceBufferL() );
       
   340     }
       
   341 
       
   342 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_StreamsL(  )
       
   343     {
       
   344     TUid uid = {0x101F7D07};
       
   345     if ( !iAlloc )
       
   346         {
       
   347         EUNIT_ASSERT_EQUALS( iRead->Streams( KUidMediaTypeAudio ), 1 );
       
   348         EUNIT_ASSERT_EQUALS( iRead->Streams( KUidMediaTypeVideo ), 0 );
       
   349         EUNIT_ASSERT_EQUALS( iRead->Streams( KUidMediaTypeMidi ), 0 );
       
   350         EUNIT_ASSERT_EQUALS( iRead->Streams( uid ), 0 );
       
   351         
       
   352         }
       
   353         
       
   354     else
       
   355         {
       
   356         EUNIT_ASSERT_EQUALS( iRead->Streams( KUidMediaTypeAudio ), 1 );
       
   357         EUNIT_ASSERT_EQUALS( iRead->Streams( KUidMediaTypeVideo ), 0 );
       
   358         
       
   359         }
       
   360 
       
   361     }
       
   362 
       
   363 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_FrameTimeIntervalL(  )
       
   364     {
       
   365     
       
   366     if ( !iAlloc )
       
   367         {
       
   368         RDebug::Print( _L("**FrameInterval = %d"), iRead->FrameTimeInterval( KUidMediaTypeAudio ).Int64() );
       
   369         EUNIT_ASSERT_EQUALS( iRead->FrameTimeInterval( KUidMediaTypeAudio ).Int64(), 20 );
       
   370         EUNIT_ASSERT_EQUALS( iRead->FrameTimeInterval( KUidMediaTypeVideo ).Int64(), 0 );
       
   371         
       
   372         }
       
   373         
       
   374     else
       
   375         {
       
   376         EUNIT_ASSERT_NO_LEAVE( iRead->FrameTimeInterval( KUidMediaTypeAudio ) );
       
   377         EUNIT_ASSERT_NO_LEAVE( iRead->FrameTimeInterval( KUidMediaTypeVideo ) );
       
   378         
       
   379         }
       
   380 
       
   381     }
       
   382 
       
   383 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_DurationL(  )
       
   384     {
       
   385     if ( !iAlloc )
       
   386         {
       
   387         /*
       
   388         EUNIT_ASSERT_EQUALS( iRead->Duration( KUidMediaTypeAudio ).Int64(), 1000000000 );
       
   389         EUNIT_ASSERT_EQUALS( iRead->Duration( KUidMediaTypeMidi ).Int64(), 1000000000 );
       
   390         */
       
   391         EUNIT_ASSERT_EQUALS( iRead->Duration( KUidMediaTypeMidi ).Int64(), 0 );
       
   392         
       
   393         }
       
   394         
       
   395     else
       
   396         {
       
   397         EUNIT_ASSERT_NO_LEAVE( iRead->Duration( KUidMediaTypeAudio ) );
       
   398         
       
   399         }
       
   400 
       
   401     }
       
   402 
       
   403 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_NumChannelsL(  )
       
   404     {
       
   405     if ( !iAlloc )
       
   406         {
       
   407         EUNIT_ASSERT_EQUALS( iRead->NumChannels( ), KMono );
       
   408         
       
   409         }
       
   410         
       
   411     else
       
   412         {
       
   413         EUNIT_ASSERT_NO_LEAVE( iRead->NumChannels( ) );
       
   414         
       
   415         }
       
   416     }
       
   417 
       
   418 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_SampleRateL(  )
       
   419     {
       
   420     
       
   421     if ( !iAlloc )
       
   422         {
       
   423         EUNIT_ASSERT_EQUALS( iRead->SampleRate(), iRead->iSamplingRate );
       
   424         
       
   425         }
       
   426         
       
   427     else
       
   428         {
       
   429         EUNIT_ASSERT_NO_LEAVE( iRead->SampleRate() );
       
   430         
       
   431         }
       
   432     }
       
   433 
       
   434 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_SetSampleRateL(  )
       
   435     {
       
   436     TUint sample(0);
       
   437     if ( !iAlloc )
       
   438         {
       
   439         sample = iRead->SampleRate(); // 8000
       
   440         EUNIT_ASSERT_EQUALS( iRead->SetSampleRate( sample ), KErrNone );
       
   441         EUNIT_ASSERT_EQUALS( iRead->SetSampleRate( sample + 1 ), KErrNotSupported );
       
   442         EUNIT_ASSERT_EQUALS( iRead->SetSampleRate( sample - 8000 ), KErrNotSupported );
       
   443         EUNIT_ASSERT_EQUALS( iRead->SetSampleRate( 8000 ), KErrNone );
       
   444         EUNIT_ASSERT_EQUALS( iRead->SetSampleRate( 16000 ), KErrNotSupported );
       
   445         
       
   446         }
       
   447         
       
   448     else
       
   449         {
       
   450         EUNIT_ASSERT_NO_LEAVE( iRead->SetSampleRate( sample ) );
       
   451         EUNIT_ASSERT_NO_LEAVE( iRead->SetSampleRate( sample + 1 ) );
       
   452         
       
   453         }
       
   454     }
       
   455 
       
   456 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_SetSampleRateWbL(  )
       
   457     {
       
   458     TUint sample(0);
       
   459     if ( !iAlloc )
       
   460         {
       
   461         sample = iRead->SampleRate(); // 16000
       
   462         EUNIT_ASSERT_EQUALS( iRead->SetSampleRate( sample ), KErrNone );
       
   463         EUNIT_ASSERT_EQUALS( iRead->SetSampleRate( sample + 1 ), KErrNotSupported );
       
   464         EUNIT_ASSERT_EQUALS( iRead->SetSampleRate( sample - 8000 ), KErrNotSupported );
       
   465         EUNIT_ASSERT_EQUALS( iRead->SetSampleRate( 8000 ), KErrNotSupported );
       
   466         EUNIT_ASSERT_EQUALS( iRead->SetSampleRate( 16000 ), KErrNone );
       
   467         
       
   468         }
       
   469         
       
   470     else
       
   471         {
       
   472         EUNIT_ASSERT_NO_LEAVE( iRead->SetSampleRate( sample ) );
       
   473         EUNIT_ASSERT_NO_LEAVE( iRead->SetSampleRate( sample + 1 ) );
       
   474         
       
   475         }
       
   476     }
       
   477 
       
   478 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_FillBufferLL(  )
       
   479     {
       
   480     if ( !iAlloc )
       
   481         {
       
   482         iRead->iCurrentBuffer = iRead->EBufferOne;
       
   483         EUNIT_ASSERT_NO_LEAVE( iRead->FillBufferL( iBuffi, iDLDataPathStub, KUidMediaTypeAudio ) );
       
   484         
       
   485         EUNIT_ASSERT_LEAVE( iRead->FillBufferL( iBuffi, iDLDataPathStub, KUidMediaTypeVideo ) ); // KErrNotSupported
       
   486         
       
   487         iRead->iCurrentBuffer = iRead->EBufferTwo;
       
   488         EUNIT_ASSERT_NO_LEAVE( iRead->FillBufferL( iBuffi, iDLDataPathStub, KUidMediaTypeAudio ) );
       
   489         
       
   490         EUNIT_ASSERT_LEAVE( iRead->FillBufferL( NULL, iDLDataPathStub, KUidMediaTypeAudio ) );
       
   491         }        
       
   492     else
       
   493         {
       
   494         EUNIT_ASSERT_LEAVE( iRead->FillBufferL( iBuffi, iDLDataPathStub, KUidMediaTypeMidi ) );    
       
   495         }
       
   496     }
       
   497 
       
   498 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_SourcePrimeLL(  ) 
       
   499     {
       
   500     if ( !iAlloc )
       
   501         {
       
   502         
       
   503         EUNIT_ASSERT_NO_LEAVE( iRead->SourcePrimeL() );
       
   504         
       
   505         }
       
   506         
       
   507     else
       
   508         {
       
   509         EUNIT_ASSERT_NO_LEAVE( iRead->SourcePrimeL() );
       
   510         
       
   511         }
       
   512     }
       
   513 
       
   514 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_SourcePlayLL(  )
       
   515     {
       
   516     if ( !iAlloc )
       
   517         {
       
   518         EUNIT_ASSERT_NO_LEAVE( iRead->SourcePlayL() );
       
   519         }
       
   520         
       
   521     else
       
   522         {
       
   523         EUNIT_ASSERT_NO_LEAVE( iRead->SourcePlayL() );
       
   524         }
       
   525     
       
   526     }
       
   527 
       
   528 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_SourcePauseLL(  )
       
   529     {
       
   530     if ( !iAlloc )
       
   531         {
       
   532         iRead->SourcePlayL();
       
   533         EUNIT_ASSERT_NO_LEAVE( iRead->SourcePauseL() );
       
   534         }
       
   535         
       
   536     else
       
   537         {
       
   538         EUNIT_ASSERT_NO_LEAVE( iRead->SourcePauseL() );
       
   539         }
       
   540     }
       
   541 
       
   542 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_SourceStopLL(  )
       
   543     {
       
   544     if ( !iAlloc )
       
   545         {
       
   546         iRead->SourcePlayL();
       
   547         EUNIT_ASSERT_NO_LEAVE( iRead->SourceStopL() );
       
   548         
       
   549         }
       
   550         
       
   551     else
       
   552         {
       
   553         EUNIT_ASSERT_NO_LEAVE( iRead->SourceStopL() );
       
   554         
       
   555         }
       
   556     }
       
   557 
       
   558 
       
   559 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_CreateSourceBufferLL(  )
       
   560     {
       
   561     TBool refO( ETrue );
       
   562     TBool refV( EFalse );
       
   563     if ( !iAlloc )
       
   564         
       
   565         {
       
   566         EUNIT_ASSERT_NO_LEAVE( iRead->CreateSourceBufferL( KUidMediaTypeAudio, refO ) );
       
   567         EUNIT_ASSERT_NO_LEAVE( iRead->CreateSourceBufferL( KUidMediaTypeAudio, refV ) );
       
   568         EUNIT_ASSERT_SPECIFIC_LEAVE( iRead->CreateSourceBufferL( KUidMediaTypeVideo, refO ), KErrNotSupported );
       
   569         EUNIT_ASSERT_SPECIFIC_LEAVE( iRead->CreateSourceBufferL( KUidMediaTypeVideo, refV ), KErrNotSupported );
       
   570         EUNIT_ASSERT_SPECIFIC_LEAVE( iRead->CreateSourceBufferL( KUidMediaTypeMidi, refO ), KErrNotSupported );
       
   571         
       
   572         }
       
   573         
       
   574     else
       
   575         {
       
   576         EUNIT_ASSERT_NO_LEAVE( iRead->CreateSourceBufferL( KUidMediaTypeAudio, refO ) );
       
   577         EUNIT_ASSERT_SPECIFIC_LEAVE( iRead->CreateSourceBufferL( KUidMediaTypeVideo, refO ), KErrNotSupported );
       
   578         
       
   579         }
       
   580     }
       
   581 
       
   582 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_CreateSourceBufferL_1L(  )
       
   583     {
       
   584     TBool refO( ETrue );
       
   585     TBool refV( EFalse );
       
   586     if ( !iAlloc )
       
   587         {
       
   588         EUNIT_ASSERT_NO_LEAVE( iRead->CreateSourceBufferL( KUidMediaTypeAudio, *iBuffi, refO ) );
       
   589         EUNIT_ASSERT_NO_LEAVE( iRead->CreateSourceBufferL( KUidMediaTypeAudio, *iBuffi, refV ) );
       
   590         EUNIT_ASSERT_SPECIFIC_LEAVE( iRead->CreateSourceBufferL( KUidMediaTypeVideo, *iBuffi, refO ), KErrNotSupported );
       
   591         
       
   592         
       
   593         }
       
   594         
       
   595     else
       
   596         {
       
   597         EUNIT_ASSERT_NO_LEAVE( iRead->CreateSourceBufferL( KUidMediaTypeAudio, *iBuffi, refO ) );
       
   598         EUNIT_ASSERT_NO_LEAVE( iRead->CreateSourceBufferL( KUidMediaTypeAudio, *iBuffi, refV ) );
       
   599         EUNIT_ASSERT_SPECIFIC_LEAVE( iRead->CreateSourceBufferL( KUidMediaTypeVideo, *iBuffi, refO ), KErrNotSupported );
       
   600         
       
   601         }
       
   602         
       
   603     }
       
   604 
       
   605 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_SourceDataTypeCodeL(  )
       
   606     {
       
   607     if ( !iAlloc )
       
   608         {
       
   609         EUNIT_ASSERT_EQUALS( iRead->SourceDataTypeCode( KUidMediaTypeAudio ), iFourCC );
       
   610         EUNIT_ASSERT_EQUALS( iRead->SourceDataTypeCode( KUidMediaTypeVideo ), TFourCC( ) );
       
   611         
       
   612         }
       
   613     
       
   614     else 
       
   615         {
       
   616         EUNIT_ASSERT_EQUALS( iRead->SourceDataTypeCode( KUidMediaTypeAudio ), iFourCC );
       
   617         EUNIT_ASSERT_EQUALS( iRead->SourceDataTypeCode( KUidMediaTypeVideo ), TFourCC( ) );
       
   618         
       
   619         }
       
   620      
       
   621     }
       
   622 
       
   623 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_SetSourceDataTypeCodeL(  )
       
   624     {
       
   625     if ( !iAlloc )
       
   626         {
       
   627         EUNIT_ASSERT_EQUALS( iRead->SetSourceDataTypeCode( iFourCC, KUidMediaTypeAudio ), KErrNone );
       
   628         EUNIT_ASSERT_EQUALS( iRead->SetSourceDataTypeCode( iFourCC, KUidMediaTypeVideo ), KErrNotSupported );
       
   629             
       
   630         }
       
   631     
       
   632     else
       
   633         {
       
   634         EUNIT_ASSERT_NO_LEAVE( iRead->SetSourceDataTypeCode( iFourCC, KUidMediaTypeAudio ) );
       
   635         EUNIT_ASSERT_NO_LEAVE( iRead->SetSourceDataTypeCode( iFourCC, KUidMediaTypeVideo ) );
       
   636         
       
   637         }
       
   638     }
       
   639 
       
   640 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_SourceThreadLogonL(  )
       
   641     {
       
   642     if ( !iAlloc )
       
   643         {
       
   644         EUNIT_ASSERT_EQUALS( iRead->SourceThreadLogon( *aEventH ), KErrNone );
       
   645             
       
   646         }
       
   647     
       
   648     else
       
   649         {
       
   650         EUNIT_ASSERT_NO_LEAVE( iRead->SourceThreadLogon( *aEventH ) );
       
   651         
       
   652         }
       
   653     }
       
   654 
       
   655 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_SourceThreadLogoffL(  )
       
   656     {
       
   657     if ( !iAlloc )
       
   658         {
       
   659         EUNIT_ASSERT_NO_LEAVE( iRead->SourceThreadLogoff( ) );
       
   660             
       
   661         }
       
   662     
       
   663     else
       
   664         {
       
   665         EUNIT_ASSERT_NO_LEAVE( iRead->SourceThreadLogoff( ) );
       
   666         
       
   667         }
       
   668     }
       
   669 
       
   670 
       
   671 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_NegotiateSourceLL(  )
       
   672     {
       
   673     if ( !iAlloc )
       
   674         {
       
   675         EUNIT_ASSERT_NO_LEAVE( iRead->NegotiateSourceL( *iDLDataPathStub ) );   
       
   676         }  
       
   677     else
       
   678         {
       
   679         EUNIT_ASSERT_NO_LEAVE( iRead->NegotiateSourceL( *iDLDataPathStub ) );      
       
   680         }
       
   681     }
       
   682 
       
   683 
       
   684 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_BufferFilledLL(  )
       
   685     {
       
   686     TRtpRecvHeader test;
       
   687     test.iMarker = 1;
       
   688     test.iPadding = 1;
       
   689     
       
   690     if ( !iAlloc )
       
   691         {
       
   692         CMMFDataBuffer* buffi = CMMFDataBuffer::NewL( 200 );      
       
   693         CMMFBuffer* buf = buffi; 
       
   694         CleanupStack::PushL( buf );
       
   695         iRtpDataSourceStub->FillBufferL( buf, iConsumer, KUidMediaTypeAudio );
       
   696         iRead->DataBufferFilledL( iRead->iSourceBuffer, test );
       
   697         CleanupStack::PopAndDestroy( buf );
       
   698         
       
   699         // NULL buffer
       
   700         EUNIT_ASSERT_SPECIFIC_LEAVE( iRead->DataBufferFilledL( NULL, test ), KErrArgument );
       
   701         
       
   702         // Wrong buffer type
       
   703         CMMFYUVBuffer* yuvBuf = CMMFYUVBuffer::NewL();  
       
   704         CleanupStack::PushL( yuvBuf ); 
       
   705         EUNIT_ASSERT_SPECIFIC_LEAVE( iRead->DataBufferFilledL( yuvBuf, test ), KErrNotSupported );
       
   706         CleanupStack::PopAndDestroy( yuvBuf );
       
   707         
       
   708         // Wrong buffer   
       
   709         CMMFDataBuffer* buffi2 = CMMFDataBuffer::NewL( 200 );     
       
   710         CleanupStack::PushL( buffi2 ); 
       
   711         EUNIT_ASSERT_SPECIFIC_LEAVE( iRead->DataBufferFilledL( buffi2, test ), KErrArgument );
       
   712         CleanupStack::PopAndDestroy( buffi2 );
       
   713         
       
   714         // Some data
       
   715         iRead->iSourceBuffer->Data().Append( _L8("ð¼¼¼¼¼¼¼<‘(˜Èž\x01À‰å/áPv\x14€") );
       
   716         iRead->DataBufferFilledL( iRead->iSourceBuffer, test );
       
   717         }
       
   718     
       
   719     else
       
   720         {
       
   721         CMMFDataBuffer* buffi = CMMFDataBuffer::NewL( 200 );      
       
   722         CMMFBuffer* buf = buffi; 
       
   723         CleanupStack::PushL( buf );
       
   724         iRtpDataSourceStub->FillBufferL( buf, iConsumer, KUidMediaTypeAudio );
       
   725         iRead->DataBufferFilledL( iRead->iSourceBuffer, test );
       
   726         CleanupStack::PopAndDestroy( buf );
       
   727         
       
   728         }
       
   729     }
       
   730     
       
   731 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_ConfigurePayloadFormatLL(  )
       
   732     {   
       
   733     if ( !iAlloc )
       
   734         {
       
   735                 
       
   736         TMccCodecInfo codec;
       
   737         codec.iFourCC.Set(TFourCC(' ','A','M','R') );
       
   738         codec.iBitrate = 12200;
       
   739         codec.iCodecMode = KAmrCodecModeOctetAlign;
       
   740         codec.iPtime = 160;
       
   741         codec.iMaxPtime = 200;
       
   742         codec.iPayloadType = 106;
       
   743         codec.iRedundancyCount = 0;
       
   744         codec.iEnableDTX = EFalse;
       
   745         codec.iRedundantPayload = 0;
       
   746         codec.iHwFrameTime = 20;
       
   747         codec.iFrameSize = 32;
       
   748         codec.iAlgoUsed = 0;
       
   749         codec.iPayloadFormatEncoder = KImplUidAmrPayloadFormatEncode;
       
   750         codec.iPayloadFormatDecoder = KImplUidAmrPayloadFormatDecode;
       
   751         
       
   752         TMccCodecInfoBuffer buffer( codec );
       
   753         iRead->ConfigurePayloadFormatL( buffer );
       
   754 
       
   755         codec.iAlgoUsed = EGenRedUsed;
       
   756         codec.iRedundancyCount = 1;
       
   757         codec.iRedundantPayload = 99;
       
   758         
       
   759         buffer = codec; 
       
   760         CMccRtpDataSource* rtpDataSourceStub = static_cast<CMccRtpDataSource*>(MDataSource::NewSourceL( KRtpDataSource, KNullDesC8 ));
       
   761         CleanupStack::PushL( rtpDataSourceStub );
       
   762         CMccRedPayloadRead* redDecoder = CMccRedPayloadRead::NewL( rtpDataSourceStub );
       
   763         CleanupStack::PushL( redDecoder );
       
   764         CAmrPayloadFormatRead* read = CAmrPayloadFormatRead::NewL( redDecoder );
       
   765         CleanupStack::PushL( read );
       
   766         read->ConfigurePayloadFormatL( buffer );
       
   767         CleanupStack::PopAndDestroy( 3 ); 
       
   768         
       
   769         codec.iAlgoUsed = EAmrFecUsed;
       
   770         buffer = codec; 
       
   771         iRead->ConfigurePayloadFormatL( buffer );      
       
   772         
       
   773         // Wrong mode
       
   774         delete iRead->iPayloadDecoder;
       
   775         iRead->iPayloadDecoder = NULL;
       
   776         codec.iCodecMode = 999;
       
   777         buffer = codec; 
       
   778         EUNIT_ASSERT_SPECIFIC_LEAVE( iRead->ConfigurePayloadFormatL( buffer ), KErrArgument );
       
   779         
       
   780          // Test different mode and no red
       
   781         delete iRead->iPayloadDecoder;
       
   782         iRead->iPayloadDecoder = NULL;
       
   783         codec.iCodecMode = KAmrCodecModeBandwidthEfficient;
       
   784         codec.iMaxRed = 2;
       
   785         codec.iRedundancyCount = 0;
       
   786         buffer = codec; 
       
   787         iRead->ConfigurePayloadFormatL( buffer );
       
   788         
       
   789         // Test source buffer created by source, incorrect type
       
   790         static_cast<CMccRtpDataSource*>( iRtpDataSourceStub )->iCanCreateSourceBuffer = ETrue;
       
   791         static_cast<CMccRtpDataSource*>( iRtpDataSourceStub )->iWrongBufferType = ETrue;
       
   792 
       
   793         TRAPD( err, iRead->ConfigurePayloadFormatL( buffer ) )
       
   794         if ( err == KErrNoMemory )
       
   795         	{
       
   796         	User::Leave( err );
       
   797         	}
       
   798         EUNIT_ASSERT_EQUALS( KErrNotSupported, err );
       
   799 
       
   800         // Correct type
       
   801         static_cast<CMccRtpDataSource*>( iRtpDataSourceStub )->iWrongBufferType = EFalse;
       
   802         iRead->ConfigurePayloadFormatL( buffer );
       
   803         
       
   804         // Ownership stays in source
       
   805         iRead->iSourceBuffer = NULL; // Source will delete the buffer
       
   806         static_cast<CMccRtpDataSource*>( iRtpDataSourceStub )->iReference = ETrue;
       
   807         iRead->ConfigurePayloadFormatL( buffer );
       
   808         
       
   809         // Incorrect type and ownership in source
       
   810         iRead->iSourceBuffer = NULL; // Source will delete the buffer
       
   811         static_cast<CMccRtpDataSource*>( iRtpDataSourceStub )->iWrongBufferType = ETrue;
       
   812 
       
   813         TRAPD( err2, iRead->ConfigurePayloadFormatL( buffer ) )
       
   814         if ( err2 == KErrNoMemory )
       
   815         	{
       
   816         	User::Leave( err2 );
       
   817         	}
       
   818         EUNIT_ASSERT_EQUALS( KErrNotSupported, err2 );
       
   819         
       
   820         // No hw frametime
       
   821         static_cast<CMccRtpDataSource*>( iRtpDataSourceStub )->iCanCreateSourceBuffer = EFalse;
       
   822         codec.iHwFrameTime = 0;
       
   823         buffer = codec; 
       
   824 
       
   825         TRAPD( err3, iRead->ConfigurePayloadFormatL( buffer ) )
       
   826         if ( err3 == KErrNoMemory )
       
   827         	{
       
   828         	User::Leave( err3 );
       
   829         	}
       
   830         EUNIT_ASSERT_EQUALS( KErrArgument, err3 );
       
   831 
       
   832 
       
   833         
       
   834         // Update
       
   835         codec.iIsUpdate = ETrue;
       
   836         buffer = codec; 
       
   837         iRead->ConfigurePayloadFormatL( buffer );
       
   838         
       
   839         // Maxptime changed update
       
   840         codec.iMaxPtime = 400;
       
   841         buffer = codec;
       
   842         iRead->ConfigurePayloadFormatL( buffer );
       
   843         
       
   844         // Fec
       
   845         codec.iMaxPtime = 200;
       
   846         codec.iAlgoUsed = EAmrFecUsed;
       
   847         buffer = codec;
       
   848         iRead->ConfigurePayloadFormatL( buffer );
       
   849         }
       
   850     
       
   851     else
       
   852         {
       
   853         EUNIT_ASSERT( ETrue );
       
   854         }          
       
   855     }
       
   856  
       
   857 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_ConfigurePayloadFormatLWbL(  )
       
   858     {   
       
   859     if ( !iAlloc )
       
   860         {
       
   861                 
       
   862         TMccCodecInfo codec;
       
   863         codec.iFourCC.Set(TFourCC(' ','A','W','B') );
       
   864         codec.iBitrate = 23850;
       
   865         codec.iCodecMode = KAmrCodecModeOctetAlign;
       
   866         codec.iPtime = 160;
       
   867         codec.iMaxPtime = 200;
       
   868         codec.iPayloadType = 106;
       
   869         codec.iRedundancyCount = 0;
       
   870         codec.iEnableDTX = EFalse;
       
   871         codec.iRedundantPayload = 0;
       
   872         codec.iHwFrameTime = 20;
       
   873         codec.iFrameSize = 64;
       
   874         codec.iAlgoUsed = 0;
       
   875         codec.iPayloadFormatEncoder = KImplUidAmrPayloadFormatEncode;
       
   876         codec.iPayloadFormatDecoder = KImplUidAmrPayloadFormatDecode;
       
   877         
       
   878         TMccCodecInfoBuffer buffer( codec );
       
   879         iRead->ConfigurePayloadFormatL( buffer );
       
   880 
       
   881         codec.iAlgoUsed = EGenRedUsed;
       
   882         codec.iRedundancyCount = 1;
       
   883         codec.iRedundantPayload = 99;
       
   884         
       
   885         buffer = codec; 
       
   886         CMccRtpDataSource* rtpDataSourceStub = static_cast<CMccRtpDataSource*>(MDataSource::NewSourceL( KRtpDataSource, KNullDesC8 ));
       
   887         CleanupStack::PushL( rtpDataSourceStub );
       
   888         CMccRedPayloadRead* redDecoder = CMccRedPayloadRead::NewL( rtpDataSourceStub );
       
   889         CleanupStack::PushL( redDecoder );
       
   890         CAmrPayloadFormatRead* read = CAmrPayloadFormatRead::NewL( redDecoder );
       
   891         CleanupStack::PushL( read );
       
   892         read->ConfigurePayloadFormatL( buffer );
       
   893         CleanupStack::PopAndDestroy( 3 ); 
       
   894         
       
   895         codec.iAlgoUsed = EAmrFecUsed;
       
   896         buffer = codec; 
       
   897         iRead->ConfigurePayloadFormatL( buffer );      
       
   898         
       
   899         // Wrong mode
       
   900         delete iRead->iPayloadDecoder;
       
   901         iRead->iPayloadDecoder = NULL;
       
   902         codec.iCodecMode = 999;
       
   903         buffer = codec; 
       
   904         EUNIT_ASSERT_SPECIFIC_LEAVE( iRead->ConfigurePayloadFormatL( buffer ), KErrArgument );
       
   905         
       
   906          // Test different mode and no red
       
   907         delete iRead->iPayloadDecoder;
       
   908         iRead->iPayloadDecoder = NULL;
       
   909         codec.iCodecMode = KAmrCodecModeBandwidthEfficient;
       
   910         codec.iMaxRed = 2;
       
   911         codec.iRedundancyCount = 0;
       
   912         buffer = codec; 
       
   913         iRead->ConfigurePayloadFormatL( buffer );
       
   914         
       
   915         // Test source buffer created by source, incorrect type
       
   916         static_cast<CMccRtpDataSource*>( iRtpDataSourceStub )->iCanCreateSourceBuffer = ETrue;
       
   917         static_cast<CMccRtpDataSource*>( iRtpDataSourceStub )->iWrongBufferType = ETrue;
       
   918         
       
   919         TRAPD( err,iRead->ConfigurePayloadFormatL( buffer ) )
       
   920         if ( err == KErrNoMemory )
       
   921         	{
       
   922         	User::Leave( err );
       
   923         	}
       
   924         EUNIT_ASSERT_EQUALS( KErrNotSupported, err );
       
   925 
       
   926         // Correct type
       
   927         static_cast<CMccRtpDataSource*>( iRtpDataSourceStub )->iWrongBufferType = EFalse;
       
   928         iRead->ConfigurePayloadFormatL( buffer );
       
   929         
       
   930         // Ownership stays in source
       
   931         iRead->iSourceBuffer = NULL; // Source will delete the buffer
       
   932         static_cast<CMccRtpDataSource*>( iRtpDataSourceStub )->iReference = ETrue;
       
   933         iRead->ConfigurePayloadFormatL( buffer );
       
   934         
       
   935         // Incorrect type and ownership in source
       
   936         iRead->iSourceBuffer = NULL; // Source will delete the buffer
       
   937         static_cast<CMccRtpDataSource*>( iRtpDataSourceStub )->iWrongBufferType = ETrue;
       
   938         
       
   939         TRAPD(err2, iRead->ConfigurePayloadFormatL( buffer ))
       
   940         if ( err2 == KErrNoMemory )
       
   941         	{
       
   942         	User::Leave( err2 );
       
   943         	}
       
   944         EUNIT_ASSERT_EQUALS( KErrNotSupported,err2 );
       
   945         
       
   946         // No hw frametime
       
   947         static_cast<CMccRtpDataSource*>( iRtpDataSourceStub )->iCanCreateSourceBuffer = EFalse;
       
   948         codec.iHwFrameTime = 0;
       
   949         buffer = codec; 
       
   950         
       
   951         TRAPD(err3, iRead->ConfigurePayloadFormatL( buffer ))
       
   952         if ( err3 == KErrNoMemory )
       
   953         	{
       
   954         	User::Leave( err3 );
       
   955         	}
       
   956         EUNIT_ASSERT_EQUALS( KErrArgument,err3 );
       
   957         
       
   958         
       
   959         // Update
       
   960         codec.iIsUpdate = ETrue;
       
   961         buffer = codec; 
       
   962         iRead->ConfigurePayloadFormatL( buffer );
       
   963         
       
   964         // Maxptime changed update
       
   965         codec.iMaxPtime = 400;
       
   966         buffer = codec;
       
   967         iRead->ConfigurePayloadFormatL( buffer );
       
   968         
       
   969         // Fec
       
   970         codec.iMaxPtime = 200;
       
   971         codec.iAlgoUsed = EAmrFecUsed;
       
   972         buffer = codec;
       
   973         iRead->ConfigurePayloadFormatL( buffer );
       
   974         }
       
   975     
       
   976     else
       
   977         {
       
   978         EUNIT_ASSERT( ETrue );
       
   979         }          
       
   980     }
       
   981  
       
   982 
       
   983 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_ConvertModeToBitrate()
       
   984 {
       
   985     EUNIT_ASSERT_EQUALS( iRead->ConvertModeToBitrate( EAmrModeReqNone ), 0 );
       
   986     EUNIT_ASSERT_EQUALS( iRead->ConvertModeToBitrate( EAmrModeReq8 ), 0 );
       
   987     EUNIT_ASSERT_EQUALS( iRead->ConvertModeToBitrate( EAmrModeReq5 ), 7950 );
       
   988 }
       
   989 
       
   990 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_ConvertModeToBitrateWb()
       
   991 {
       
   992     EUNIT_ASSERT_EQUALS( iRead->ConvertModeToBitrate( EAmrModeReqNone ), 0 );
       
   993     EUNIT_ASSERT_EQUALS( iRead->ConvertModeToBitrate( EAmrModeReq8 ), 23850 );
       
   994     EUNIT_ASSERT_EQUALS( iRead->ConvertModeToBitrate( EAmrModeReq5 ), 18250 );
       
   995 }
       
   996 
       
   997 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_SendAmrEventToClient()
       
   998 {
       
   999     iRead->SendAmrEventToClient( EMccInternalRtpSinkError );
       
  1000 }
       
  1001 
       
  1002 // PRIVAT   
       
  1003 
       
  1004 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_DoReadL( )
       
  1005     {
       
  1006     TRtpRecvHeader test;
       
  1007     test.iPadding = 1;
       
  1008     test.iMarker = 1;
       
  1009      
       
  1010     iRead->DataBufferFilledL( iRead->iSourceBuffer/*iBuffi*/, test );
       
  1011     if ( !iAlloc )
       
  1012         {
       
  1013         // Null buffer
       
  1014         CMMFDescriptorBuffer* buf = iBuf;
       
  1015         iBuf = NULL;
       
  1016         EUNIT_ASSERT_EQUALS( iRead->DoRead( iBuf ), EFalse );
       
  1017         
       
  1018         // No frames
       
  1019         iBuf = buf;    
       
  1020         EUNIT_ASSERT_EQUALS( iRead->DoRead( iBuf ), EFalse );
       
  1021         
       
  1022         // Full buffer        
       
  1023         iBuf->SetStatus( EFull );   
       
  1024         EUNIT_ASSERT_EQUALS( iRead->DoRead( iBuf ), EFalse );
       
  1025         
       
  1026         // One frame, no real data
       
  1027         iBuf->SetStatus( EAvailable );
       
  1028         iRead->iBufferToRead = iBuf;
       
  1029         CreateFramesL( 1 );
       
  1030         EUNIT_ASSERT_EQUALS( iRead->DoRead( iBuf ), ETrue );
       
  1031         
       
  1032         // Two frames, first buffer
       
  1033         iBuf->SetStatus( EAvailable );
       
  1034         iRead->iBufferToRead = iBuf;
       
  1035         CreateFramesL( 2 );
       
  1036         EUNIT_ASSERT_EQUALS( iRead->DoRead( iBuf ), EFalse );
       
  1037         EUNIT_ASSERT_EQUALS( iRead->iCurrentFrame, 1 );
       
  1038         
       
  1039         // Second frame
       
  1040         iBuf->SetStatus( EAvailable );
       
  1041         iBuf->SetLastBuffer( ETrue );
       
  1042         EUNIT_ASSERT_EQUALS( iRead->DoRead( iBuf ), ETrue );
       
  1043         EUNIT_ASSERT( iBuf->Status() == EFull );
       
  1044         EUNIT_ASSERT_EQUALS( iRead->iCurrentFrame, 2 );
       
  1045         }
       
  1046     
       
  1047     else
       
  1048         {
       
  1049         EUNIT_ASSERT_NO_LEAVE( iRead->DoRead( iBuf ) );
       
  1050         }
       
  1051         
       
  1052     }
       
  1053 
       
  1054 
       
  1055 void UT_CAmrPayloadFormatRead::UT_CAmrPayloadFormatRead_SinkDataTypeCodeL( )
       
  1056     {
       
  1057     if ( !iAlloc )
       
  1058         {
       
  1059         EUNIT_ASSERT_NO_LEAVE( iRead->SinkDataTypeCode( KUidMediaTypeAudio ) );
       
  1060         EUNIT_ASSERT_NO_LEAVE( iRead->SinkDataTypeCode( KUidMediaTypeVideo ) );
       
  1061         }
       
  1062     else
       
  1063         {
       
  1064         EUNIT_ASSERT_NO_LEAVE( iRead->SinkDataTypeCode( KUidMediaTypeAudio ) );
       
  1065         }
       
  1066     }
       
  1067 
       
  1068 
       
  1069 //  TEST TABLE
       
  1070 
       
  1071 EUNIT_BEGIN_TEST_TABLE( 
       
  1072     UT_CAmrPayloadFormatRead,
       
  1073     "Add test suite description here.",
       
  1074     "UNIT" )
       
  1075 
       
  1076 EUNIT_TEST(
       
  1077     "CancelDlRequest - test ",
       
  1078     "CAmrPayloadFormatRead",
       
  1079     "CancelDlRequest",
       
  1080     "FUNCTIONALITY",
       
  1081     SetupL, UT_CAmrPayloadFormatRead_CancelDlRequestL, Teardown)
       
  1082 
       
  1083 EUNIT_TEST(
       
  1084     "SendDataToSinkL - test ",
       
  1085     "CAmrPayloadFormatRead",
       
  1086     "SendDataToSinkL",
       
  1087     "FUNCTIONALITY",
       
  1088     SetupL, UT_CAmrPayloadFormatRead_SendDataToSinkLL, Teardown)
       
  1089 
       
  1090 EUNIT_TEST(
       
  1091     "FillSinkBuffer - test ",
       
  1092     "CAmrPayloadFormatRead",
       
  1093     "FillSinkBuffer",
       
  1094     "FUNCTIONALITY",
       
  1095     SetupL, UT_CAmrPayloadFormatRead_FillSinkBufferL, Teardown)
       
  1096 
       
  1097 EUNIT_TEST(
       
  1098     "FillSourceBufferL - test ",
       
  1099     "CAmrPayloadFormatRead",
       
  1100     "FillSourceBufferL",
       
  1101     "FUNCTIONALITY",
       
  1102     SetupL, UT_CAmrPayloadFormatRead_FillSourceBufferLL, Teardown)
       
  1103 
       
  1104 EUNIT_TEST(
       
  1105     "Streams - test ",
       
  1106     "CAmrPayloadFormatRead",
       
  1107     "Streams",
       
  1108     "FUNCTIONALITY",
       
  1109     SetupL, UT_CAmrPayloadFormatRead_StreamsL, Teardown)
       
  1110 
       
  1111 EUNIT_TEST(
       
  1112     "FrameTimeInterval - test ",
       
  1113     "CAmrPayloadFormatRead",
       
  1114     "FrameTimeInterval",
       
  1115     "FUNCTIONALITY",
       
  1116     SetupL, UT_CAmrPayloadFormatRead_FrameTimeIntervalL, Teardown)
       
  1117 
       
  1118 EUNIT_TEST(
       
  1119     "Duration - test ",
       
  1120     "CAmrPayloadFormatRead",
       
  1121     "Duration",
       
  1122     "FUNCTIONALITY",
       
  1123     SetupL, UT_CAmrPayloadFormatRead_DurationL, Teardown)
       
  1124 
       
  1125 EUNIT_TEST(
       
  1126     "NumChannels - test ",
       
  1127     "CAmrPayloadFormatRead",
       
  1128     "NumChannels",
       
  1129     "FUNCTIONALITY",
       
  1130     SetupL, UT_CAmrPayloadFormatRead_NumChannelsL, Teardown)
       
  1131 
       
  1132 EUNIT_TEST(
       
  1133     "SampleRate - test ",
       
  1134     "CAmrPayloadFormatRead",
       
  1135     "SampleRate",
       
  1136     "FUNCTIONALITY",
       
  1137     SetupL, UT_CAmrPayloadFormatRead_SampleRateL, Teardown)
       
  1138 
       
  1139 EUNIT_TEST(
       
  1140     "SetSampleRate - test ",
       
  1141     "CAmrPayloadFormatRead",
       
  1142     "SetSampleRate",
       
  1143     "FUNCTIONALITY",
       
  1144     SetupL, UT_CAmrPayloadFormatRead_SetSampleRateL, Teardown)
       
  1145 
       
  1146 EUNIT_TEST(
       
  1147     "FillBufferL - test ",
       
  1148     "CAmrPayloadFormatRead",
       
  1149     "FillBufferL",
       
  1150     "FUNCTIONALITY",
       
  1151     SetupL, UT_CAmrPayloadFormatRead_FillBufferLL, Teardown)
       
  1152 
       
  1153 EUNIT_TEST(
       
  1154     "SourcePrimeL - test ",
       
  1155     "CAmrPayloadFormatRead",
       
  1156     "SourcePrimeL",
       
  1157     "FUNCTIONALITY",
       
  1158     SetupL, UT_CAmrPayloadFormatRead_SourcePrimeLL, Teardown)
       
  1159 
       
  1160 EUNIT_TEST(
       
  1161     "SourcePlayL - test ",
       
  1162     "CAmrPayloadFormatRead",
       
  1163     "SourcePlayL",
       
  1164     "FUNCTIONALITY",
       
  1165     SetupL, UT_CAmrPayloadFormatRead_SourcePlayLL, Teardown)
       
  1166 
       
  1167 EUNIT_TEST(
       
  1168     "SourcePauseL - test ",
       
  1169     "CAmrPayloadFormatRead",
       
  1170     "SourcePauseL",
       
  1171     "FUNCTIONALITY",
       
  1172     SetupL, UT_CAmrPayloadFormatRead_SourcePauseLL, Teardown)
       
  1173 
       
  1174 EUNIT_TEST(
       
  1175     "SourceStopL - test ",
       
  1176     "CAmrPayloadFormatRead",
       
  1177     "SourceStopL",
       
  1178     "FUNCTIONALITY",
       
  1179     SetupL, UT_CAmrPayloadFormatRead_SourceStopLL, Teardown)
       
  1180 
       
  1181 EUNIT_TEST(
       
  1182     "CreateSourceBufferL - test ",
       
  1183     "CAmrPayloadFormatRead",
       
  1184     "CreateSourceBufferL",
       
  1185     "FUNCTIONALITY",
       
  1186     SetupL, UT_CAmrPayloadFormatRead_CreateSourceBufferLL, Teardown)
       
  1187 
       
  1188 EUNIT_TEST(
       
  1189     "CreateSourceBufferL - test ",
       
  1190     "CAmrPayloadFormatRead",
       
  1191     "CreateSourceBufferL",
       
  1192     "FUNCTIONALITY",
       
  1193     SetupL, UT_CAmrPayloadFormatRead_CreateSourceBufferL_1L, Teardown)
       
  1194 
       
  1195 EUNIT_TEST(
       
  1196     "SourceDataTypeCode - test ",
       
  1197     "CAmrPayloadFormatRead",
       
  1198     "SourceDataTypeCode",
       
  1199     "FUNCTIONALITY",
       
  1200     SetupL, UT_CAmrPayloadFormatRead_SourceDataTypeCodeL, Teardown)
       
  1201 
       
  1202 EUNIT_TEST(
       
  1203     "SetSourceDataTypeCode - test ",
       
  1204     "CAmrPayloadFormatRead",
       
  1205     "SetSourceDataTypeCode",
       
  1206     "FUNCTIONALITY",
       
  1207     SetupL, UT_CAmrPayloadFormatRead_SetSourceDataTypeCodeL, Teardown)
       
  1208 
       
  1209 EUNIT_TEST(
       
  1210     "SourceThreadLogon - test ",
       
  1211     "CAmrPayloadFormatRead",
       
  1212     "SourceThreadLogon",
       
  1213     "FUNCTIONALITY",
       
  1214     SetupL, UT_CAmrPayloadFormatRead_SourceThreadLogonL, Teardown)
       
  1215 
       
  1216 EUNIT_TEST(
       
  1217     "SourceThreadLogoff - test ",
       
  1218     "CAmrPayloadFormatRead",
       
  1219     "SourceThreadLogoff",
       
  1220     "FUNCTIONALITY",
       
  1221     SetupL, UT_CAmrPayloadFormatRead_SourceThreadLogoffL, Teardown)
       
  1222 
       
  1223 EUNIT_TEST(
       
  1224     "NegotiateSourceL - test ",
       
  1225     "CAmrPayloadFormatRead",
       
  1226     "NegotiateSourceL",
       
  1227     "FUNCTIONALITY",
       
  1228     SetupL, UT_CAmrPayloadFormatRead_NegotiateSourceLL, Teardown)
       
  1229 
       
  1230 EUNIT_TEST(
       
  1231     "BufferFilledL - test ",
       
  1232     "CAmrPayloadFormatRead",
       
  1233     "BufferFilledL",
       
  1234     "FUNCTIONALITY",
       
  1235     SetupL, UT_CAmrPayloadFormatRead_BufferFilledLL, Teardown)
       
  1236 
       
  1237 EUNIT_TEST(
       
  1238     "ConfigurePayloadFormatL - test ",
       
  1239     "CAmrPayloadFormatRead",
       
  1240     "ConfigurePayloadFormatL",
       
  1241     "FUNCTIONALITY",
       
  1242     SetupL, UT_CAmrPayloadFormatRead_ConfigurePayloadFormatLL, Teardown)
       
  1243 
       
  1244 
       
  1245 EUNIT_TEST(
       
  1246     "DoRead - test ",
       
  1247     "CAmrPayloadFormatRead",
       
  1248     "DoRead",
       
  1249     "FUNCTIONALITY",
       
  1250     SetupL, UT_CAmrPayloadFormatRead_DoReadL, Teardown)
       
  1251 
       
  1252 EUNIT_TEST(
       
  1253     "SinkDataTypeCode - test ",
       
  1254     "CAmrPayloadFormatRead",
       
  1255     "SinkDataTypeCode",
       
  1256     "FUNCTIONALITY",
       
  1257     SetupL, UT_CAmrPayloadFormatRead_SinkDataTypeCodeL, Teardown)    
       
  1258 
       
  1259 EUNIT_TEST(
       
  1260     "ConvertModeToBitrate - test ",
       
  1261     "CAmrPayloadFormatRead",
       
  1262     "ConvertModeToBitrate",
       
  1263     "FUNCTIONALITY",
       
  1264     SetupL, UT_CAmrPayloadFormatRead_ConvertModeToBitrate, Teardown)    
       
  1265   
       
  1266 EUNIT_TEST(
       
  1267     "SendAmrEventToClient - test ",
       
  1268     "CAmrPayloadFormatRead",
       
  1269     "SendAmrEventToClient",
       
  1270     "FUNCTIONALITY",
       
  1271     SetupL, UT_CAmrPayloadFormatRead_SendAmrEventToClient, Teardown)    
       
  1272 
       
  1273 // Wide band tests
       
  1274 
       
  1275 EUNIT_TEST(
       
  1276     "CancelDlRequest - Wb test ",
       
  1277     "CAmrPayloadFormatRead",
       
  1278     "CancelDlRequest",
       
  1279     "FUNCTIONALITY",
       
  1280     SetupWbL, UT_CAmrPayloadFormatRead_CancelDlRequestL, Teardown)
       
  1281 
       
  1282 EUNIT_TEST(
       
  1283     "SendDataToSinkL - Wb test ",
       
  1284     "CAmrPayloadFormatRead",
       
  1285     "SendDataToSinkL",
       
  1286     "FUNCTIONALITY",
       
  1287     SetupWbL, UT_CAmrPayloadFormatRead_SendDataToSinkLL, Teardown)
       
  1288 
       
  1289 EUNIT_TEST(
       
  1290     "FillSinkBuffer - Wb test ",
       
  1291     "CAmrPayloadFormatRead",
       
  1292     "FillSinkBuffer",
       
  1293     "FUNCTIONALITY",
       
  1294     SetupWbL, UT_CAmrPayloadFormatRead_FillSinkBufferL, Teardown)
       
  1295 
       
  1296 EUNIT_TEST(
       
  1297     "FillSourceBufferL - Wb test ",
       
  1298     "CAmrPayloadFormatRead",
       
  1299     "FillSourceBufferL",
       
  1300     "FUNCTIONALITY",
       
  1301     SetupWbL, UT_CAmrPayloadFormatRead_FillSourceBufferLL, Teardown)
       
  1302 
       
  1303 EUNIT_TEST(
       
  1304     "Streams - Wb test ",
       
  1305     "CAmrPayloadFormatRead",
       
  1306     "Streams",
       
  1307     "FUNCTIONALITY",
       
  1308     SetupWbL, UT_CAmrPayloadFormatRead_StreamsL, Teardown)
       
  1309 
       
  1310 EUNIT_TEST(
       
  1311     "FrameTimeInterval - Wb test ",
       
  1312     "CAmrPayloadFormatRead",
       
  1313     "FrameTimeInterval",
       
  1314     "FUNCTIONALITY",
       
  1315     SetupWbL, UT_CAmrPayloadFormatRead_FrameTimeIntervalL, Teardown)
       
  1316 
       
  1317 EUNIT_TEST(
       
  1318     "Duration - Wb test ",
       
  1319     "CAmrPayloadFormatRead",
       
  1320     "Duration",
       
  1321     "FUNCTIONALITY",
       
  1322     SetupWbL, UT_CAmrPayloadFormatRead_DurationL, Teardown)
       
  1323 
       
  1324 EUNIT_TEST(
       
  1325     "NumChannels - Wb test ",
       
  1326     "CAmrPayloadFormatRead",
       
  1327     "NumChannels",
       
  1328     "FUNCTIONALITY",
       
  1329     SetupWbL, UT_CAmrPayloadFormatRead_NumChannelsL, Teardown)
       
  1330 
       
  1331 EUNIT_TEST(
       
  1332     "SampleRate - Wb test ",
       
  1333     "CAmrPayloadFormatRead",
       
  1334     "SampleRate",
       
  1335     "FUNCTIONALITY",
       
  1336     SetupWbL, UT_CAmrPayloadFormatRead_SampleRateL, Teardown)
       
  1337 
       
  1338 EUNIT_TEST(
       
  1339     "SetSampleRate - Wb test ",
       
  1340     "CAmrPayloadFormatRead",
       
  1341     "SetSampleRate",
       
  1342     "FUNCTIONALITY",
       
  1343     SetupWbL, UT_CAmrPayloadFormatRead_SetSampleRateWbL, Teardown)
       
  1344 
       
  1345 EUNIT_TEST(
       
  1346     "FillBufferL - Wb test ",
       
  1347     "CAmrPayloadFormatRead",
       
  1348     "FillBufferL",
       
  1349     "FUNCTIONALITY",
       
  1350     SetupWbL, UT_CAmrPayloadFormatRead_FillBufferLL, Teardown)
       
  1351 
       
  1352 EUNIT_TEST(
       
  1353     "SourcePrimeL - Wb test ",
       
  1354     "CAmrPayloadFormatRead",
       
  1355     "SourcePrimeL",
       
  1356     "FUNCTIONALITY",
       
  1357     SetupWbL, UT_CAmrPayloadFormatRead_SourcePrimeLL, Teardown)
       
  1358 
       
  1359 EUNIT_TEST(
       
  1360     "SourcePlayL - Wb test ",
       
  1361     "CAmrPayloadFormatRead",
       
  1362     "SourcePlayL",
       
  1363     "FUNCTIONALITY",
       
  1364     SetupWbL, UT_CAmrPayloadFormatRead_SourcePlayLL, Teardown)
       
  1365 
       
  1366 EUNIT_TEST(
       
  1367     "SourcePauseL - Wb test ",
       
  1368     "CAmrPayloadFormatRead",
       
  1369     "SourcePauseL",
       
  1370     "FUNCTIONALITY",
       
  1371     SetupWbL, UT_CAmrPayloadFormatRead_SourcePauseLL, Teardown)
       
  1372 
       
  1373 EUNIT_TEST(
       
  1374     "SourceStopL - Wb test ",
       
  1375     "CAmrPayloadFormatRead",
       
  1376     "SourceStopL",
       
  1377     "FUNCTIONALITY",
       
  1378     SetupWbL, UT_CAmrPayloadFormatRead_SourceStopLL, Teardown)
       
  1379 
       
  1380 EUNIT_TEST(
       
  1381     "CreateSourceBufferL - Wb test ",
       
  1382     "CAmrPayloadFormatRead",
       
  1383     "CreateSourceBufferL",
       
  1384     "FUNCTIONALITY",
       
  1385     SetupWbL, UT_CAmrPayloadFormatRead_CreateSourceBufferLL, Teardown)
       
  1386 
       
  1387 EUNIT_TEST(
       
  1388     "CreateSourceBufferL - Wb test ",
       
  1389     "CAmrPayloadFormatRead",
       
  1390     "CreateSourceBufferL",
       
  1391     "FUNCTIONALITY",
       
  1392     SetupWbL, UT_CAmrPayloadFormatRead_CreateSourceBufferL_1L, Teardown)
       
  1393 
       
  1394 EUNIT_TEST(
       
  1395     "SourceDataTypeCode - Wb test ",
       
  1396     "CAmrPayloadFormatRead",
       
  1397     "SourceDataTypeCode",
       
  1398     "FUNCTIONALITY",
       
  1399     SetupWbL, UT_CAmrPayloadFormatRead_SourceDataTypeCodeL, Teardown)
       
  1400 
       
  1401 EUNIT_TEST(
       
  1402     "SetSourceDataTypeCode - Wb test ",
       
  1403     "CAmrPayloadFormatRead",
       
  1404     "SetSourceDataTypeCode",
       
  1405     "FUNCTIONALITY",
       
  1406     SetupWbL, UT_CAmrPayloadFormatRead_SetSourceDataTypeCodeL, Teardown)
       
  1407 
       
  1408 EUNIT_TEST(
       
  1409     "SourceThreadLogon - Wb test ",
       
  1410     "CAmrPayloadFormatRead",
       
  1411     "SourceThreadLogon",
       
  1412     "FUNCTIONALITY",
       
  1413     SetupWbL, UT_CAmrPayloadFormatRead_SourceThreadLogonL, Teardown)
       
  1414 
       
  1415 EUNIT_TEST(
       
  1416     "SourceThreadLogoff - Wb test ",
       
  1417     "CAmrPayloadFormatRead",
       
  1418     "SourceThreadLogoff",
       
  1419     "FUNCTIONALITY",
       
  1420     SetupWbL, UT_CAmrPayloadFormatRead_SourceThreadLogoffL, Teardown)
       
  1421 
       
  1422 EUNIT_TEST(
       
  1423     "NegotiateSourceL - Wb test ",
       
  1424     "CAmrPayloadFormatRead",
       
  1425     "NegotiateSourceL",
       
  1426     "FUNCTIONALITY",
       
  1427     SetupWbL, UT_CAmrPayloadFormatRead_NegotiateSourceLL, Teardown)
       
  1428 
       
  1429 EUNIT_TEST(
       
  1430     "BufferFilledL - Wb test ",
       
  1431     "CAmrPayloadFormatRead",
       
  1432     "BufferFilledL",
       
  1433     "FUNCTIONALITY",
       
  1434     SetupWbL, UT_CAmrPayloadFormatRead_BufferFilledLL, Teardown)
       
  1435 
       
  1436 EUNIT_TEST(
       
  1437     "ConfigurePayloadFormatL - Wb test ",
       
  1438     "CAmrPayloadFormatRead",
       
  1439     "ConfigurePayloadFormatL",
       
  1440     "FUNCTIONALITY",
       
  1441     SetupWbL, UT_CAmrPayloadFormatRead_ConfigurePayloadFormatLWbL, Teardown)
       
  1442 
       
  1443 
       
  1444 EUNIT_TEST(
       
  1445     "DoRead - Wb test ",
       
  1446     "CAmrPayloadFormatRead",
       
  1447     "DoRead",
       
  1448     "FUNCTIONALITY",
       
  1449     SetupWbL, UT_CAmrPayloadFormatRead_DoReadL, Teardown)
       
  1450 
       
  1451 EUNIT_TEST(
       
  1452     "SinkDataTypeCode - Wb test ",
       
  1453     "CAmrPayloadFormatRead",
       
  1454     "SinkDataTypeCode",
       
  1455     "FUNCTIONALITY",
       
  1456     SetupWbL, UT_CAmrPayloadFormatRead_SinkDataTypeCodeL, Teardown)    
       
  1457   
       
  1458 EUNIT_TEST(
       
  1459     "ConvertModeToBitrate - Wb test ",
       
  1460     "CAmrPayloadFormatRead",
       
  1461     "ConvertModeToBitrate",
       
  1462     "FUNCTIONALITY",
       
  1463     SetupWbL, UT_CAmrPayloadFormatRead_ConvertModeToBitrateWb, Teardown)    
       
  1464   
       
  1465 EUNIT_TEST(
       
  1466     "SendAmrEventToClient - Wb test ",
       
  1467     "CAmrPayloadFormatRead",
       
  1468     "SendAmrEventToClient",
       
  1469     "FUNCTIONALITY",
       
  1470     SetupWbL, UT_CAmrPayloadFormatRead_SendAmrEventToClient, Teardown)    
       
  1471 
       
  1472 // ALLOC TESTS
       
  1473 #ifdef EUNIT_ALLOC_TEST_ON
       
  1474 
       
  1475 EUNIT_ALLOC_TEST(
       
  1476     "CancelDlRequest - alloc test ",
       
  1477     "CAmrPayloadFormatRead",
       
  1478     "CancelDlRequest",
       
  1479     "ERRORHANDLING",
       
  1480     SetupAL, UT_CAmrPayloadFormatRead_CancelDlRequestL, Teardown)
       
  1481 
       
  1482 EUNIT_ALLOC_TEST(
       
  1483     "SendDataToSinkL - alloc test ",
       
  1484     "CAmrPayloadFormatRead",
       
  1485     "SendDataToSinkL",
       
  1486     "ERRORHANDLING",
       
  1487     SetupAL, UT_CAmrPayloadFormatRead_SendDataToSinkLL, Teardown)
       
  1488 
       
  1489 EUNIT_ALLOC_TEST(
       
  1490     "FillSinkBuffer - alloc test ",
       
  1491     "CAmrPayloadFormatRead",
       
  1492     "FillSinkBuffer",
       
  1493     "ERRORHANDLING",
       
  1494     SetupAL, UT_CAmrPayloadFormatRead_FillSinkBufferL, Teardown)
       
  1495 
       
  1496 EUNIT_ALLOC_TEST(
       
  1497     "FillSourceBufferL - alloc test ",
       
  1498     "CAmrPayloadFormatRead",
       
  1499     "FillSourceBufferL",
       
  1500     "ERRORHANDLING",
       
  1501     SetupAL, UT_CAmrPayloadFormatRead_FillSourceBufferLL, Teardown)
       
  1502 
       
  1503 EUNIT_ALLOC_TEST(
       
  1504     "Streams - alloc test ",
       
  1505     "CAmrPayloadFormatRead",
       
  1506     "Streams",
       
  1507     "ERRORHANDLING",
       
  1508     SetupAL, UT_CAmrPayloadFormatRead_StreamsL, Teardown)
       
  1509 
       
  1510 EUNIT_ALLOC_TEST(
       
  1511     "FrameTimeInterval - alloc test ",
       
  1512     "CAmrPayloadFormatRead",
       
  1513     "FrameTimeInterval",
       
  1514     "ERRORHANDLING",
       
  1515     SetupAL, UT_CAmrPayloadFormatRead_FrameTimeIntervalL, Teardown)
       
  1516 
       
  1517 EUNIT_ALLOC_TEST(
       
  1518     "Duration - alloc test ",
       
  1519     "CAmrPayloadFormatRead",
       
  1520     "Duration",
       
  1521     "ERRORHANDLING",
       
  1522     SetupAL, UT_CAmrPayloadFormatRead_DurationL, Teardown)
       
  1523 
       
  1524 EUNIT_ALLOC_TEST(
       
  1525     "NumChannels - alloc test ",
       
  1526     "CAmrPayloadFormatRead",
       
  1527     "NumChannels",
       
  1528     "ERRORHANDLING",
       
  1529     SetupAL, UT_CAmrPayloadFormatRead_NumChannelsL, Teardown)
       
  1530 
       
  1531 EUNIT_ALLOC_TEST(
       
  1532     "SampleRate - alloc test ",
       
  1533     "CAmrPayloadFormatRead",
       
  1534     "SampleRate",
       
  1535     "ERRORHANDLING",
       
  1536     SetupAL, UT_CAmrPayloadFormatRead_SampleRateL, Teardown)
       
  1537 
       
  1538 EUNIT_ALLOC_TEST(
       
  1539     "SetSampleRate - alloc test ",
       
  1540     "CAmrPayloadFormatRead",
       
  1541     "SetSampleRate",
       
  1542     "ERRORHANDLING",
       
  1543     SetupAL, UT_CAmrPayloadFormatRead_SetSampleRateL, Teardown)
       
  1544 
       
  1545 EUNIT_ALLOC_TEST(
       
  1546     "FillBufferL - alloc test ",
       
  1547     "CAmrPayloadFormatRead",
       
  1548     "FillBufferL",
       
  1549     "ERRORHANDLING",
       
  1550     SetupAL, UT_CAmrPayloadFormatRead_FillBufferLL, Teardown)
       
  1551 
       
  1552 EUNIT_ALLOC_TEST(
       
  1553     "SourcePrimeL - alloc test ",
       
  1554     "CAmrPayloadFormatRead",
       
  1555     "SourcePrimeL",
       
  1556     "ERRORHANDLING",
       
  1557     SetupAL, UT_CAmrPayloadFormatRead_SourcePrimeLL, Teardown)
       
  1558 
       
  1559 EUNIT_ALLOC_TEST(
       
  1560     "SourcePlayL - alloc test ",
       
  1561     "CAmrPayloadFormatRead",
       
  1562     "SourcePlayL",
       
  1563     "ERRORHANDLING",
       
  1564     SetupAL, UT_CAmrPayloadFormatRead_SourcePlayLL, Teardown)
       
  1565 
       
  1566 EUNIT_ALLOC_TEST(
       
  1567     "SourcePauseL - alloc test ",
       
  1568     "CAmrPayloadFormatRead",
       
  1569     "SourcePauseL",
       
  1570     "ERRORHANDLING",
       
  1571     SetupAL, UT_CAmrPayloadFormatRead_SourcePauseLL, Teardown)
       
  1572 
       
  1573 EUNIT_ALLOC_TEST(
       
  1574     "SourceStopL - alloc test ",
       
  1575     "CAmrPayloadFormatRead",
       
  1576     "SourceStopL",
       
  1577     "ERRORHANDLING",
       
  1578     SetupAL, UT_CAmrPayloadFormatRead_SourceStopLL, Teardown)
       
  1579 
       
  1580 EUNIT_ALLOC_TEST(
       
  1581     "CreateSourceBufferL - alloc test ",
       
  1582     "CAmrPayloadFormatRead",
       
  1583     "CreateSourceBufferL",
       
  1584     "ERRORHANDLING",
       
  1585     SetupAL, UT_CAmrPayloadFormatRead_CreateSourceBufferLL, Teardown)
       
  1586 
       
  1587 EUNIT_ALLOC_TEST(
       
  1588     "CreateSourceBufferL - alloc test ",
       
  1589     "CAmrPayloadFormatRead",
       
  1590     "CreateSourceBufferL",
       
  1591     "ERRORHANDLING",
       
  1592     SetupAL, UT_CAmrPayloadFormatRead_CreateSourceBufferL_1L, Teardown)
       
  1593 
       
  1594 EUNIT_ALLOC_TEST(
       
  1595     "SourceDataTypeCode - alloc test ",
       
  1596     "CAmrPayloadFormatRead",
       
  1597     "SourceDataTypeCode",
       
  1598     "ERRORHANDLING",
       
  1599     SetupAL, UT_CAmrPayloadFormatRead_SourceDataTypeCodeL, Teardown)
       
  1600 
       
  1601 EUNIT_ALLOC_TEST(
       
  1602     "SetSourceDataTypeCode - alloc test ",
       
  1603     "CAmrPayloadFormatRead",
       
  1604     "SetSourceDataTypeCode",
       
  1605     "ERRORHANDLING",
       
  1606     SetupAL, UT_CAmrPayloadFormatRead_SetSourceDataTypeCodeL, Teardown)
       
  1607 
       
  1608 EUNIT_ALLOC_TEST(
       
  1609     "SourceThreadLogon - alloc test ",
       
  1610     "CAmrPayloadFormatRead",
       
  1611     "SourceThreadLogon",
       
  1612     "ERRORHANDLING",
       
  1613     SetupAL, UT_CAmrPayloadFormatRead_SourceThreadLogonL, Teardown)
       
  1614 
       
  1615 EUNIT_ALLOC_TEST(
       
  1616     "SourceThreadLogoff - alloc test ",
       
  1617     "CAmrPayloadFormatRead",
       
  1618     "SourceThreadLogoff",
       
  1619     "ERRORHANDLING",
       
  1620     SetupAL, UT_CAmrPayloadFormatRead_SourceThreadLogoffL, Teardown)
       
  1621 
       
  1622 EUNIT_ALLOC_TEST(
       
  1623     "NegotiateSourceL - alloc test ",
       
  1624     "CAmrPayloadFormatRead",
       
  1625     "NegotiateSourceL",
       
  1626     "ERRORHANDLING",
       
  1627     SetupAL, UT_CAmrPayloadFormatRead_NegotiateSourceLL, Teardown)
       
  1628 
       
  1629 EUNIT_ALLOC_TEST(
       
  1630     "BufferFilledL - alloc test ",
       
  1631     "CAmrPayloadFormatRead",
       
  1632     "BufferFilledL",
       
  1633     "ERRORHANDLING",
       
  1634     SetupAL, UT_CAmrPayloadFormatRead_BufferFilledLL, Teardown)
       
  1635     
       
  1636 EUNIT_ALLOC_TEST(
       
  1637     "ConfigurePayloadFormatL - alloc test ",
       
  1638     "CAmrPayloadFormatRead",
       
  1639     "ConfigurePayloadFormatL",
       
  1640     "ERRORHANDLING",
       
  1641     SetupAL, UT_CAmrPayloadFormatRead_ConfigurePayloadFormatLL, Teardown)
       
  1642     
       
  1643 EUNIT_ALLOC_TEST(
       
  1644     "DoRead - alloc test ",
       
  1645     "CAmrPayloadFormatRead",
       
  1646     "DoRead",
       
  1647     "ERRORHANDLING",
       
  1648     SetupAL, UT_CAmrPayloadFormatRead_DoReadL, Teardown)
       
  1649 
       
  1650 EUNIT_ALLOC_TEST(
       
  1651     "SinkDataTypeCode - alloc test ",
       
  1652     "CAmrPayloadFormatRead",
       
  1653     "SinkDataTypeCode",
       
  1654     "ERRORHANDLING",
       
  1655     SetupAL, UT_CAmrPayloadFormatRead_SinkDataTypeCodeL, Teardown)    
       
  1656 
       
  1657 EUNIT_TEST(
       
  1658     "ConvertModeToBitrate - alloc test ",
       
  1659     "CAmrPayloadFormatRead",
       
  1660     "ConvertModeToBitrate",
       
  1661     "FUNCTIONALITY",
       
  1662     SetupAL, UT_CAmrPayloadFormatRead_ConvertModeToBitrate, Teardown)    
       
  1663   
       
  1664 EUNIT_TEST(
       
  1665     "SendAmrEventToClient - alloc test ",
       
  1666     "CAmrPayloadFormatRead",
       
  1667     "SendAmrEventToClient",
       
  1668     "FUNCTIONALITY",
       
  1669     SetupAL, UT_CAmrPayloadFormatRead_SendAmrEventToClient, Teardown)    
       
  1670 
       
  1671 // Wide band tests
       
  1672 
       
  1673 EUNIT_ALLOC_TEST(
       
  1674     "CancelDlRequest - Wb alloc test ",
       
  1675     "CAmrPayloadFormatRead",
       
  1676     "CancelDlRequest",
       
  1677     "ERRORHANDLING",
       
  1678     SetupWbAL, UT_CAmrPayloadFormatRead_CancelDlRequestL, Teardown)
       
  1679 
       
  1680 EUNIT_ALLOC_TEST(
       
  1681     "SendDataToSinkL - Wb alloc test ",
       
  1682     "CAmrPayloadFormatRead",
       
  1683     "SendDataToSinkL",
       
  1684     "ERRORHANDLING",
       
  1685     SetupWbAL, UT_CAmrPayloadFormatRead_SendDataToSinkLL, Teardown)
       
  1686 
       
  1687 EUNIT_ALLOC_TEST(
       
  1688     "FillSinkBuffer - Wb alloc test ",
       
  1689     "CAmrPayloadFormatRead",
       
  1690     "FillSinkBuffer",
       
  1691     "ERRORHANDLING",
       
  1692     SetupWbAL, UT_CAmrPayloadFormatRead_FillSinkBufferL, Teardown)
       
  1693 
       
  1694 EUNIT_ALLOC_TEST(
       
  1695     "FillSourceBufferL - Wb alloc test ",
       
  1696     "CAmrPayloadFormatRead",
       
  1697     "FillSourceBufferL",
       
  1698     "ERRORHANDLING",
       
  1699     SetupWbAL, UT_CAmrPayloadFormatRead_FillSourceBufferLL, Teardown)
       
  1700 
       
  1701 EUNIT_ALLOC_TEST(
       
  1702     "Streams - Wb alloc test ",
       
  1703     "CAmrPayloadFormatRead",
       
  1704     "Streams",
       
  1705     "ERRORHANDLING",
       
  1706     SetupWbAL, UT_CAmrPayloadFormatRead_StreamsL, Teardown)
       
  1707 
       
  1708 EUNIT_ALLOC_TEST(
       
  1709     "FrameTimeInterval - Wb alloc test ",
       
  1710     "CAmrPayloadFormatRead",
       
  1711     "FrameTimeInterval",
       
  1712     "ERRORHANDLING",
       
  1713     SetupWbAL, UT_CAmrPayloadFormatRead_FrameTimeIntervalL, Teardown)
       
  1714 
       
  1715 EUNIT_ALLOC_TEST(
       
  1716     "Duration - Wb alloc test ",
       
  1717     "CAmrPayloadFormatRead",
       
  1718     "Duration",
       
  1719     "ERRORHANDLING",
       
  1720     SetupWbAL, UT_CAmrPayloadFormatRead_DurationL, Teardown)
       
  1721 
       
  1722 EUNIT_ALLOC_TEST(
       
  1723     "NumChannels - Wb alloc test ",
       
  1724     "CAmrPayloadFormatRead",
       
  1725     "NumChannels",
       
  1726     "ERRORHANDLING",
       
  1727     SetupWbAL, UT_CAmrPayloadFormatRead_NumChannelsL, Teardown)
       
  1728 
       
  1729 EUNIT_ALLOC_TEST(
       
  1730     "SampleRate - Wb alloc test ",
       
  1731     "CAmrPayloadFormatRead",
       
  1732     "SampleRate",
       
  1733     "ERRORHANDLING",
       
  1734     SetupWbAL, UT_CAmrPayloadFormatRead_SampleRateL, Teardown)
       
  1735 
       
  1736 EUNIT_ALLOC_TEST(
       
  1737     "SetSampleRate - Wb alloc test ",
       
  1738     "CAmrPayloadFormatRead",
       
  1739     "SetSampleRate",
       
  1740     "ERRORHANDLING",
       
  1741     SetupWbAL, UT_CAmrPayloadFormatRead_SetSampleRateWbL, Teardown)
       
  1742 
       
  1743 EUNIT_ALLOC_TEST(
       
  1744     "FillBufferL - Wb alloc test ",
       
  1745     "CAmrPayloadFormatRead",
       
  1746     "FillBufferL",
       
  1747     "ERRORHANDLING",
       
  1748     SetupWbAL, UT_CAmrPayloadFormatRead_FillBufferLL, Teardown)
       
  1749 
       
  1750 EUNIT_ALLOC_TEST(
       
  1751     "SourcePrimeL - Wb alloc test ",
       
  1752     "CAmrPayloadFormatRead",
       
  1753     "SourcePrimeL",
       
  1754     "ERRORHANDLING",
       
  1755     SetupWbAL, UT_CAmrPayloadFormatRead_SourcePrimeLL, Teardown)
       
  1756 
       
  1757 EUNIT_ALLOC_TEST(
       
  1758     "SourcePlayL - Wb alloc test ",
       
  1759     "CAmrPayloadFormatRead",
       
  1760     "SourcePlayL",
       
  1761     "ERRORHANDLING",
       
  1762     SetupWbAL, UT_CAmrPayloadFormatRead_SourcePlayLL, Teardown)
       
  1763 
       
  1764 EUNIT_ALLOC_TEST(
       
  1765     "SourcePauseL - Wb alloc test ",
       
  1766     "CAmrPayloadFormatRead",
       
  1767     "SourcePauseL",
       
  1768     "ERRORHANDLING",
       
  1769     SetupWbAL, UT_CAmrPayloadFormatRead_SourcePauseLL, Teardown)
       
  1770 
       
  1771 EUNIT_ALLOC_TEST(
       
  1772     "SourceStopL - Wb alloc test ",
       
  1773     "CAmrPayloadFormatRead",
       
  1774     "SourceStopL",
       
  1775     "ERRORHANDLING",
       
  1776     SetupWbAL, UT_CAmrPayloadFormatRead_SourceStopLL, Teardown)
       
  1777 
       
  1778 EUNIT_ALLOC_TEST(
       
  1779     "CreateSourceBufferL - Wb alloc test ",
       
  1780     "CAmrPayloadFormatRead",
       
  1781     "CreateSourceBufferL",
       
  1782     "ERRORHANDLING",
       
  1783     SetupWbAL, UT_CAmrPayloadFormatRead_CreateSourceBufferLL, Teardown)
       
  1784 
       
  1785 EUNIT_ALLOC_TEST(
       
  1786     "CreateSourceBufferL - Wb alloc test ",
       
  1787     "CAmrPayloadFormatRead",
       
  1788     "CreateSourceBufferL",
       
  1789     "ERRORHANDLING",
       
  1790     SetupWbAL, UT_CAmrPayloadFormatRead_CreateSourceBufferL_1L, Teardown)
       
  1791 
       
  1792 EUNIT_ALLOC_TEST(
       
  1793     "SourceDataTypeCode - Wb alloc test ",
       
  1794     "CAmrPayloadFormatRead",
       
  1795     "SourceDataTypeCode",
       
  1796     "ERRORHANDLING",
       
  1797     SetupWbAL, UT_CAmrPayloadFormatRead_SourceDataTypeCodeL, Teardown)
       
  1798 
       
  1799 EUNIT_ALLOC_TEST(
       
  1800     "SetSourceDataTypeCode - Wb alloc test ",
       
  1801     "CAmrPayloadFormatRead",
       
  1802     "SetSourceDataTypeCode",
       
  1803     "ERRORHANDLING",
       
  1804     SetupWbAL, UT_CAmrPayloadFormatRead_SetSourceDataTypeCodeL, Teardown)
       
  1805 
       
  1806 EUNIT_ALLOC_TEST(
       
  1807     "SourceThreadLogon - Wb alloc test ",
       
  1808     "CAmrPayloadFormatRead",
       
  1809     "SourceThreadLogon",
       
  1810     "ERRORHANDLING",
       
  1811     SetupWbAL, UT_CAmrPayloadFormatRead_SourceThreadLogonL, Teardown)
       
  1812 
       
  1813 EUNIT_ALLOC_TEST(
       
  1814     "SourceThreadLogoff - Wb alloc test ",
       
  1815     "CAmrPayloadFormatRead",
       
  1816     "SourceThreadLogoff",
       
  1817     "ERRORHANDLING",
       
  1818     SetupWbAL, UT_CAmrPayloadFormatRead_SourceThreadLogoffL, Teardown)
       
  1819 
       
  1820 EUNIT_ALLOC_TEST(
       
  1821     "NegotiateSourceL - Wb alloc test ",
       
  1822     "CAmrPayloadFormatRead",
       
  1823     "NegotiateSourceL",
       
  1824     "ERRORHANDLING",
       
  1825     SetupWbAL, UT_CAmrPayloadFormatRead_NegotiateSourceLL, Teardown)
       
  1826 
       
  1827 EUNIT_ALLOC_TEST(
       
  1828     "BufferFilledL - Wb alloc test ",
       
  1829     "CAmrPayloadFormatRead",
       
  1830     "BufferFilledL",
       
  1831     "ERRORHANDLING",
       
  1832     SetupWbAL, UT_CAmrPayloadFormatRead_BufferFilledLL, Teardown)
       
  1833     
       
  1834 EUNIT_ALLOC_TEST(
       
  1835     "ConfigurePayloadFormatL - Wb alloc test ",
       
  1836     "CAmrPayloadFormatRead",
       
  1837     "ConfigurePayloadFormatL",
       
  1838     "ERRORHANDLING",
       
  1839     SetupWbAL, UT_CAmrPayloadFormatRead_ConfigurePayloadFormatLWbL, Teardown)
       
  1840     
       
  1841 EUNIT_ALLOC_TEST(
       
  1842     "DoRead - Wb alloc test ",
       
  1843     "CAmrPayloadFormatRead",
       
  1844     "DoRead",
       
  1845     "ERRORHANDLING",
       
  1846     SetupWbAL, UT_CAmrPayloadFormatRead_DoReadL, Teardown)
       
  1847 
       
  1848 EUNIT_ALLOC_TEST(
       
  1849     "SinkDataTypeCode - Wb alloc test ",
       
  1850     "CAmrPayloadFormatRead",
       
  1851     "SinkDataTypeCode",
       
  1852     "ERRORHANDLING",
       
  1853     SetupWbAL, UT_CAmrPayloadFormatRead_SinkDataTypeCodeL, Teardown)    
       
  1854 
       
  1855 EUNIT_TEST(
       
  1856     "ConvertModeToBitrate - Wb alloc test ",
       
  1857     "CAmrPayloadFormatRead",
       
  1858     "ConvertModeToBitrate",
       
  1859     "FUNCTIONALITY",
       
  1860     SetupWbAL, UT_CAmrPayloadFormatRead_ConvertModeToBitrateWb, Teardown)    
       
  1861   
       
  1862 EUNIT_TEST(
       
  1863     "SendAmrEventToClient - Wb alloc test ",
       
  1864     "CAmrPayloadFormatRead",
       
  1865     "SendAmrEventToClient",
       
  1866     "FUNCTIONALITY",
       
  1867     SetupWbAL, UT_CAmrPayloadFormatRead_SendAmrEventToClient, Teardown)    
       
  1868 
       
  1869 #endif  
       
  1870 
       
  1871 EUNIT_END_TEST_TABLE
       
  1872 
       
  1873 //  END OF FILE