multimediacommscontroller/mmccsubcontroller/src/mccsymsimpledlstream.cpp
branchrcs
changeset 49 64c62431ac08
parent 32 f2ed1fc4c163
equal deleted inserted replaced
44:fb024d5e35fa 49:64c62431ac08
    23 #include "mccsymsimpledlstream.h"
    23 #include "mccsymsimpledlstream.h"
    24 #include "mccdldatapath.h"
    24 #include "mccdldatapath.h"
    25 #include "mccjitterbuffer.h"
    25 #include "mccjitterbuffer.h"
    26 #include "mccuids.hrh"
    26 #include "mccuids.hrh"
    27 #include "mccrtpmanager.h"
    27 #include "mccrtpmanager.h"
       
    28 #include "mccmsrpmanager.h"
    28 #include "mcccodecconfigurator.h"
    29 #include "mcccodecconfigurator.h"
    29 #include "mccinternaldef.h"
    30 #include "mccinternaldef.h"
    30 #include "mccvideosink.h"
    31 #include "mccvideosink.h"
    31 #include "mccsubcontrollerlogs.h"
    32 #include "mccsubcontrollerlogs.h"
    32 #include "mccmultiplexer.h"
    33 #include "mccmultiplexer.h"
    59                        aStreamType )
    60                        aStreamType )
    60     {
    61     {
    61     iFourCC = aFourCC;
    62     iFourCC = aFourCC;
    62     iRtpMediaClock = &aClock;
    63     iRtpMediaClock = &aClock;
    63     }
    64     }
       
    65 	
       
    66 	// -----------------------------------------------------------------------------
       
    67 // CMccSymSimpleDlStream::CMccSymSimpleDlStream
       
    68 // C++ default constructor can NOT contain any code, that
       
    69 // might leave.
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 CMccSymSimpleDlStream::CMccSymSimpleDlStream( 
       
    73     TUint32 aMccStreamId, 
       
    74     MAsyncEventHandler* aEventhandler, 
       
    75     MMccResources* aMccResources,
       
    76     CMccMsrpManager* aManager, 
       
    77     TFourCC aFourCC,
       
    78     TInt aStreamType,
       
    79 	CMccRtpMediaClock& aClock ) : 
       
    80     CMccSymStreamBase( aMccStreamId, 
       
    81                        aEventhandler, 
       
    82                        aMccResources, 
       
    83                        aManager, 
       
    84                        aStreamType )
       
    85     {
       
    86     iFourCC = aFourCC;
       
    87 	iRtpMediaClock = &aClock;
       
    88     } 
    64 
    89 
    65 // -----------------------------------------------------------------------------
    90 // -----------------------------------------------------------------------------
    66 // CMccSymSimpleDlStream::NewL
    91 // CMccSymSimpleDlStream::NewL
    67 // Two-phased constructor.
    92 // Two-phased constructor.
    68 // -----------------------------------------------------------------------------
    93 // -----------------------------------------------------------------------------
    87     CleanupStack::PushL( s );
   112     CleanupStack::PushL( s );
    88     s->ConstructL();
   113     s->ConstructL();
    89 
   114 
    90     return s;
   115     return s;
    91     }
   116     }
       
   117 	
       
   118 // -----------------------------------------------------------------------------
       
   119 // CMccSymSimpleDlStream::NewL
       
   120 // Two-phased constructor.
       
   121 // -----------------------------------------------------------------------------
       
   122 //
       
   123 CMccSymSimpleDlStream* CMccSymSimpleDlStream::NewLC( 
       
   124     TUint32 aMccStreamId, 
       
   125     MAsyncEventHandler* aEventhandler, 
       
   126     MMccResources* aMccResources,
       
   127     CMccMsrpManager* aManager, 
       
   128     TFourCC aFourCC,
       
   129     TInt aStreamType,
       
   130     CMccRtpMediaClock& aClock ) 
       
   131     {
       
   132     CMccSymSimpleDlStream* s = 
       
   133             new ( ELeave ) CMccSymSimpleDlStream( aMccStreamId, 
       
   134                                                   aEventhandler,
       
   135                                                   aMccResources, 
       
   136                                                   aManager, 
       
   137                                                   aFourCC, 
       
   138                                                   aStreamType,
       
   139 												  aClock );
       
   140     CleanupStack::PushL( s );
       
   141     s->ConstructL();
       
   142 
       
   143     return s;
       
   144     }	
    92 
   145 
    93 // -----------------------------------------------------------------------------
   146 // -----------------------------------------------------------------------------
    94 // CMccSymSimpleDlStream::ConstructL
   147 // CMccSymSimpleDlStream::ConstructL
    95 // Symbian 2nd phase constructor can leave.
   148 // Symbian 2nd phase constructor can leave.
    96 // -----------------------------------------------------------------------------
   149 // -----------------------------------------------------------------------------
   292     {
   345     {
   293     __ASSERT_ALWAYS( iMultiplexer, User::Leave( KErrArgument ) );
   346     __ASSERT_ALWAYS( iMultiplexer, User::Leave( KErrArgument ) );
   294 
   347 
   295     TUid formatuid;
   348     TUid formatuid;
   296     CMMFFormatDecode* tmp = NULL;
   349     CMMFFormatDecode* tmp = NULL;
   297     
   350     if(this->iType == KMccMessageDownlinkStream)
   298     formatuid.iUid = KImplUidAnyPayloadFormatDecode;
   351         {
       
   352         formatuid.iUid = iCodecInfo.iPayloadFormatDecoder;
       
   353         }
       
   354     else
       
   355         {
       
   356         formatuid.iUid = KImplUidAnyPayloadFormatDecode;
       
   357         }
   299     
   358     
   300     // Multiplexer is the source of the decoder
   359     // Multiplexer is the source of the decoder
   301     tmp = CMMFFormatDecode::NewL( formatuid, iMultiplexer );
   360     tmp = CMMFFormatDecode::NewL( formatuid, iDatasource );
   302     
   361     
   303 	tmp->SetSourceDataTypeCode( iCodecInfo.iFourCC, Type() );
   362 	tmp->SetSourceDataTypeCode( iCodecInfo.iFourCC, Type() );
   304 
   363 
   305     if( iFormatDecode )
   364     if( iFormatDecode )
   306         {
   365         {
   333 // Primes the audio stream ready
   392 // Primes the audio stream ready
   334 // -----------------------------------------------------------------------------
   393 // -----------------------------------------------------------------------------
   335 //
   394 //
   336 void CMccSymSimpleDlStream::PrimeL( const TUint32 aEndpointId )
   395 void CMccSymSimpleDlStream::PrimeL( const TUint32 aEndpointId )
   337     {
   396     {
   338     __ASSERT_ALWAYS( iRtpmanager, User::Leave( KErrArgument ) );
       
   339     __ASSERT_ALWAYS( iDatapath, User::Leave( KErrArgument ) );
   397     __ASSERT_ALWAYS( iDatapath, User::Leave( KErrArgument ) );
   340 
   398 
   341     TBool controlNetworkResources = SetStateL( EStatePrepared, aEndpointId );
   399     TBool controlNetworkResources = SetStateL( EStatePrepared, aEndpointId );
   342     
   400     
   343      if ( controlNetworkResources && !LocalStream() )
   401     if( this->iType == KMccMessageDownlinkStream )
   344         {
   402         {
       
   403         iMsrpmanager->CreateReceiveStreamL( *iDatasource, iCodecInfo );
       
   404         }
       
   405     else if( controlNetworkResources && !LocalStream() )
       
   406         { 
       
   407 		__ASSERT_ALWAYS( iRtpmanager, User::Leave( KErrArgument ) );
   345         iRtpmanager->CreateReceiveStreamL( *iDatasource, iCodecInfo );
   408         iRtpmanager->CreateReceiveStreamL( *iDatasource, iCodecInfo );
   346         }
   409         }
   347     
   410     
   348     LoadCodecL( iCodecInfo, KNullDesC8 );
   411     LoadCodecL( iCodecInfo, KNullDesC8 );
   349     
   412     
   360 void CMccSymSimpleDlStream::PlayL( 
   423 void CMccSymSimpleDlStream::PlayL( 
   361     const TUint32 aEndpointId, 
   424     const TUint32 aEndpointId, 
   362     TBool /*aStreamPaused*/, 
   425     TBool /*aStreamPaused*/, 
   363     TBool aEnableRtcp )
   426     TBool aEnableRtcp )
   364     {
   427     {
   365     __ASSERT_ALWAYS( iRtpmanager, User::Leave( KErrArgument ) );
       
   366     __ASSERT_ALWAYS( iDatapath, User::Leave( KErrArgument ) );
   428     __ASSERT_ALWAYS( iDatapath, User::Leave( KErrArgument ) );
   367     
   429     
   368     TBool controlNetworkResources = SetStateL( EStateStreaming, aEndpointId );
   430     TBool controlNetworkResources = SetStateL( EStateStreaming, aEndpointId );
   369     
   431     
   370     if ( !LocalStream() )
   432     if ( !LocalStream() && (this->iType != KMccMessageDownlinkStream) )
   371         {  
   433         {  
   372         if ( controlNetworkResources )
   434         if ( controlNetworkResources )
   373             {
   435             {
       
   436             __ASSERT_ALWAYS( iRtpmanager, User::Leave( KErrArgument ) );
   374             iRtpmanager->StartSessionL();
   437             iRtpmanager->StartSessionL();
   375             }
   438             }
   376             
   439             
   377         User::LeaveIfError( iRtpmanager->SetRTCPSendReceive( aEnableRtcp ) );
   440         User::LeaveIfError( iRtpmanager->SetRTCPSendReceive( aEnableRtcp ) );
   378         }
   441         }
   391 // Pauses audio streaming
   454 // Pauses audio streaming
   392 // -----------------------------------------------------------------------------
   455 // -----------------------------------------------------------------------------
   393 //
   456 //
   394 void CMccSymSimpleDlStream::PauseL( const TUint32 aEndpointId, TBool aEnableRtcp )
   457 void CMccSymSimpleDlStream::PauseL( const TUint32 aEndpointId, TBool aEnableRtcp )
   395     {
   458     {
   396     __ASSERT_ALWAYS( iRtpmanager, User::Leave( KErrArgument ) );
       
   397     __ASSERT_ALWAYS( iDatapath, User::Leave( KErrArgument ) );
       
   398     
   459     
   399     SetStateL( EStatePaused, aEndpointId );
   460     SetStateL( EStatePaused, aEndpointId );
   400     
   461     
   401      if ( !LocalStream() )
   462     if(this->iType != KMccMessageDownlinkStream && !LocalStream())
   402         { 
   463         {
       
   464         __ASSERT_ALWAYS( iRtpmanager, User::Leave( KErrArgument ) );
       
   465         __ASSERT_ALWAYS( iDatapath, User::Leave( KErrArgument ) );
       
   466     
   403         User::LeaveIfError( iRtpmanager->SetRTCPSendReceive( aEnableRtcp ) );
   467         User::LeaveIfError( iRtpmanager->SetRTCPSendReceive( aEnableRtcp ) );
   404         }
   468         }
   405 
   469 
   406     DoPauseL();
   470     DoPauseL();
   407     
   471     
   413 // Resumes paused audio streaming
   477 // Resumes paused audio streaming
   414 // -----------------------------------------------------------------------------
   478 // -----------------------------------------------------------------------------
   415 //
   479 //
   416 void CMccSymSimpleDlStream::ResumeL( const TUint32 aEndpointId, TBool aEnableRtcp )
   480 void CMccSymSimpleDlStream::ResumeL( const TUint32 aEndpointId, TBool aEnableRtcp )
   417     {
   481     {
   418     __ASSERT_ALWAYS( iRtpmanager, User::Leave( KErrArgument ) );
       
   419     __ASSERT_ALWAYS( iDatapath, User::Leave( KErrArgument ) );
       
   420     
   482     
   421     SetStateL( EStateStreaming, aEndpointId );
   483     SetStateL( EStateStreaming, aEndpointId );
   422     
   484     
   423     if ( !LocalStream() )
   485     if(this->iType != KMccMessageDownlinkStream && !LocalStream() )
   424         { 
   486         {
       
   487         __ASSERT_ALWAYS( iRtpmanager, User::Leave( KErrArgument ) );
       
   488         __ASSERT_ALWAYS( iDatapath, User::Leave( KErrArgument ) );
       
   489     
   425         User::LeaveIfError( iRtpmanager->SetRTCPSendReceive( aEnableRtcp ) );
   490         User::LeaveIfError( iRtpmanager->SetRTCPSendReceive( aEnableRtcp ) );
   426         }
   491         }
   427 
   492 
   428     DoResumeL();
   493     DoResumeL();
   429     
   494