multimediacommscontroller/tsrc/componenttests/src/test_audiocontrol.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2006 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 
       
    21 // INCLUDES
       
    22 #include "test_audiocontrol.h"
       
    23 #include "mccteststubs.h"
       
    24 #include "mmccinterface.h"
       
    25 #include "mmcccodecinformation.h"
       
    26 #include "testdefinitions.hrh"
       
    27 
       
    28 // ======== MEMBER FUNCTIONS =================================================
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 // CTestAudioControlAudioControl::CTestAudioControlAudioControl
       
    32 // C++ default constructor can NOT contain any code, that
       
    33 // might leave.
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 CTestAudioControl::CTestAudioControl( CConsoleBase& aConsole,
       
    37     const TMccNetSettings& aNetsettings, CMccInterface& aIF,
       
    38     CMccInterfaceStub& aIFStub )
       
    39     : iConsole( aConsole ), iNetsettings( aNetsettings ), iInterface( aIF ),
       
    40     iIfStub( aIFStub )
       
    41     {
       
    42     }
       
    43     
       
    44 // ---------------------------------------------------------------------------
       
    45 // CTestAudioControl::ConstructL
       
    46 // Symbian 2nd phase constructor can leave.
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 void CTestAudioControl::ConstructL(  )
       
    50     {
       
    51     }
       
    52     
       
    53 // ---------------------------------------------------------------------------
       
    54 // CTestAudioControl::NewL
       
    55 // Static constructor.
       
    56 // ---------------------------------------------------------------------------
       
    57 //   
       
    58 CTestAudioControl* CTestAudioControl::NewL( CConsoleBase& aConsole,
       
    59         const TMccNetSettings& aNetsettings, CMccInterface& aIF,
       
    60         CMccInterfaceStub& aIFStub )
       
    61     {
       
    62     CTestAudioControl* self 
       
    63         = new ( ELeave ) CTestAudioControl( aConsole, aNetsettings, aIF, aIFStub );
       
    64     CleanupStack::PushL( self );
       
    65 
       
    66     self->ConstructL();
       
    67 
       
    68     CleanupStack::Pop( self );
       
    69     return self;
       
    70     }
       
    71 
       
    72 // ---------------------------------------------------------------------------
       
    73 // CTestAudioControl::~CTestAudioControl
       
    74 // Destructor.
       
    75 // ---------------------------------------------------------------------------
       
    76 //
       
    77 CTestAudioControl::~CTestAudioControl()
       
    78     {
       
    79     }
       
    80 
       
    81 // ---------------------------------------------------------------------------
       
    82 // CTestAudioControl::DoRunAudioControlTestsL
       
    83 // ---------------------------------------------------------------------------
       
    84 //
       
    85 void CTestAudioControl::DoRunAudioControlTestsL()
       
    86     {
       
    87     iConsole.Printf( _L("\n*** AUDIO CONTROL TESTS ***\n") );
       
    88     
       
    89     CreateStreamsL();
       
    90     
       
    91     iConsole.Printf( _L("Get volume test\n") );
       
    92     RDebug::Print( _L("Mcc_COM_TEST_START: TestGetVolumeL") );
       
    93     __UHEAP_MARK;
       
    94     TestGetVolumeL();
       
    95     __UHEAP_MARKEND;
       
    96     RDebug::Print( _L("Mcc_COM_TEST_STOP: TestGetVolumeL") );
       
    97     
       
    98     iConsole.Printf( _L("Get gain test\n") );
       
    99     RDebug::Print( _L("Mcc_COM_TEST_START: TestGetGainL") );
       
   100     __UHEAP_MARK;
       
   101     TestGetGainL();
       
   102     __UHEAP_MARKEND;
       
   103     RDebug::Print( _L("Mcc_COM_TEST_STOP: TestGetGainL") );
       
   104     
       
   105     iConsole.Printf( _L("Get balance test\n") );
       
   106     RDebug::Print( _L("Mcc_COM_TEST_START: TestGetBalanceL") );
       
   107     __UHEAP_MARK;
       
   108     TestGetBalanceL();
       
   109     __UHEAP_MARKEND;
       
   110     RDebug::Print( _L("Mcc_COM_TEST_STOP: TestGetBalanceL") );
       
   111     
       
   112     iConsole.Printf( _L("Get max volume test\n") );
       
   113     RDebug::Print( _L("Mcc_COM_TEST_START: TestGetMaxVolumeL") );
       
   114     __UHEAP_MARK;
       
   115     TestGetMaxVolumeL();
       
   116     __UHEAP_MARKEND;
       
   117     RDebug::Print( _L("Mcc_COM_TEST_STOP: TestGetMaxVolumeL") );
       
   118     
       
   119     iConsole.Printf( _L("Get max gain test\n") );
       
   120     RDebug::Print( _L("Mcc_COM_TEST_START: TestGetMaxGainL") );
       
   121     __UHEAP_MARK;
       
   122     TestGetMaxGainL();
       
   123     __UHEAP_MARKEND;
       
   124     RDebug::Print( _L("Mcc_COM_TEST_STOP: TestGetMaxGainL") );
       
   125     
       
   126     iConsole.Printf( _L("Set volume test\n") );
       
   127     RDebug::Print( _L("Mcc_COM_TEST_START: TestSetVolumeL") );
       
   128     __UHEAP_MARK;
       
   129     TestSetVolumeL();
       
   130     __UHEAP_MARKEND;
       
   131     RDebug::Print( _L("Mcc_COM_TEST_STOP: TestSetVolumeL") );
       
   132     
       
   133     iConsole.Printf( _L("Set gain test\n") );
       
   134     RDebug::Print( _L("Mcc_COM_TEST_START: TestSetGainL") );
       
   135     __UHEAP_MARK;
       
   136     TestSetGainL();
       
   137     __UHEAP_MARKEND;
       
   138     RDebug::Print( _L("Mcc_COM_TEST_STOP: TestSetGainL") );
       
   139     
       
   140     iConsole.Printf( _L("Set balance test\n") );
       
   141     RDebug::Print( _L("Mcc_COM_TEST_START: TestSetBalanceL") );
       
   142     __UHEAP_MARK;
       
   143     TestSetBalanceL();
       
   144     __UHEAP_MARKEND;
       
   145     RDebug::Print( _L("Mcc_COM_TEST_STOP: TestSetBalanceL") );
       
   146     
       
   147     DeleteStreamsL();
       
   148     }
       
   149 
       
   150 
       
   151 // ---------------------------------------------------------------------------
       
   152 // CTestAudioControl::TestGetVolumeL
       
   153 // ---------------------------------------------------------------------------
       
   154 //
       
   155 void CTestAudioControl::TestGetVolumeL()
       
   156     {
       
   157     TInt volume( 0 );
       
   158     TPckgBuf<TInt> volPckg( volume );
       
   159     User::LeaveIfError( iInterface.GetParameter(
       
   160         iSessionId, iLinkId, iDlStreamId, iAudioSinkId,
       
   161         KMccSpeakerVolume, volPckg ) );
       
   162         
       
   163     TInt err = iInterface.GetParameter( 
       
   164         iSessionId, iLinkId, iUlStreamId, iAudioSourceId,
       
   165         KMccSpeakerVolume, volPckg );
       
   166     if ( KErrNone == err )
       
   167         {
       
   168         // VOLUME IS PROPERTY OF PLAYBACK DEVICE ONLY
       
   169         //User::Leave( KErrTotalLossOfPrecision );
       
   170         }
       
   171     }
       
   172     
       
   173 // ---------------------------------------------------------------------------
       
   174 // CTestAudioControl::TestGetGainL
       
   175 // ---------------------------------------------------------------------------
       
   176 //
       
   177 void CTestAudioControl::TestGetGainL()
       
   178     {
       
   179     TInt gain( 0 );
       
   180     TPckgBuf<TInt> gainPckg( gain );
       
   181     User::LeaveIfError( iInterface.GetParameter( 
       
   182         iSessionId, iLinkId, iUlStreamId, iAudioSourceId,
       
   183         KMccMicGain, gainPckg ) );
       
   184         
       
   185     TInt err = iInterface.GetParameter(
       
   186         iSessionId, iLinkId, iDlStreamId, iAudioSinkId,
       
   187         KMccMicGain, gainPckg );
       
   188     if ( KErrNone == err )
       
   189         {
       
   190         // GAIN IS PROPERTY OF RECORD DEVICE ONLY
       
   191         //User::Leave( KErrTotalLossOfPrecision );
       
   192         }
       
   193     }
       
   194 
       
   195 // ---------------------------------------------------------------------------
       
   196 // CTestAudioControl::TestGetBalanceL
       
   197 // ---------------------------------------------------------------------------
       
   198 //
       
   199 void CTestAudioControl::TestGetBalanceL()
       
   200     {
       
   201     TPckgBuf<TInt> val;
       
   202     User::LeaveIfError( iInterface.GetParameter( 
       
   203         iSessionId, iLinkId, iUlStreamId, iAudioSourceId, KMccMicBalance, val ) );
       
   204     TInt err = iInterface.GetParameter( 
       
   205         iSessionId, iLinkId, iDlStreamId, iAudioSinkId, KMccMicBalance, val );
       
   206     if ( KErrNone == err )
       
   207         {
       
   208         //User::Leave( KErrTotalLossOfPrecision );
       
   209         }
       
   210         
       
   211     User::LeaveIfError( iInterface.GetParameter( 
       
   212         iSessionId, iLinkId, iDlStreamId, iAudioSinkId, KMccSpeakerBalance, val ) );
       
   213     err = iInterface.GetParameter( 
       
   214         iSessionId, iLinkId, iUlStreamId, iAudioSourceId, KMccSpeakerBalance, val );
       
   215     if ( KErrNone == err )
       
   216         {
       
   217         //User::Leave( KErrTotalLossOfPrecision );
       
   218         }
       
   219     }
       
   220 
       
   221 // ---------------------------------------------------------------------------
       
   222 // CTestAudioControl::TestGetMaxVolumeL
       
   223 // ---------------------------------------------------------------------------
       
   224 //
       
   225 void CTestAudioControl::TestGetMaxVolumeL()
       
   226     {
       
   227     TInt maxVol( 0 );
       
   228     TPckgBuf<TInt> maxVolPckg( maxVol );
       
   229         
       
   230     User::LeaveIfError( iInterface.GetParameter( 
       
   231         iSessionId, iLinkId, iDlStreamId, iAudioSinkId,
       
   232         KMccSpeakerMaxVolume, maxVolPckg ) );
       
   233     if ( 0 == maxVolPckg() )
       
   234         {
       
   235         User::Leave( KErrTotalLossOfPrecision );
       
   236         }
       
   237         
       
   238     TInt err = iInterface.GetParameter( 
       
   239         iSessionId, iLinkId, iUlStreamId, iAudioSourceId,
       
   240         KMccSpeakerMaxVolume, maxVolPckg );
       
   241     if ( KErrNone == err )
       
   242         {
       
   243         // VOLUME IS PROPERTY OF PLAYBACK DEVICE ONLY
       
   244         //User::Leave( KErrTotalLossOfPrecision );
       
   245         }
       
   246     }
       
   247     
       
   248 // ---------------------------------------------------------------------------
       
   249 // CTestAudioControl::TestGetMaxGainL
       
   250 // ---------------------------------------------------------------------------
       
   251 //
       
   252 void CTestAudioControl::TestGetMaxGainL()
       
   253     {
       
   254     TInt maxGain( 0 );
       
   255     TPckgBuf<TInt> maxGainPckg( maxGain );
       
   256     User::LeaveIfError( iInterface.GetParameter( iSessionId, 
       
   257         iLinkId, iUlStreamId, iAudioSourceId, KMccMicMaxGain, maxGainPckg ) );
       
   258     if ( 0 == maxGainPckg() )
       
   259         {
       
   260         User::Leave( KErrTotalLossOfPrecision );
       
   261         }
       
   262         
       
   263     TInt err = iInterface.GetParameter( iSessionId, 
       
   264         iLinkId, iDlStreamId, iAudioSinkId, KMccMicMaxGain, maxGainPckg );
       
   265     if ( KErrNone == err )
       
   266         {
       
   267         // GAIN IS PROPERTY OF RECORD DEVICE ONLY
       
   268         //User::Leave( KErrTotalLossOfPrecision );
       
   269         }
       
   270     }
       
   271 
       
   272 // ---------------------------------------------------------------------------
       
   273 // CTestAudioControl::TestSetVolumeL
       
   274 // ---------------------------------------------------------------------------
       
   275 //
       
   276 void CTestAudioControl::TestSetVolumeL()
       
   277     {
       
   278     TInt maxVol( 0 );
       
   279     TPckgBuf<TInt> maxVolPckg( maxVol );
       
   280     User::LeaveIfError( iInterface.GetParameter( 
       
   281         iSessionId, iLinkId, iDlStreamId, iAudioSinkId,
       
   282         KMccSpeakerMaxVolume, maxVolPckg ) );
       
   283     
       
   284     TPckgBuf<TInt> volPckg( maxVolPckg() );
       
   285     User::LeaveIfError( iInterface.SetParameter( iSessionId, 
       
   286         iLinkId, iDlStreamId, iAudioSinkId, KMccSpeakerVolume, volPckg ) );
       
   287     TInt setVol = volPckg();
       
   288     User::LeaveIfError( iInterface.GetParameter( iSessionId, 
       
   289         iLinkId, iDlStreamId, iAudioSinkId, KMccSpeakerVolume, volPckg ) );
       
   290     if ( setVol != volPckg() )
       
   291         {
       
   292         User::Leave( KErrTotalLossOfPrecision );
       
   293         }
       
   294         
       
   295     TPckgBuf<TInt> volPckg2( maxVolPckg() + 1 );
       
   296     TInt err = iInterface.SetParameter( iSessionId, 
       
   297         iLinkId, iDlStreamId, iAudioSinkId, KMccSpeakerVolume, volPckg2 );
       
   298     if ( KErrNone == err )
       
   299         {
       
   300         User::Leave( KErrTotalLossOfPrecision );
       
   301         }
       
   302     
       
   303     TPckgBuf<TInt> volPckg3( 0 );
       
   304     User::LeaveIfError( iInterface.SetParameter( iSessionId, 
       
   305         iLinkId, iDlStreamId, iAudioSinkId, KMccSpeakerVolume, volPckg3 ) );
       
   306 
       
   307     
       
   308     err = iInterface.SetParameter( iSessionId, iLinkId, iUlStreamId,
       
   309         iAudioSourceId, KMccSpeakerVolume, volPckg3 );
       
   310     if ( KErrNone == err )
       
   311         {
       
   312         // VOLUME IS PROPERTY OF PLAYBACK DEVICE ONLY
       
   313         //User::Leave( KErrTotalLossOfPrecision );
       
   314         }
       
   315     }
       
   316     
       
   317 // ---------------------------------------------------------------------------
       
   318 // CTestAudioControl::TestSetGainL
       
   319 // ---------------------------------------------------------------------------
       
   320 //
       
   321 void CTestAudioControl::TestSetGainL()
       
   322     {
       
   323     TInt maxGain( 0 );
       
   324     TPckgBuf<TInt> maxGainPckg( maxGain );
       
   325     User::LeaveIfError( iInterface.GetParameter( iSessionId, 
       
   326         iLinkId, iUlStreamId, iAudioSourceId, KMccMicMaxGain, maxGainPckg ) );
       
   327 
       
   328     TPckgBuf<TInt> gainPckg( maxGainPckg() );
       
   329     User::LeaveIfError( iInterface.SetParameter( iSessionId, 
       
   330         iLinkId, iUlStreamId, iAudioSourceId, KMccMicGain, gainPckg ) );
       
   331     TInt setGain = gainPckg();
       
   332     User::LeaveIfError( iInterface.GetParameter( iSessionId, 
       
   333         iLinkId, iUlStreamId, iAudioSourceId, KMccMicGain, gainPckg ) );
       
   334     if ( setGain != gainPckg() )
       
   335         {
       
   336         User::Leave( KErrTotalLossOfPrecision );
       
   337         }
       
   338 
       
   339     TPckgBuf<TInt> gainPckg2( maxGainPckg() + 1 );
       
   340     TInt err = iInterface.SetParameter( iSessionId, 
       
   341         iLinkId, iUlStreamId, iAudioSourceId, KMccMicGain, gainPckg2 );
       
   342     if ( KErrNone == err )
       
   343         {
       
   344         //User::Leave( KErrTotalLossOfPrecision );
       
   345         }
       
   346 
       
   347     TPckgBuf<TInt> gainPckg3( 0 );
       
   348     User::LeaveIfError( iInterface.SetParameter( iSessionId, 
       
   349         iLinkId, iUlStreamId, iAudioSourceId, KMccMicGain, gainPckg3 ) );
       
   350         
       
   351     err = iInterface.SetParameter( iSessionId, 
       
   352         iLinkId, iDlStreamId, iAudioSinkId, KMccMicGain, gainPckg3 );
       
   353     if ( KErrNone == err )
       
   354         {
       
   355         // GAIN IS PROPERTY OF RECORD DEVICE ONLY
       
   356         //User::Leave( KErrTotalLossOfPrecision );
       
   357         }
       
   358     }
       
   359     
       
   360 // ---------------------------------------------------------------------------
       
   361 // CTestAudioControl::TestSetBalanceL
       
   362 // ---------------------------------------------------------------------------
       
   363 //
       
   364 void CTestAudioControl::TestSetBalanceL()
       
   365     {
       
   366     TInt error( KErrNone );            
       
   367     TPckgBuf<TInt> val;
       
   368     
       
   369     // TRY SOME INVALID VALUES
       
   370     val = KMMFBalanceMaxLeft - 1;
       
   371     error = iInterface.SetParameter( 
       
   372         iSessionId, iLinkId, iUlStreamId, iAudioSourceId, KMccMicBalance, val );
       
   373     if ( error == KErrNone )
       
   374         {
       
   375         //User::Leave( KErrTotalLossOfPrecision );
       
   376         }
       
   377     error = iInterface.SetParameter( 
       
   378         iSessionId, iLinkId, iDlStreamId, iAudioSinkId, KMccSpeakerBalance, val );
       
   379     if ( error == KErrNone )
       
   380         {
       
   381         //User::Leave( KErrTotalLossOfPrecision );
       
   382         }
       
   383 
       
   384     val = KMMFBalanceMaxRight + 1;
       
   385     error = iInterface.SetParameter( 
       
   386         iSessionId, iLinkId, iUlStreamId, iAudioSourceId, KMccMicBalance, val );
       
   387     if ( error == KErrNone )
       
   388         {
       
   389         //User::Leave( KErrTotalLossOfPrecision );
       
   390         }
       
   391     error = iInterface.SetParameter( 
       
   392         iSessionId, iLinkId, iDlStreamId, iAudioSinkId, KMccSpeakerBalance, val );
       
   393     if ( error == KErrNone )
       
   394         {
       
   395         //User::Leave( KErrTotalLossOfPrecision );
       
   396         }
       
   397         
       
   398     // TRY SOME VALID VALUES
       
   399     val = KMMFBalanceMaxLeft;
       
   400     User::LeaveIfError( iInterface.SetParameter( 
       
   401         iSessionId, iLinkId, iUlStreamId, iAudioSourceId, KMccMicBalance, val ) );
       
   402     User::LeaveIfError( iInterface.SetParameter( 
       
   403         iSessionId, iLinkId, iDlStreamId, iAudioSinkId, KMccSpeakerBalance, val ) );
       
   404         
       
   405     val = KMMFBalanceMaxRight;
       
   406     User::LeaveIfError( iInterface.SetParameter( 
       
   407         iSessionId, iLinkId, iUlStreamId, iAudioSourceId, KMccMicBalance, val ) );
       
   408     User::LeaveIfError( iInterface.SetParameter( 
       
   409         iSessionId, iLinkId, iDlStreamId, iAudioSinkId, KMccSpeakerBalance, val ) );
       
   410 
       
   411     // Check that the new value is taken into use
       
   412     val = KMMFBalanceCenter;
       
   413     User::LeaveIfError( iInterface.SetParameter( 
       
   414         iSessionId, iLinkId, iUlStreamId, iAudioSourceId, KMccMicBalance, val ) );
       
   415     TInt setBalance = val();
       
   416     User::LeaveIfError( iInterface.GetParameter( 
       
   417         iSessionId, iLinkId, iUlStreamId, iAudioSourceId, KMccSpeakerBalance, val ) );
       
   418     if ( setBalance != val() )
       
   419         {
       
   420         User::Leave( KErrTotalLossOfPrecision );
       
   421         }
       
   422 
       
   423     User::LeaveIfError( iInterface.SetParameter( 
       
   424         iSessionId, iLinkId, iDlStreamId, iAudioSinkId, KMccMicBalance, val ) );
       
   425     setBalance = val();
       
   426     User::LeaveIfError( iInterface.GetParameter( 
       
   427         iSessionId, iLinkId, iUlStreamId, iAudioSourceId, KMccSpeakerBalance, val ) );
       
   428     if ( setBalance != val() )
       
   429         {
       
   430         User::Leave( KErrTotalLossOfPrecision );
       
   431         }
       
   432 
       
   433     // WRONG ENUMERATION
       
   434     error = iInterface.SetParameter( 
       
   435         iSessionId, iLinkId, iUlStreamId, iAudioSourceId, KMccSpeakerBalance, val );
       
   436     if ( KErrNone == error )
       
   437         {
       
   438         //User::Leave( KErrTotalLossOfPrecision );
       
   439         }
       
   440     error = iInterface.SetParameter( 
       
   441         iSessionId, iLinkId, iDlStreamId, iAudioSinkId, KMccMicBalance, val );
       
   442     if ( KErrNone == error )
       
   443         {
       
   444         //User::Leave( KErrTotalLossOfPrecision );
       
   445         }
       
   446     }
       
   447     
       
   448 
       
   449 // ---------------------------------------------------------------------------
       
   450 // CTestAudioControl::CreateStreamsL
       
   451 // ---------------------------------------------------------------------------
       
   452 //
       
   453 void CTestAudioControl::CreateStreamsL()
       
   454     {
       
   455     User::LeaveIfError( iInterface.CreateSession( iSessionId ) );
       
   456     User::LeaveIfError(
       
   457         iInterface.CreateLink( iSessionId, KMccLinkGeneral, iLinkId,
       
   458             iNetsettings ) );
       
   459     iIfStub.WaitForEvent( iSessionId, iLinkId, 0, KMccLinkCreated );
       
   460     
       
   461     User::LeaveIfError(
       
   462         iInterface.AddDataSink( KMccRtpSinkUid, KNullDesC8, iRtpSinkId ) );
       
   463     User::LeaveIfError(
       
   464         iInterface.AddDataSource( KUidMmfAudioInput, KNullDesC8, iAudioSourceId ) );
       
   465     
       
   466     CMccCodecInformation* codec
       
   467         = FetchCodecByMimeSubtypeNameL( iInterface, KAMRSdpName );
       
   468     CleanupStack::PushL( codec );
       
   469     
       
   470     User::LeaveIfError( iInterface.CreateStream( iSessionId, iLinkId, iUlStreamId, 
       
   471         KMccAudioUplinkStream, *codec ) );
       
   472 
       
   473     User::LeaveIfError(
       
   474         iInterface.AddDataSink( KUidMmfAudioOutput, KNullDesC8, iAudioSinkId ) );
       
   475     User::LeaveIfError(
       
   476         iInterface.AddDataSource( KMccRtpSourceUid, KNullDesC8, iRtpSourceId ) );
       
   477     User::LeaveIfError( iInterface.CreateStream( iSessionId, iLinkId, iDlStreamId, 
       
   478         KMccAudioDownlinkStream, *codec ) );
       
   479     
       
   480     CleanupStack::PopAndDestroy( codec );
       
   481     }
       
   482     
       
   483 
       
   484 // ---------------------------------------------------------------------------
       
   485 // CTestAudioControl::DeleteStreamsL
       
   486 // ---------------------------------------------------------------------------
       
   487 //
       
   488 void CTestAudioControl::DeleteStreamsL()
       
   489     {
       
   490     /*
       
   491     User::LeaveIfError(
       
   492         iInterface.RemoveDataSource( iSessionId, iLinkId, iUlStreamId, iAudioSourceId ) );
       
   493     User::LeaveIfError(
       
   494         iInterface.RemoveDataSink( iSessionId, iLinkId, iUlStreamId, iRtpSinkId ) );
       
   495     User::LeaveIfError(
       
   496         iInterface.RemoveDataSource( iSessionId, iLinkId, iDlStreamId, iRtpSourceId ) );
       
   497     User::LeaveIfError(
       
   498         iInterface.RemoveDataSink( iSessionId, iLinkId, iDlStreamId, iAudioSinkId ) );
       
   499     */
       
   500     User::LeaveIfError( 
       
   501         iInterface.DeleteStream( iSessionId, iLinkId, iUlStreamId ) );
       
   502     User::LeaveIfError( 
       
   503         iInterface.DeleteStream( iSessionId, iLinkId, iDlStreamId ) );
       
   504     User::LeaveIfError( iInterface.CloseLink( iSessionId, iLinkId ) );
       
   505     User::LeaveIfError( iInterface.CloseSession( iSessionId ) );
       
   506     }
       
   507 
       
   508 // ---------------------------------------------------------------------------
       
   509 // CTestAudioControl::FetchCodecByMimeSubtypeNameL
       
   510 // ---------------------------------------------------------------------------
       
   511 //
       
   512 CMccCodecInformation* CTestAudioControl::FetchCodecByMimeSubtypeNameL( 
       
   513         const CMccInterface& aInterface, const TDesC8& aName ) const
       
   514     {
       
   515     RPointerArray<CMccCodecInformation> codecArray;
       
   516     CleanupResetAndDestroy< RPointerArray<CMccCodecInformation> >::PushL( codecArray );
       
   517     User::LeaveIfError( aInterface.GetCapabilities( codecArray ) );
       
   518     
       
   519     CMccCodecInformation* tmp = NULL;
       
   520     TInt ind( codecArray.Count() );
       
   521     
       
   522     while ( ( ind-- ) && ( NULL == tmp ) )
       
   523         {
       
   524         if ( codecArray[ind]->SdpName().Compare( aName ) == 0 )
       
   525             {
       
   526             tmp = codecArray[ind]->CloneDetailedL();
       
   527             }
       
   528         }
       
   529     
       
   530     if ( NULL == tmp )
       
   531         {
       
   532         User::Leave( KErrNotFound );
       
   533         }
       
   534     
       
   535     CleanupStack::PopAndDestroy( &codecArray );
       
   536     return tmp;
       
   537     }