multimediacommscontroller/mmccsubcontroller/src/mccdtmfulstream.cpp
changeset 0 1bce908db942
child 32 f2ed1fc4c163
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2006-2008 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:    Provides DTMF support
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include <mmf/server/mmfformat.h>
       
    22 #include "mccdtmfulstream.h"
       
    23 #include "mccsubcontrollerlogs.h"
       
    24 #include "mccdatasink.h"
       
    25 #include "mcccodecconfigurator.h"
       
    26 #include "mccrtpmanager.h"
       
    27 #include "mccrtpdatasink.h"
       
    28 #include "dtmfpayloadformatwrite.h"
       
    29 #include "mccrtpmediaclock.h"
       
    30 #include "mccresources.h"
       
    31 #include "mccinternaldef.h"
       
    32 #include "mccrtpdatasource.h"
       
    33 
       
    34 
       
    35 // ======== MEMBER FUNCTIONS ========
       
    36 
       
    37 // ---------------------------------------------------------------------------
       
    38 // C++ default constructor can NOT contain any code, that might leave.
       
    39 // ---------------------------------------------------------------------------
       
    40 //
       
    41 CMccDtmfUlStream::CMccDtmfUlStream( TUint32 aMccStreamId, 
       
    42         MAsyncEventHandler* aEventhandler, MMccResources* aMccResources,
       
    43         CMccRtpManager* aManager, TFourCC aFourCC, TInt aStreamType,
       
    44         CMccRtpMediaClock& aClock )
       
    45     :
       
    46     CMccSymStreamBase( aMccStreamId, aEventhandler, aMccResources, aManager, 
       
    47         aStreamType ), iFourCC( aFourCC )
       
    48     {
       
    49     iRtpMediaClock = &aClock;
       
    50     }
       
    51 
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // Symbian 2nd phase constructor can leave.
       
    55 // ---------------------------------------------------------------------------
       
    56 //
       
    57 void CMccDtmfUlStream::ConstructL()
       
    58     {
       
    59 	__SUBCONTROLLER( "CMccDtmfUlStream::ConstructL" )
       
    60 	__SUBCONTROLLER( "CMccDtmfUlStream::ConstructL, exit" )
       
    61     }
       
    62 
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // Two-phased constructor.
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 CMccDtmfUlStream* CMccDtmfUlStream::NewL( TUint32 aMccStreamId, 
       
    69         MAsyncEventHandler* aEventHandler, MMccResources* aMccResources,
       
    70         CMccRtpManager* aManager, TFourCC aFourCC, TInt aStreamType,
       
    71         CMccRtpMediaClock& aClock )
       
    72     {
       
    73     CMccDtmfUlStream* self = CMccDtmfUlStream::NewLC( aMccStreamId, aEventHandler,
       
    74         aMccResources, aManager, aFourCC, aStreamType, aClock );
       
    75     CleanupStack::Pop( self );
       
    76     return self;
       
    77     }
       
    78 
       
    79 
       
    80 // ---------------------------------------------------------------------------
       
    81 // Two-phased constructor.
       
    82 // ---------------------------------------------------------------------------
       
    83 //
       
    84 CMccDtmfUlStream* CMccDtmfUlStream::NewLC( TUint32 aMccStreamId, 
       
    85         MAsyncEventHandler* aEventHandler, MMccResources* aMccResources,
       
    86         CMccRtpManager* aManager, TFourCC aFourCC, TInt aStreamType,
       
    87         CMccRtpMediaClock& aClock )
       
    88     {
       
    89     CMccDtmfUlStream* self = new( ELeave ) CMccDtmfUlStream( aMccStreamId,
       
    90         aEventHandler, aMccResources, aManager, aFourCC, aStreamType, aClock );
       
    91     CleanupStack::PushL( self );
       
    92     self->ConstructL();
       
    93     return self;
       
    94     }
       
    95 
       
    96 
       
    97 // ---------------------------------------------------------------------------
       
    98 // Destructor.
       
    99 // ---------------------------------------------------------------------------
       
   100 //
       
   101 CMccDtmfUlStream::~CMccDtmfUlStream()
       
   102     {
       
   103     __SUBCONTROLLER( "CMccDtmfUlStream::~CMccDtmfUlStream" )
       
   104     
       
   105     // Must do mux cleanup before decoder (mux sink) deletion
       
   106     MultiplexerCleanup();
       
   107     
       
   108     if ( iFormatEncode )
       
   109         {
       
   110         iFormatEncode->SinkThreadLogoff();
       
   111         delete iFormatEncode;
       
   112         }
       
   113 
       
   114     __SUBCONTROLLER( "CMccDtmfUlStream::~CMccDtmfUlStream, exit" )
       
   115     }
       
   116 
       
   117 // ---------------------------------------------------------------------------
       
   118 // From class CMccSymStreamBase.
       
   119 // Sets the MMF priority settings for this stream.
       
   120 // ---------------------------------------------------------------------------
       
   121 //
       
   122 void CMccDtmfUlStream::SetPrioritySettingsL( 
       
   123         const TMMFPrioritySettings& aPriority )
       
   124     {
       
   125     __SUBCONTROLLER( "CMccDtmfUlStream::SetPrioritySettingsL start" );
       
   126     
       
   127    
       
   128     if ( iFormatEncode )
       
   129         {
       
   130         iFormatEncode->SetSinkPrioritySettings( aPriority );
       
   131         }
       
   132     
       
   133     __SUBCONTROLLER( "CMccDtmfUlStream::SetPrioritySettingsL end ");
       
   134     }
       
   135 
       
   136 // ---------------------------------------------------------------------------
       
   137 // From class CMccSymStreamBase.
       
   138 // Adds the sink and source to the stream.
       
   139 // ---------------------------------------------------------------------------
       
   140 //
       
   141 void CMccDtmfUlStream::AddSinkAndSourceL( MDataSink* aDataSink,
       
   142         MDataSource* aDataSource )
       
   143     {
       
   144 	__SUBCONTROLLER( "CMccDtmfUlStream::AddSinkAndSourceL" )
       
   145     __ASSERT_ALWAYS( aDataSink && aDataSource, User::Leave( KErrArgument ) );
       
   146     __ASSERT_ALWAYS( aDataSink->DataSinkType() == KMccRtpSinkUid,
       
   147         User::Leave( KErrArgument ) );
       
   148     __ASSERT_ALWAYS( aDataSource->DataSourceType() == KMccAnySourceUid,
       
   149         User::Leave( KErrArgument ) );
       
   150     
       
   151 	__SUBCONTROLLER( "CMccDtmfUlStream::AddSinkAndSourceL, adding" )
       
   152 	iDatasink = aDataSink;
       
   153 	iDatasource = aDataSource;
       
   154     
       
   155     User::LeaveIfError( iDatasource->SourceThreadLogon( *this ) );
       
   156     
       
   157     __SUBCONTROLLER( "CMccDtmfUlStream::AddSinkAndSourceL, exit" )
       
   158     }
       
   159 
       
   160 // ---------------------------------------------------------------------------
       
   161 // From class CMccSymStreamBase.
       
   162 // Loads a codec to the stream.
       
   163 // ---------------------------------------------------------------------------
       
   164 //
       
   165 void CMccDtmfUlStream::LoadCodecL( const TMccCodecInfo& aCodecInfo, 
       
   166         const TDesC8& aFmtp )
       
   167     {
       
   168      __SUBCONTROLLER_INT1( "CMccDtmfUlStream::LoadCodecL, codec state:", 
       
   169                           CurrentCodecState() )
       
   170     
       
   171     __ASSERT_ALWAYS( CurrentCodecState() == EStateCodecNone || 
       
   172                      iCodecInfo.iFourCC == aCodecInfo.iFourCC,
       
   173                      User::Leave( KErrArgument ) );
       
   174     __ASSERT_ALWAYS( iDatasink && iDatasource, User::Leave( KErrNotReady ) );
       
   175         
       
   176     iCodecInfo = aCodecInfo;
       
   177     
       
   178     if ( CurrentCodecState() == EStateCodecNone )
       
   179         {
       
   180         delete iFmtpAttr;
       
   181         iFmtpAttr = NULL;
       
   182 
       
   183     	iFmtpAttr = HBufC8::NewL( aFmtp.Length() );
       
   184         iFmtpAttr->Des().Copy( aFmtp );
       
   185         
       
   186         iCodecInfo.iFmtpLength = iFmtpAttr->Length();
       
   187                 
       
   188         CreatePayloadFormatEncoderL();
       
   189         
       
   190         CMccRtpDataSink* dataSink = static_cast<CMccRtpDataSink*>( iDatasink );        
       
   191         dataSink->SetMediaClock( *iRtpMediaClock ); 
       
   192         
       
   193         SetCodecState( EStateCodecNegotiated );        	
       
   194         }
       
   195     else if ( CurrentCodecState() == EStateCodecNegotiated )
       
   196         {
       
   197         SetCodecState( EStateCodecLoaded );
       
   198         
       
   199         // Codec is not fully usable yet, do just formatter initialization
       
   200         MccCodecConfigurator::ConfigureCodecL( *iDatasource, 
       
   201                                                 *iFormatEncode, 
       
   202                                                 iCodecInfo,
       
   203                                                 *iRtpMediaClock,
       
   204                                                 CurrentCodecState() );
       
   205         }
       
   206     else if ( CurrentCodecState() == EStateCodecLoaded ||
       
   207               CurrentCodecState() == EStateCodecLoadedAndUpdating )
       
   208         {
       
   209         // Update codec info
       
   210         SetCodecState( EStateCodecLoadedAndUpdating );
       
   211     	UpdateCodecInformationL( iCodecInfo );
       
   212         }
       
   213     else
       
   214         {
       
   215         User::Leave( KErrNotReady );
       
   216         }
       
   217         
       
   218     __SUBCONTROLLER_INT1( "CMccDtmfUlStream::LoadCodecL, exit, new state:", 
       
   219                           CurrentCodecState() )
       
   220     }
       
   221 
       
   222 // ---------------------------------------------------------------------------
       
   223 // From class CMccSymStreamBase.
       
   224 // Primes the stream ready.
       
   225 // ---------------------------------------------------------------------------
       
   226 //
       
   227 void CMccDtmfUlStream::PrimeL( const TUint32 aEndpointId )
       
   228     {
       
   229 	__SUBCONTROLLER( "CMccDtmfUlStream::PrimeL" )
       
   230     __ASSERT_ALWAYS( iFormatEncode && iDatasink && iDatasource, 
       
   231                      User::Leave( KErrNotReady ) );
       
   232 	
       
   233     TBool controlNetworkResources = SetStateL( EStatePrepared, aEndpointId );  
       
   234     
       
   235     if ( controlNetworkResources )
       
   236         {
       
   237         iRtpmanager->CreateTransmitStreamL( *iDatasink, iCodecInfo );
       
   238         }
       
   239         
       
   240     LoadCodecL( iCodecInfo, KNullDesC8 );
       
   241     
       
   242     if ( IsControlled( MCC_ENDPOINT_ID( iDatasink ) ) )
       
   243         {
       
   244         iFormatEncode->SinkPrimeL();
       
   245         }
       
   246     
       
   247     if ( IsControlled( MCC_ENDPOINT_ID( iDatasource ) ) )
       
   248         {
       
   249         iDatasource->SourcePrimeL();
       
   250         }
       
   251 
       
   252     InformStreamStateChange( KMccStreamPrepared, aEndpointId );
       
   253     
       
   254 	__SUBCONTROLLER( "CMccDtmfUlStream::PrimeL, exit" )
       
   255     }
       
   256 
       
   257 // ---------------------------------------------------------------------------
       
   258 // From class CMccSymStreamBase.
       
   259 // Starts the stream. DTMF can be now sent and received.
       
   260 // ---------------------------------------------------------------------------
       
   261 //
       
   262 void CMccDtmfUlStream::PlayL( 
       
   263     const TUint32 aEndpointId, 
       
   264     TBool /*aStreamPaused*/, 
       
   265     TBool /*aEnableRtcp*/ )
       
   266     {
       
   267 	__SUBCONTROLLER( "CMccDtmfUlStream::PlayL" )
       
   268     __ASSERT_ALWAYS( iFormatEncode && iDatasink && iDatasource, 
       
   269                      User::Leave( KErrNotReady ) );
       
   270 	
       
   271     TBool controlNetworkResources = SetStateL( EStateStreaming, aEndpointId );
       
   272     
       
   273     if ( controlNetworkResources )
       
   274         {
       
   275         iRtpmanager->StartSessionL();
       
   276         }
       
   277     
       
   278     LoadCodecL( iCodecInfo, KNullDesC8 );
       
   279     
       
   280     if ( IsControlled( MCC_ENDPOINT_ID( iDatasink ) ) )
       
   281         {
       
   282         iFormatEncode->SinkPlayL();
       
   283         }
       
   284     
       
   285     if ( IsControlled( MCC_ENDPOINT_ID( iDatasource ) ) )
       
   286         {
       
   287         iDatasource->SourcePlayL();
       
   288         }
       
   289 
       
   290     InformStreamStateChange( KMccStreamStarted, aEndpointId );
       
   291     
       
   292 	__SUBCONTROLLER( "CMccDtmfUlStream::PlayL, exit" )
       
   293     }
       
   294 
       
   295 // ---------------------------------------------------------------------------
       
   296 // From class CMccSymStreamBase.
       
   297 // Pauses the stream. DTMF sending and receiving are not possible in paused
       
   298 // state.
       
   299 // ---------------------------------------------------------------------------
       
   300 //
       
   301 void CMccDtmfUlStream::PauseL( const TUint32 aEndpointId, TBool /*aEnableRtcp*/ )
       
   302     {
       
   303     __SUBCONTROLLER( "CMccDtmfUlStream::PauseL" )
       
   304     __ASSERT_ALWAYS( iFormatEncode && iDatasink && iDatasource, 
       
   305                      User::Leave( KErrNotReady ) );
       
   306     
       
   307     SetStateL( EStatePaused, aEndpointId );
       
   308     
       
   309     if ( IsControlled( MCC_ENDPOINT_ID( iDatasink ) ) )
       
   310         {
       
   311         iFormatEncode->SinkPauseL();
       
   312         }
       
   313     
       
   314     if ( IsControlled( MCC_ENDPOINT_ID( iDatasource ) ) )
       
   315         {
       
   316         iDatasource->SourcePauseL();
       
   317         }
       
   318     
       
   319     InformStreamStateChange( KMccStreamPaused, aEndpointId );
       
   320     
       
   321     __SUBCONTROLLER( "CMccDtmfUlStream::PauseL, exit" )
       
   322     }
       
   323 
       
   324 // ---------------------------------------------------------------------------
       
   325 // From class CMccSymStreamBase.
       
   326 // Resumes the stream.
       
   327 // ---------------------------------------------------------------------------
       
   328 //
       
   329 void CMccDtmfUlStream::ResumeL( const TUint32 aEndpointId, TBool /*aEnableRtcp*/ )
       
   330     {
       
   331     __SUBCONTROLLER( "CMccDtmfUlStream::ResumeL" )
       
   332     __ASSERT_ALWAYS( iFormatEncode && iDatasink && iDatasource, 
       
   333                      User::Leave( KErrNotReady ) );
       
   334     
       
   335     SetStateL( EStateStreaming, aEndpointId );
       
   336     
       
   337     if ( IsControlled( MCC_ENDPOINT_ID( iDatasink ) ) )
       
   338         {
       
   339         iFormatEncode->SinkPlayL();
       
   340         }
       
   341     
       
   342     if ( IsControlled( MCC_ENDPOINT_ID( iDatasource ) ) )
       
   343         {
       
   344         iDatasource->SourcePlayL();
       
   345         }
       
   346     
       
   347     InformStreamStateChange( KMccStreamResumed, aEndpointId );
       
   348 
       
   349     __SUBCONTROLLER( "CMccDtmfUlStream::ResumeL, exit" )
       
   350     }
       
   351 
       
   352 // ---------------------------------------------------------------------------
       
   353 // From class CMccSymStreamBase.
       
   354 // Stops the stream.
       
   355 // ---------------------------------------------------------------------------
       
   356 //
       
   357 void CMccDtmfUlStream::StopL( const TUint32 aEndpointId )
       
   358     {
       
   359     __SUBCONTROLLER( "CMccDtmfUlStream::StopL" )
       
   360     __ASSERT_ALWAYS( iFormatEncode && iDatasink && iDatasource, 
       
   361                      User::Leave( KErrNotReady ) );
       
   362     
       
   363     SetStateL( EStateStopped, aEndpointId );
       
   364     
       
   365     if ( IsControlled( MCC_ENDPOINT_ID( iDatasink ) ) )
       
   366         {
       
   367         iFormatEncode->SinkStopL();
       
   368         }
       
   369     
       
   370     if ( IsControlled( MCC_ENDPOINT_ID( iDatasource ) ) )
       
   371         {
       
   372         iDatasource->SourceStopL();
       
   373         }
       
   374     
       
   375     InformStreamStateChange( KMccStreamStopped, aEndpointId );
       
   376     
       
   377     __SUBCONTROLLER( "CMccDtmfUlStream::StopL, exit" )
       
   378     }
       
   379 
       
   380 // ---------------------------------------------------------------------------
       
   381 // From class CMccSymStreamBase.
       
   382 // Resets jitterbuffer.
       
   383 // ---------------------------------------------------------------------------
       
   384 //
       
   385 void CMccDtmfUlStream::ResetCountersL()
       
   386     {
       
   387     __SUBCONTROLLER( "CMccDtmfUlStream::ResetCountersL - NO_OP" )
       
   388     }
       
   389 
       
   390 // ---------------------------------------------------------------------------
       
   391 // From class CMccSymStreamBase.
       
   392 // Sets the current record/play balance depending on the stream type.
       
   393 // ---------------------------------------------------------------------------
       
   394 //
       
   395 void CMccDtmfUlStream::SetBalanceL( TInt /*aLeftbal*/, TInt /*aRightbal*/ )
       
   396     {
       
   397     __SUBCONTROLLER( "CMccDtmfUlStream::SetBalanceL - NO_OP" )
       
   398     }
       
   399 
       
   400 // ---------------------------------------------------------------------------
       
   401 // From class CMccSymStreamBase.
       
   402 // Gets the current record/play balance depending on the stream type
       
   403 // ---------------------------------------------------------------------------
       
   404 //
       
   405 void CMccDtmfUlStream::GetBalanceL( TInt& /*aLeftbal*/, TInt& /*aRightbal*/ )
       
   406     {
       
   407     __SUBCONTROLLER( "CMccDtmfUlStream::GetBalanceL - NO_OP" )
       
   408     }
       
   409 
       
   410 // ---------------------------------------------------------------------------
       
   411 // From class CMccSymStreamBase.
       
   412 // Sends a media event to the uplink.
       
   413 // ---------------------------------------------------------------------------
       
   414 //
       
   415 void CMccDtmfUlStream::SendMediaSignalL( const TMccEvent& aEvent )
       
   416     {
       
   417     __SUBCONTROLLER( "CMccDtmfUlStream::SendMediaSignalL" )
       
   418     __ASSERT_ALWAYS( iFormatEncode, User::Leave( KErrNotReady ) );
       
   419     
       
   420     if ( KMccDtmfControl == aEvent.iEventType )
       
   421         {
       
   422         const TMccDtmfEventData& dtmfEvent = 
       
   423             (*reinterpret_cast<const TMccDtmfEventDataPackage*>( 
       
   424                 &aEvent.iEventData ))();
       
   425 
       
   426         CDTMFPayloadFormatWrite* p 
       
   427             = static_cast<CDTMFPayloadFormatWrite*>( iFormatEncode );
       
   428         
       
   429         switch ( dtmfEvent.iDtmfEventType )
       
   430             {
       
   431             case KMccDtmfSigStartTone:
       
   432                 p->StartDTMFToneL( dtmfEvent.iDtmfString[0] );
       
   433                 break;
       
   434             case KMccDtmfSigStopTone:
       
   435                 p->StopDTMFToneL();
       
   436                 break;
       
   437             case KMccDtmfSigSendString:
       
   438                 p->SendDTMFTonesL( dtmfEvent.iDtmfString );
       
   439                 break;
       
   440             case KMccDtmfSigContinueSending:
       
   441                 p->ContinueDTMFStringSending( dtmfEvent.iContinue );
       
   442                 break;
       
   443             case KMccDtmfSigCancelSending:
       
   444                 p->CancelDTMFStringSending();
       
   445                 break;
       
   446             default:
       
   447                 __SUBCONTROLLER( "CMccDtmfUlStream::SendMediaSignalL - DEFCASE" )
       
   448                 break;
       
   449             }
       
   450         }
       
   451     else
       
   452         {
       
   453         __SUBCONTROLLER( "CMccDtmfUlStream::SendMediaSignalL - NOT DTMF EVENT" )
       
   454         User::Leave( KErrNotSupported );
       
   455         }
       
   456 
       
   457     __SUBCONTROLLER( "CMccDtmfUlStream::SendMediaSignalL, exit" )
       
   458     }
       
   459     
       
   460 // ---------------------------------------------------------------------------
       
   461 // From class CMccSymStreamBase.
       
   462 // Starts inactivity timer for a stream in a given session.
       
   463 // ---------------------------------------------------------------------------
       
   464 //
       
   465 void CMccDtmfUlStream::StartInactivityTimerL( TUint32 /*aTimeoutTime*/ )
       
   466     {
       
   467     __SUBCONTROLLER( "CMccDtmfUlStream::StartInactivityTimerL - NO_OP" )
       
   468     // TBD: Should be pointed once to the RTP source endpoint
       
   469     };
       
   470 
       
   471 // ---------------------------------------------------------------------------
       
   472 // From class CMccSymStreamBase.
       
   473 // Stops inactivity timer for a stream in a given session.
       
   474 // ---------------------------------------------------------------------------
       
   475 void CMccDtmfUlStream::StopInactivityTimerL()
       
   476     {
       
   477     __SUBCONTROLLER( "CMccDtmfUlStream::StopInactivityTimerL - NO_OP" )
       
   478     // TBD: Should be pointed once to the RTP source endpoint
       
   479     }
       
   480 
       
   481 // ---------------------------------------------------------------------------
       
   482 // From class CMccSymStreamBase.
       
   483 // Get synchronization source identifier used by this stream.
       
   484 // ---------------------------------------------------------------------------
       
   485 //
       
   486 void CMccDtmfUlStream::GetSSRCL( TUint32& aSSRCValue )
       
   487     {
       
   488     __SUBCONTROLLER( "CMccDtmfUlStream::GetSSRCL" )
       
   489     __ASSERT_ALWAYS( iDatasink, User::Leave( KErrNotReady ) );
       
   490     
       
   491     aSSRCValue = static_cast<CMccRtpDataSink*>( iDatasink )->GetSSRC();
       
   492     
       
   493     __SUBCONTROLLER( "CMccDtmfUlStream::GetSSRCL, exit" )
       
   494     }
       
   495 
       
   496 // ---------------------------------------------------------------------------
       
   497 // From class CMccSymStreamBase.
       
   498 // 
       
   499 // ---------------------------------------------------------------------------
       
   500 //
       
   501 TBool CMccDtmfUlStream::IsUplink()
       
   502     {
       
   503     __SUBCONTROLLER( "CMccDtmfUlStream::IsUplink" )
       
   504     
       
   505     return ETrue;
       
   506     }
       
   507 
       
   508 // ---------------------------------------------------------------------------
       
   509 // From class CMccSymStreamBase.
       
   510 // 
       
   511 // ---------------------------------------------------------------------------
       
   512 //
       
   513 void CMccDtmfUlStream::StandByL()
       
   514     {
       
   515     __SUBCONTROLLER( "CMccDtmfUlStream::StandByL" )
       
   516     }
       
   517 
       
   518 // -----------------------------------------------------------------------------
       
   519 // CMccDtmfUlStream::CreatePayloadFormatEncoderL
       
   520 // Creates a payload format encoder for DTMF payload encoding.
       
   521 // -----------------------------------------------------------------------------
       
   522 //
       
   523 void CMccDtmfUlStream::CreatePayloadFormatEncoderL()
       
   524     {
       
   525 	__SUBCONTROLLER( "CMccDtmfUlStream::CreatePayloadFormatEncoderL" )
       
   526 	__ASSERT_ALWAYS( NULL == iFormatEncode, User::Leave( KErrAlreadyExists ) );
       
   527 	
       
   528     TUid formatuid;
       
   529     formatuid.iUid = static_cast<TInt32>( iCodecInfo.iPayloadFormatEncoder );
       
   530     iFormatEncode = CMMFFormatEncode::NewL( formatuid, iDatasink );
       
   531 	iFormatEncode->SetSinkDataTypeCode( iCodecInfo.iFourCC, iCodecInfo.iType );
       
   532     
       
   533     User::LeaveIfError( iFormatEncode->SinkThreadLogon( *this ) );
       
   534     iFormatEncode->SetSinkPrioritySettings( iPrioritySettings );
       
   535     
       
   536 	__SUBCONTROLLER( "CMccDtmfUlStream::CreatePayloadFormatEncoderL, exit" )
       
   537     }
       
   538     
       
   539 // -----------------------------------------------------------------------------
       
   540 // CMccDtmfUlStreams::UpdateCodecInformationL
       
   541 // Updates codec parameters dynamically.
       
   542 // -----------------------------------------------------------------------------
       
   543 //
       
   544 void CMccDtmfUlStream::UpdateCodecInformationL( TMccCodecInfo& aCodecInfo )
       
   545     {
       
   546 	__SUBCONTROLLER( "CMccDtmfUlStream::UpdateCodecInformationL" )
       
   547     __ASSERT_ALWAYS( iFormatEncode && iDatasink && iDatasource, 
       
   548                      User::Leave( KErrNotReady ) );
       
   549     
       
   550     MccCodecConfigurator::ConfigureCodecL( *iDatasource, 
       
   551         *iFormatEncode, aCodecInfo, *iRtpMediaClock, CurrentCodecState() );
       
   552     
       
   553 	__SUBCONTROLLER( "CMccDtmfUlStream::UpdateCodecInformationL, exit" )
       
   554     }
       
   555