multimediacommscontroller/mmccsubcontroller/src/mccsymulstream.cpp
branchrcs
changeset 49 64c62431ac08
parent 32 f2ed1fc4c163
equal deleted inserted replaced
44:fb024d5e35fa 49:64c62431ac08
    24 #include <mmf/server/mmfaudioinput.h>
    24 #include <mmf/server/mmfaudioinput.h>
    25 #include "mccsymulstream.h"
    25 #include "mccsymulstream.h"
    26 #include "mcculdatapath.h"
    26 #include "mcculdatapath.h"
    27 #include "mcccodecconfigurator.h"
    27 #include "mcccodecconfigurator.h"
    28 #include "mccrtpmanager.h"
    28 #include "mccrtpmanager.h"
       
    29 #include "mccmsrpmanager.h"
    29 #include "mccrtpdatasink.h"
    30 #include "mccrtpdatasink.h"
    30 #include "mmccinterface.h"
    31 #include "mmccinterface.h"
    31 #include "mccsubcontrollerlogs.h"
    32 #include "mccsubcontrollerlogs.h"
    32 #include "mccmultiplexer.h"
    33 #include "mccmultiplexer.h"
    33 #include "mccresources.h"
    34 #include "mccresources.h"
    79     iFormatEncode( NULL ), 
    80     iFormatEncode( NULL ), 
    80     iFourCC( aFourCC )
    81     iFourCC( aFourCC )
    81     {
    82     {
    82     iRtpMediaClock = &aClock;
    83     iRtpMediaClock = &aClock;
    83     }
    84     }
       
    85     
       
    86     
       
    87 // -----------------------------------------------------------------------------
       
    88 // CMccSymUlStream::CMccSymUlStream
       
    89 // C++ default constructor can NOT contain any code, that
       
    90 // might leave.
       
    91 // -----------------------------------------------------------------------------
       
    92 //
       
    93 CMccSymUlStream::CMccSymUlStream( 
       
    94     TUint32 aMccStreamId, 
       
    95     MAsyncEventHandler* aEventhandler, 
       
    96     MMccResources* aMccResources,
       
    97     CMccMsrpManager* aManager, 
       
    98     TFourCC aFourCC,
       
    99     TInt aStreamType, 
       
   100     CMccRtpMediaClock& aClock ) : 
       
   101     CMccSymStreamBase( aMccStreamId, 
       
   102                        aEventhandler, 
       
   103                        aMccResources, 
       
   104                        aManager, 
       
   105                        aStreamType ), 
       
   106     iFormatEncode( NULL ), 
       
   107     iFourCC( aFourCC )
       
   108     {
       
   109     iRtpMediaClock = &aClock;
       
   110     }
    84 
   111 
    85 // -----------------------------------------------------------------------------
   112 // -----------------------------------------------------------------------------
    86 // CMccSymUlStream::NewL
   113 // CMccSymUlStream::NewL
    87 // Two-phased constructor.
   114 // Two-phased constructor.
    88 // -----------------------------------------------------------------------------
   115 // -----------------------------------------------------------------------------
    90 CMccSymUlStream* CMccSymUlStream::NewLC( 
   117 CMccSymUlStream* CMccSymUlStream::NewLC( 
    91     TUint32 aMccStreamId, 
   118     TUint32 aMccStreamId, 
    92     MAsyncEventHandler* aEventhandler,
   119     MAsyncEventHandler* aEventhandler,
    93     MMccResources* aMccResources,
   120     MMccResources* aMccResources,
    94     CMccRtpManager* aManager, 
   121     CMccRtpManager* aManager, 
       
   122     TFourCC aFourCC,
       
   123     TInt aStreamType,
       
   124     CMccRtpMediaClock& aClock ) 
       
   125     {
       
   126     CMccSymUlStream* s = 
       
   127             new ( ELeave ) CMccSymUlStream( aMccStreamId, 
       
   128                                             aEventhandler, 
       
   129                                             aMccResources,
       
   130                                             aManager, 
       
   131                                             aFourCC, 
       
   132                                             aStreamType,
       
   133                                             aClock );
       
   134     CleanupStack::PushL( s );
       
   135     s->ConstructL();
       
   136     return s;
       
   137     }
       
   138 
       
   139 
       
   140 // -----------------------------------------------------------------------------
       
   141 // CMccSymUlStream::NewL
       
   142 // Two-phased constructor.
       
   143 // -----------------------------------------------------------------------------
       
   144 //
       
   145 CMccSymUlStream* CMccSymUlStream::NewLC( 
       
   146     TUint32 aMccStreamId, 
       
   147     MAsyncEventHandler* aEventhandler,
       
   148     MMccResources* aMccResources,
       
   149     CMccMsrpManager* aManager, 
    95     TFourCC aFourCC,
   150     TFourCC aFourCC,
    96     TInt aStreamType,
   151     TInt aStreamType,
    97     CMccRtpMediaClock& aClock ) 
   152     CMccRtpMediaClock& aClock ) 
    98     {
   153     {
    99     CMccSymUlStream* s = 
   154     CMccSymUlStream* s = 
   386     {
   441     {
   387 	__SUBCONTROLLER( "CMccSymUlStream::PrimeL" )
   442 	__SUBCONTROLLER( "CMccSymUlStream::PrimeL" )
   388 	
   443 	
   389     TBool controlNetworkResources = SetStateL( EStatePrepared, aEndpointId );  
   444     TBool controlNetworkResources = SetStateL( EStatePrepared, aEndpointId );  
   390     
   445     
   391     if ( controlNetworkResources && !LocalStream() )
   446     if(this->iType == KMccMessageUplinkStream)
       
   447         {
       
   448         iMsrpmanager->CreateTransmitStreamL (*iDatasink, iCodecInfo);
       
   449         }
       
   450     else if ( controlNetworkResources && !LocalStream())
   392         {
   451         {
   393         iRtpmanager->CreateTransmitStreamL( *iDatasink, iCodecInfo );
   452         iRtpmanager->CreateTransmitStreamL( *iDatasink, iCodecInfo );
   394         }
   453         }
       
   454 	else
       
   455 		{
       
   456 		//NOP
       
   457 		}
   395 
   458 
   396     LoadCodecL( iCodecInfo, KNullDesC8 );
   459     LoadCodecL( iCodecInfo, KNullDesC8 );
   397         
   460         
   398     DoPrimeL();
   461     DoPrimeL();
   399     
   462     
   413     {
   476     {
   414 	__SUBCONTROLLER( "CMccSymUlStream::PlayL" )
   477 	__SUBCONTROLLER( "CMccSymUlStream::PlayL" )
   415 	
   478 	
   416     TBool controlNetworkResources = SetStateL( EStateStreaming, aEndpointId );
   479     TBool controlNetworkResources = SetStateL( EStateStreaming, aEndpointId );
   417     
   480     
   418     if ( !LocalStream() )
   481     if ( !LocalStream() && (this->iType !=KMccMessageUplinkStream))
   419         {
   482         {
   420         if ( controlNetworkResources )
   483         if ( controlNetworkResources )
   421             {
   484             {
   422             iRtpmanager->StartSessionL();
   485             iRtpmanager->StartSessionL();
   423             }
   486             }
   443 //
   506 //
   444 void CMccSymUlStream::PauseL( const TUint32 aEndpointId, 
   507 void CMccSymUlStream::PauseL( const TUint32 aEndpointId, 
   445 							  TBool aEnableRtcp )
   508 							  TBool aEnableRtcp )
   446     {
   509     {
   447     __SUBCONTROLLER( "CMccSymUlStream::PauseL" )
   510     __SUBCONTROLLER( "CMccSymUlStream::PauseL" )
   448     
   511         
   449     SetStateL( EStatePaused, aEndpointId );
   512     SetStateL( EStatePaused, aEndpointId );
   450     
   513     if(this->iType != KMccMessageUplinkStream && !LocalStream())
   451     if ( !LocalStream() )
   514         {
   452         { 
   515         __ASSERT_ALWAYS( iRtpmanager, User::Leave( KErrArgument ) );
       
   516         __ASSERT_ALWAYS( iDatapath, User::Leave( KErrArgument ) );
       
   517         
   453         User::LeaveIfError( iRtpmanager->SetRTCPSendReceive( aEnableRtcp ) );
   518         User::LeaveIfError( iRtpmanager->SetRTCPSendReceive( aEnableRtcp ) );
   454         }
   519         }
   455     
   520     
   456     DoPauseL();
   521     DoPauseL();
   457 
   522 
   467 							   TBool aEnableRtcp )
   532 							   TBool aEnableRtcp )
   468     {
   533     {
   469     __SUBCONTROLLER( "CMccSymUlStream::ResumeL" )
   534     __SUBCONTROLLER( "CMccSymUlStream::ResumeL" )
   470     
   535     
   471     SetStateL( EStateStreaming, aEndpointId );
   536     SetStateL( EStateStreaming, aEndpointId );
   472     
   537     if (this->iType != KMccMessageUplinkStream &&  !LocalStream() )
   473     if ( !LocalStream() )
       
   474         { 
   538         { 
       
   539         __ASSERT_ALWAYS( iRtpmanager, User::Leave( KErrArgument ) );
       
   540         __ASSERT_ALWAYS( iDatapath, User::Leave( KErrArgument ) );
   475         User::LeaveIfError( iRtpmanager->SetRTCPSendReceive( aEnableRtcp ) );
   541         User::LeaveIfError( iRtpmanager->SetRTCPSendReceive( aEnableRtcp ) );
   476         }
   542         }
   477     
   543     else
       
   544         {
       
   545         //NOP
       
   546         }
   478     DoResumeL();
   547     DoResumeL();
   479 
   548 
   480     InformStreamStateChange( KMccStreamResumed, aEndpointId );
   549     InformStreamStateChange( KMccStreamResumed, aEndpointId );
   481     }
   550     }
   482 
   551