multimediacommsengine/mmcesrv/mmcemediamanager/src/mceaudiosdpcodec.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2005 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 // INCLUDE FILES
       
    22 #include <e32base.h>
       
    23 #include <e32std.h>
       
    24 #include <e32def.h>
       
    25 #include <stringpool.h>
       
    26 
       
    27 #include <sdpdocument.h>
       
    28 #include <sdpcodecstringconstants.h>
       
    29 #include <sdpcodecstringpool.h>
       
    30 #include <sdpmediafield.h>
       
    31 #include <sdpattributefield.h>
       
    32 #include <sdprtpmapvalue.h>
       
    33 #include <sdpfmtattributefield.h>
       
    34 #include <sdporiginfield.h>
       
    35 
       
    36 #include "mcemediadefs.h"
       
    37 #include "mceaudiosdpcodec.h"
       
    38 #include "mcecomaudiostream.h"
       
    39 #include "mceaudiostream.h"
       
    40 #include "mcecomaudiocodec.h"
       
    41 #include "mcemediadefs.h"
       
    42 #include "mcecomfactory.h"
       
    43 #include "mcemmlogs.h"
       
    44 #include "mcecomrtpsource.h"
       
    45 #include "mcecomspeakersink.h"
       
    46 #include "mcecommicsource.h"
       
    47 #include "mcecomrtpsink.h"
       
    48 #include "mcedefs.h"
       
    49 
       
    50 
       
    51 // ================= MEMBER FUNCTIONS =======================
       
    52 
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // CMceAudioSdpCodec::NewL
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 CMceAudioSdpCodec* CMceAudioSdpCodec::NewL()
       
    59     {
       
    60     RStringF audio = MCE_SDP_STRING_AUDIOL();
       
    61         
       
    62     CMceAudioSdpCodec* self = new (ELeave) CMceAudioSdpCodec( audio );
       
    63     CleanupStack::PushL( self );
       
    64     self->ConstructL();
       
    65     CleanupStack::Pop( self );
       
    66 
       
    67     return self;
       
    68     
       
    69     }
       
    70 
       
    71 // -----------------------------------------------------------------------------
       
    72 // CMceAudioSdpCodec::CMceAudioSdpCodec
       
    73 // -----------------------------------------------------------------------------
       
    74 //
       
    75 CMceAudioSdpCodec::CMceAudioSdpCodec( RStringF aMedia )
       
    76     : CMceMediaSdpCodec( aMedia )
       
    77     {
       
    78     }
       
    79 
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CMceAudioSdpCodec::~CMceAudioSdpCodec
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 CMceAudioSdpCodec::~CMceAudioSdpCodec()
       
    86     {
       
    87     }
       
    88 
       
    89 // -----------------------------------------------------------------------------
       
    90 // CMceAudioSdpCodec::Encodes
       
    91 // -----------------------------------------------------------------------------
       
    92 //
       
    93 TBool CMceAudioSdpCodec::Encodes( const CMceComMediaStream& aStream ) const
       
    94     {
       
    95     return aStream.iStreamType != CMceComMediaStream::ELocalStream &&
       
    96            aStream.iType == KMceAudio;
       
    97     }
       
    98 
       
    99 
       
   100 // -----------------------------------------------------------------------------
       
   101 // CMceAudioSdpCodec::CodecsL
       
   102 // -----------------------------------------------------------------------------
       
   103 //
       
   104 const RPointerArray<CMceComCodec>& CMceAudioSdpCodec::CodecsL( CMceComMediaStream& aStream ) const
       
   105     {
       
   106     __ASSERT_ALWAYS( aStream.iType == KMceAudio, User::Leave( KErrArgument ) );
       
   107     MCE_DEFINE_AUDIO( stream, aStream );
       
   108 
       
   109 	return reinterpret_cast< const RPointerArray< CMceComCodec >& >( stream.Codecs() );
       
   110     }
       
   111 
       
   112 // -----------------------------------------------------------------------------
       
   113 // CMceAudioSdpCodec::EncodeRtpmapAttributeLC
       
   114 // -----------------------------------------------------------------------------
       
   115 //
       
   116 CSdpFmtAttributeField* CMceAudioSdpCodec::EncodeRtpmapAttributeLC( CMceComCodec& aCodec ) const
       
   117     {
       
   118     MCEMM_DEBUG( "CMceAudioSdpCodec::EncodeRtpmapAttributeLC(), Entry" )
       
   119     MCE_DEFINE_AUDIO_CODEC( codec, aCodec );
       
   120     
       
   121     CSdpFmtAttributeField* rtpmapAttribute = NULL;
       
   122     
       
   123     TUint payloadType = codec.iPayloadType;
       
   124     TPtrC8 codecName = codec.iSdpName; 
       
   125     TUint samplingFreq = codec.iSamplingFreq;      
       
   126         
       
   127     // Create rtpmap field for current codec
       
   128     rtpmapAttribute = EncodeRtpMapFieldsL( payloadType, 
       
   129                                            codecName, 
       
   130                                            samplingFreq,
       
   131                                            KMceSdpOptionalEncodingParam );
       
   132     
       
   133     CleanupStack::PushL( rtpmapAttribute );
       
   134     
       
   135     MCEMM_DEBUG_SVALUE( "encoded rtpmap", rtpmapAttribute->Value() )
       
   136     MCEMM_DEBUG( "CMceAudioSdpCodec::EncodeRtpmapAttributeLC(), Exit" )
       
   137     
       
   138     return rtpmapAttribute;
       
   139     
       
   140     
       
   141     }
       
   142 
       
   143 // -----------------------------------------------------------------------------
       
   144 // CMceAudioSdpCodec::EncodeMediaAttributesL
       
   145 // -----------------------------------------------------------------------------
       
   146 //
       
   147 void CMceAudioSdpCodec::EncodeMediaAttributesL( CMceComCodec& aCodec, 
       
   148                                                 CSdpMediaField& aMediaLine, 
       
   149                                                 CSdpFmtAttributeField& aRtpmap ) const
       
   150     {
       
   151     MCEMM_DEBUG( "CMceAudioSdpCodec::EncodeMediaAttributesL(), Entry" )
       
   152     MCE_DEFINE_AUDIO_CODEC( codec, aCodec );
       
   153     
       
   154     if ( aCodec.Stream()->ReceiveStream() )
       
   155         {
       
   156         if ( codec.iPTime && 
       
   157              codec.iMaxPTime &&
       
   158              !FindAttribute( SdpCodecStringConstants::EAttributePtime, aMediaLine ) )
       
   159             {            
       
   160             RStringF attributePtime = SDP_STRING( SdpCodecStringConstants::EAttributePtime );
       
   161             RStringF attributeMaxPtime = SDP_STRING( SdpCodecStringConstants::EAttributeMaxptime );
       
   162                
       
   163             MCE_DEFINE_DECSTR( ptime, codec.iPTime )
       
   164             MCE_DEFINE_DECSTR( maxptime, codec.iMaxPTime )
       
   165             
       
   166             CSdpAttributeField* ptimeLine = 
       
   167                 CSdpAttributeField::NewLC( attributePtime, ptime );
       
   168             CSdpAttributeField* maxptimeLine = 
       
   169                 CSdpAttributeField::NewLC( attributeMaxPtime, maxptime );
       
   170 
       
   171             MCEMM_DEBUG_SVALUE( "encoded ptime", ptime )
       
   172             MCEMM_DEBUG_SVALUE( "encoded maxptime", maxptime )
       
   173 
       
   174             aMediaLine.AttributeFields().AppendL( ptimeLine );
       
   175             // this creates dependency between ptime and payload type
       
   176             ptimeLine->AssignTo( aRtpmap );
       
   177             CleanupStack::Pop( maxptimeLine ); 
       
   178             
       
   179             aMediaLine.AttributeFields().AppendL( maxptimeLine );
       
   180             // this creates dependency between maxptime and payload type
       
   181             maxptimeLine->AssignTo( aRtpmap ); 
       
   182             CleanupStack::Pop( ptimeLine ); 
       
   183             }
       
   184         }
       
   185         
       
   186     MCEMM_DEBUG( "CMceAudioSdpCodec::EncodeMediaAttributesL(), Exit" )
       
   187     }
       
   188     
       
   189 // -----------------------------------------------------------------------------
       
   190 // CMceAudioSdpCodec::DecodeMediaAttributesL 
       
   191 // -----------------------------------------------------------------------------
       
   192 //
       
   193 void CMceAudioSdpCodec::DecodeMediaAttributesL(
       
   194     CSdpMediaField& aMediaLine, 
       
   195     CMceComCodec& aCodec,
       
   196     CSdpFmtAttributeField& /*aRtpmap*/ ) const
       
   197     {
       
   198     MCEMM_DEBUG( "CMceAudioSdpCodec::DecodeMediaAttributesL(), Entry ")
       
   199     
       
   200     MCE_DEFINE_AUDIO_CODEC( codec, aCodec );
       
   201     
       
   202     if ( aCodec.Stream()->SendStream() )
       
   203         {
       
   204 		RPointerArray<CSdpAttributeField>& attrfields =
       
   205 		    aMediaLine.AttributeFields();
       
   206 		
       
   207 		// Packet times are negotiated at session or media line level and thus 
       
   208 		// several codecs share common packet time values.
       
   209         for ( TInt index = 0; index < attrfields.Count(); index++ )
       
   210             {
       
   211             CSdpAttributeField* attrfield = attrfields[ index ];
       
   212             RStringF attribute;
       
   213             attribute = attrfield->Attribute();
       
   214             if ( attribute ==
       
   215                  SDP_STRING( SdpCodecStringConstants::EAttributePtime ) )
       
   216                 {
       
   217                 TUint ptime = ConvertDesToUintL( attrfield->Value() );
       
   218                 codec.SetPTime( ptime );
       
   219                 
       
   220                 MCEMM_DEBUG_DVALUE( "decoded ptime", ptime )
       
   221                 }
       
   222             else if ( attribute ==
       
   223                  SDP_STRING( SdpCodecStringConstants::EAttributeMaxptime ) )
       
   224                 {
       
   225                 TUint maxptime = ConvertDesToUintL( attrfield->Value() );
       
   226                 codec.SetMaxPTime( maxptime );
       
   227                 
       
   228                 MCEMM_DEBUG_DVALUE( "decoded maxptime", maxptime )
       
   229                 }
       
   230             else
       
   231                 {
       
   232                 // do not mind other attributes
       
   233                 }
       
   234             }
       
   235         }
       
   236     
       
   237     MCEMM_DEBUG_DVALUES( "exit ptime", codec.iPTime,
       
   238                          "maxptime", codec.iMaxPTime )
       
   239     MCEMM_DEBUG("CMceAudioSdpCodec::DecodeMediaAttributesL(), Exit ")
       
   240     }
       
   241 
       
   242 
       
   243 // -----------------------------------------------------------------------------
       
   244 // CMceAudioSdpCodec::CreateStreamLC
       
   245 // -----------------------------------------------------------------------------
       
   246 //
       
   247 CMceComMediaStream* CMceAudioSdpCodec::CreateStreamLC( TInt aType ) const
       
   248     {
       
   249     MCEMM_DEBUG( "CMceAudioSdpCodec::CreateStreamLC(), Entry" )
       
   250     CMceComAudioStream* audiostream = NULL;
       
   251             
       
   252     if( aType == SdpCodecStringConstants::EAttributeSendonly )
       
   253         {
       
   254         // downlink
       
   255         MCEMM_DEBUG( "create downlink" )
       
   256         audiostream = CreateDownlinkStreamL();
       
   257         }
       
   258     else if( aType == SdpCodecStringConstants::EAttributeRecvonly )        
       
   259         {
       
   260         // uplink 
       
   261         MCEMM_DEBUG( "create uplink" )
       
   262         audiostream = CreateUplinkStreamL();
       
   263         }
       
   264     else
       
   265         {
       
   266         // sendrcv 
       
   267         // create two way stream
       
   268         // create downlink
       
   269         MCEMM_DEBUG( "create two-way stream" )
       
   270         audiostream = CreateDownlinkStreamL();
       
   271         CleanupStack::PushL( audiostream );
       
   272         // create bounded uplink
       
   273         CMceComAudioStream *boundUplink = CreateUplinkStreamL();
       
   274         CleanupStack::PushL( boundUplink );
       
   275         audiostream->BindL( boundUplink );
       
   276         CleanupStack::Pop( boundUplink ); 
       
   277         CleanupStack::Pop( audiostream );
       
   278         }
       
   279     
       
   280     CleanupStack::PushL( audiostream );
       
   281     
       
   282     MCEMM_DEBUG( "CMceAudioSdpCodec::CreateStreamLC(), Exit" )
       
   283     return audiostream;
       
   284     
       
   285     }
       
   286 
       
   287 
       
   288 // -----------------------------------------------------------------------------
       
   289 // CMceAudioSdpCodec::UpdateStreamL
       
   290 // -----------------------------------------------------------------------------
       
   291 //
       
   292 void CMceAudioSdpCodec::UpdateStreamL( CMceComMediaStream& aStream, TInt aDirection ) const
       
   293     {
       
   294     MCEMM_DEBUG( "CMceAudioSdpCodec::UpdateStreamL(), Entry ")
       
   295     MCE_DEFINE_AUDIO( stream, aStream );
       
   296 
       
   297     CMceComAudioStream* audiostream = NULL;
       
   298     TInt streamType = stream.SdpStreamType();
       
   299     
       
   300     if ( aDirection != SdpCodecStringConstants::EAttributeInactive )
       
   301         {
       
   302         switch( streamType )
       
   303             {
       
   304             case SdpCodecStringConstants::EAttributeRecvonly:
       
   305                 {
       
   306                 //if direction is changed
       
   307                 if ( aDirection != SdpCodecStringConstants::EAttributeSendonly )
       
   308                     {
       
   309                     MCEMM_DEBUG( "update from recvonly to send" )
       
   310                     MCEMM_DEBUG( "create uplink" )
       
   311                     audiostream = CreateUplinkStreamL();
       
   312                     }
       
   313                 break;
       
   314                 }
       
   315             case SdpCodecStringConstants::EAttributeSendonly:
       
   316                 {
       
   317                 //if direction is changed
       
   318                 if ( aDirection != SdpCodecStringConstants::EAttributeRecvonly )
       
   319                     {
       
   320                     MCEMM_DEBUG( "update from sendonly to recv" )
       
   321                     MCEMM_DEBUG( "create downlink" )
       
   322                     audiostream = CreateDownlinkStreamL();
       
   323                     }
       
   324                 break;
       
   325                 }
       
   326             case SdpCodecStringConstants::EAttributeSendrecv:
       
   327             default:
       
   328                 {
       
   329                 break;
       
   330                 }
       
   331             }
       
   332         }
       
   333         
       
   334     if ( audiostream )
       
   335         {
       
   336         CleanupStack::PushL( audiostream );
       
   337 
       
   338         MCEMM_DEBUG( "cloning codecs" )
       
   339         
       
   340         for( TInt index = 0; index < stream.CodecCount(); ++index )
       
   341             {
       
   342             CMceComAudioCodec* codec = 
       
   343                 static_cast<CMceComAudioCodec*>( stream.CodecL( index )->CloneL() );
       
   344             CleanupStack::PushL( codec );
       
   345             
       
   346             MCEMM_DEBUG_SVALUE( "cloned codec", codec->iSdpName )
       
   347             
       
   348             audiostream->AddCodecL( codec );
       
   349             CleanupStack::Pop( codec );
       
   350             }
       
   351 
       
   352         stream.BindL( audiostream );
       
   353         audiostream->InitializeL( *aStream.Session() );
       
   354         
       
   355         MCEMM_DEBUG( "binded stream created" )
       
   356         CleanupStack::Pop( audiostream ); 
       
   357         }
       
   358     
       
   359     MCEMM_DEBUG( "CMceAudioSdpCodec::UpdateStreamL(), Exit" )
       
   360     }
       
   361 
       
   362 // -----------------------------------------------------------------------------
       
   363 // CMceAudioSdpCodec::CreateCodecLC
       
   364 // -----------------------------------------------------------------------------
       
   365 //
       
   366 CMceComCodec* CMceAudioSdpCodec::CreateCodecLC( CSdpFmtAttributeField& aRtpmap ) const
       
   367     {
       
   368     MCEMM_DEBUG( "CMceAudioSdpCodec::CreateCodecLC(), Entry" )
       
   369     
       
   370     CMceComAudioCodec* codec = NULL;
       
   371     
       
   372     const TDesC8& payloadType = aRtpmap.Format();
       
   373     const TDesC8& attributeValue = aRtpmap.Value();
       
   374     TSdpRtpmapValue rtpmapValue = TSdpRtpmapValue::DecodeL( attributeValue );
       
   375 
       
   376     TPtrC8 codecName = rtpmapValue.iEncName;
       
   377     TPtrC8 clockRate = rtpmapValue.iClockrate;
       
   378     
       
   379     TUint uintValPT = ConvertDesToUintL( payloadType );
       
   380     TUint uintValCR = ConvertDesToUintL( clockRate );
       
   381 
       
   382     if ( uintValPT > KMceMaxPTValue )
       
   383         {
       
   384 		MCEMM_DEBUG_DVALUE("CMceAudioSdpCodec::CreateCodecLC(), invalid payloadtype value ", uintValPT )
       
   385 		User::Leave( KErrNotSupported );        	
       
   386         }
       
   387     if ( IsSupported( codecName ) && IsPayloadTypeSupported( codecName, uintValPT ) )
       
   388         {
       
   389         TMceComAudioCodecFactory factory;
       
   390         codec =  factory.CreateLC( codecName );
       
   391         codec->iSamplingFreq = uintValCR;
       
   392         codec->iPayloadType = uintValPT;
       
   393         MCEMM_DEBUG_SVALUE( "created codec", codecName )
       
   394         MCEMM_DEBUG_DVALUE( "sampling frequence", uintValCR )
       
   395         MCEMM_DEBUG_DVALUE( "payload", uintValPT )
       
   396         }
       
   397     else
       
   398         {
       
   399         MCEMM_DEBUG_SVALUE( "not supported codec", codecName )
       
   400         }
       
   401         
       
   402     MCEMM_DEBUG( "CMceAudioSdpCodec::CreateCodecLC(), Exit" )
       
   403     
       
   404     return codec;
       
   405     }
       
   406 
       
   407 
       
   408 // -----------------------------------------------------------------------------
       
   409 // CMceAudioSdpCodec::CreateCodecLC
       
   410 // -----------------------------------------------------------------------------
       
   411 //
       
   412 CMceComCodec* CMceAudioSdpCodec::CreateCodecLC( TUint aPayload, 
       
   413                                                 CSdpMediaField& /*aMediaLine*/ ) const
       
   414     {
       
   415     MCEMM_DEBUG( "CMceAudioSdpCodec::CreateCodecLC( payload ), Entry" )
       
   416     
       
   417     TMceComAudioCodecFactory factory;
       
   418     CMceComAudioCodec* codec = NULL;
       
   419     
       
   420     codec = factory.CreateCodecLC( aPayload );
       
   421     if ( codec && !IsSupported( codec->iSdpName ) )
       
   422         {
       
   423         CleanupStack::PopAndDestroy( codec );
       
   424         codec = NULL;
       
   425         }
       
   426 
       
   427     MCEMM_DEBUG( "CMceAudioSdpCodec::CreateCodecLC( payload ), Exit" )
       
   428     
       
   429     return codec;
       
   430     }
       
   431 
       
   432     
       
   433 // -----------------------------------------------------------------------------
       
   434 // CMceAudioSdpCodec::DecodeSessionMediaAttributesL
       
   435 // -----------------------------------------------------------------------------
       
   436 //
       
   437 void CMceAudioSdpCodec::DecodeSessionMediaAttributesL( CMceComMediaStream& aStream, 
       
   438                                                        CSdpDocument& aSdpDocument ) const
       
   439     {
       
   440     MCEMM_DEBUG( "CMceAudioSdpCodec::DecodeSessionMediaAttributesL(), Entry" )
       
   441     MCE_DEFINE_AUDIO( stream, aStream );
       
   442     
       
   443     if ( stream.SendStream() )
       
   444         {
       
   445         RPointerArray<CSdpAttributeField>& attrfields = 
       
   446                                                 aSdpDocument.AttributeFields();
       
   447 
       
   448         // look for the ptime and maxptime attributes, go through all
       
   449         // attribute fields and apply to all codecs in the stream if found
       
   450         for ( TInt index = 0; index < attrfields.Count(); index++ )
       
   451             {
       
   452             CSdpAttributeField* attrfield = attrfields[ index ];
       
   453             RStringF attribute = attrfield->Attribute();
       
   454             TInt j = 0;
       
   455             if ( attribute == SDP_STRING( SdpCodecStringConstants::EAttributePtime ) )
       
   456                 {
       
   457                 MCEMM_DEBUG_SVALUE( "decoded ptime", attrfield->Value() )
       
   458 
       
   459                 for ( j = 0; j < stream.CodecCount(); j++ )
       
   460                     {
       
   461                     stream.CodecL( j )->iPTime = ConvertDesToUintL( attrfield->Value() );
       
   462                     }
       
   463                 }
       
   464             else if ( attribute == SDP_STRING( SdpCodecStringConstants::EAttributeMaxptime ) )
       
   465                 {
       
   466                 MCEMM_DEBUG_SVALUE( "decoded maxptime", attrfield->Value() )
       
   467 
       
   468                 for ( j = 0; j < stream.CodecCount(); j++ )
       
   469                     {
       
   470                     stream.CodecL( j )->iMaxPTime = ConvertDesToUintL( attrfield->Value() );
       
   471                     }   
       
   472                 }
       
   473             }
       
   474         }
       
   475         
       
   476     MCEMM_DEBUG( "CMceAudioSdpCodec::DecodeSessionMediaAttributesL(), Exit" )
       
   477     }
       
   478     
       
   479 // -----------------------------------------------------------------------------
       
   480 // CMceAudioSdpCodec::CreateUplinkStreamL
       
   481 // -----------------------------------------------------------------------------
       
   482 //
       
   483 CMceComAudioStream* CMceAudioSdpCodec::CreateUplinkStreamL() const
       
   484     {
       
   485     MCEMM_DEBUG( "CMceAudioSdpCodec::CreateUplinkStreamL(), Entry" )
       
   486     
       
   487     CMceComAudioStream *audiostream = CMceComAudioStream::NewL();
       
   488     CleanupStack::PushL( audiostream );
       
   489     // uplink           
       
   490     CMceComMicSource* micSource = CMceComMicSource::NewL();
       
   491     CleanupStack::PushL( micSource );
       
   492     micSource->InitializeL( static_cast<CMceComAudioStream&> ( *audiostream ) );
       
   493     audiostream->SetSourceL( micSource );
       
   494     CleanupStack::Pop( micSource );
       
   495     CMceComRtpSink* rtpSink = CMceComRtpSink::NewL();
       
   496     CleanupStack::PushL( rtpSink );
       
   497     rtpSink->InitializeL( static_cast<CMceComAudioStream&> ( *audiostream ) );
       
   498     audiostream->AddSinkL( rtpSink );
       
   499     CleanupStack::Pop( rtpSink ); 
       
   500     CleanupStack::Pop( audiostream );
       
   501     
       
   502     MCEMM_DEBUG( "CMceAudioSdpCodec::CreateUplinkStreamL(), Exit" )
       
   503     
       
   504     return audiostream;
       
   505     }
       
   506 
       
   507 // -----------------------------------------------------------------------------
       
   508 // CMceAudioSdpCodec::CreateDownlinkStreamL
       
   509 // -----------------------------------------------------------------------------
       
   510 //
       
   511 CMceComAudioStream* CMceAudioSdpCodec::CreateDownlinkStreamL() const
       
   512     {
       
   513     MCEMM_DEBUG( "CMceAudioSdpCodec::CreateDownlinkStreamL(), Entry" )
       
   514 
       
   515     CMceComAudioStream *audiostream = CMceComAudioStream::NewL();
       
   516     CleanupStack::PushL( audiostream ); 
       
   517     // downlink         
       
   518     CMceComRtpSource* rtpSource = CMceComRtpSource::NewL();
       
   519     CleanupStack::PushL( rtpSource );
       
   520     rtpSource->InitializeL( static_cast<CMceComAudioStream&> ( *audiostream ) );
       
   521     audiostream->SetSourceL( rtpSource );
       
   522     CleanupStack::Pop( rtpSource );
       
   523     CMceComSpeakerSink* speaker = CMceComSpeakerSink::NewL();
       
   524     CleanupStack::PushL( speaker );
       
   525     speaker->InitializeL( static_cast<CMceComAudioStream&> ( *audiostream ) );
       
   526     audiostream->AddSinkL( speaker );
       
   527     CleanupStack::Pop( speaker ); 
       
   528     CleanupStack::Pop( audiostream );
       
   529     
       
   530     MCEMM_DEBUG( "CMceAudioSdpCodec::CreateDownlinkStreamL(), Exit" )
       
   531     
       
   532     return audiostream;
       
   533     }
       
   534 
       
   535