multimediacommscontroller/mmccsubcontroller/src/mccsymsubthreadclient.cpp
branchrcs
changeset 49 64c62431ac08
parent 32 f2ed1fc4c163
equal deleted inserted replaced
44:fb024d5e35fa 49:64c62431ac08
    19 
    19 
    20 // INCLUDE FILES
    20 // INCLUDE FILES
    21 #include <mmf/server/mmfdatasource.h>
    21 #include <mmf/server/mmfdatasource.h>
    22 #include <mmf/server/mmfdatasink.h>
    22 #include <mmf/server/mmfdatasink.h>
    23 
    23 
       
    24 #include "mmccinterfacedef.h"
    24 #include "mccsymsubthreadclient.h"
    25 #include "mccsymsubthreadclient.h"
    25 #include "mccsymulstream.h"
    26 #include "mccsymulstream.h"
    26 #include "mccsymdlstream.h"
    27 #include "mccsymdlstream.h"
    27 #include "mccsymsimpledlstream.h"
    28 #include "mccsymsimpledlstream.h"
    28 #include "mccdtmfdlstream.h"
    29 #include "mccdtmfdlstream.h"
    29 #include "mccdtmfulstream.h"
    30 #include "mccdtmfulstream.h"
    30 #include "mccrtpmanager.h"
    31 #include "mccrtpmanager.h"
       
    32 #include "mccmsrpmanager.h"
    31 #include "amrpayloadformatutil.h"
    33 #include "amrpayloadformatutil.h"
    32 #include "mccinternalevents.h"
    34 #include "mccinternalevents.h"
    33 #include "mccsubcontrollerlogs.h"
    35 #include "mccsubcontrollerlogs.h"
    34 #include "mmccsecureinterface.h"
    36 #include "mmccsecureinterface.h"
    35 
    37 
    57 void CMccSymSubthreadClient::ConstructL()
    59 void CMccSymSubthreadClient::ConstructL()
    58     {
    60     {
    59 	__SUBCONTROLLER( "CMccSymSubthreadClient::ConstructL" )
    61 	__SUBCONTROLLER( "CMccSymSubthreadClient::ConstructL" )
    60 	User::LeaveIfNull( iObserver );
    62 	User::LeaveIfNull( iObserver );
    61 	User::LeaveIfNull( iMccResources );
    63 	User::LeaveIfNull( iMccResources );
    62     iRtpmanager = CMccRtpManager::NewL( *this, *iMccResources, MccSessionId() );
    64 	iFileName = NULL;
       
    65 	iFileType = NULL;
       
    66 	if(this->iLinkType == KMccLinkMessage)
       
    67 	    {
       
    68 	    TUid uid = {0x123456};
       
    69 	    iMsrpmanager = CMccMsrpManager::NewL( *this, *iMccResources, uid );
       
    70 	    iFileShare = NULL;
       
    71 	    }
       
    72 	else
       
    73 	    {
       
    74         iRtpmanager = CMccRtpManager::NewL( *this, *iMccResources, MccSessionId() );
       
    75 	    }
    63 	__SUBCONTROLLER( "CMccSymSubthreadClient::ConstructL, exit" )
    76 	__SUBCONTROLLER( "CMccSymSubthreadClient::ConstructL, exit" )
    64     }
    77     }
    65 
    78 
    66 // -----------------------------------------------------------------------------
    79 // -----------------------------------------------------------------------------
    67 // CMccSymSubthreadClient::NewL
    80 // CMccSymSubthreadClient::NewL
    92     iStreams.ResetAndDestroy();
   105     iStreams.ResetAndDestroy();
    93     iStreams.Close();
   106     iStreams.Close();
    94     
   107     
    95     iUnusedStreams.Reset();
   108     iUnusedStreams.Reset();
    96     iUnusedStreams.Close();
   109     iUnusedStreams.Close();
       
   110     delete iFileName;
       
   111     delete iFileType;
    97     
   112     
    98     if( iRtpmanager )
   113     if( iRtpmanager )
    99         {
   114         {
   100         iRtpmanager->CloseSession();
   115         iRtpmanager->CloseSession();
   101         delete iRtpmanager;
   116         delete iRtpmanager;
   102         }    
   117         }
       
   118     else if (iMsrpmanager)
       
   119         {
       
   120         delete iMsrpmanager;
       
   121         }
       
   122     else
       
   123         {
       
   124         // NOP
       
   125         }
   103 	__SUBCONTROLLER( "CMccSymSubthreadClient::~CMccSymSubthreadClient, exit" )
   126 	__SUBCONTROLLER( "CMccSymSubthreadClient::~CMccSymSubthreadClient, exit" )
   104     }
   127     }
   105 
   128 
   106 // -----------------------------------------------------------------------------
   129 // -----------------------------------------------------------------------------
   107 // CMccSymSubthreadClient::SetVolumeL
   130 // CMccSymSubthreadClient::SetVolumeL
   250                                     const TUint32 aStreamId,
   273                                     const TUint32 aStreamId,
   251                                     TMMFPrioritySettings aSettings )
   274                                     TMMFPrioritySettings aSettings )
   252     {
   275     {
   253 	__SUBCONTROLLER_INT1( "CMccSymSubthreadClient::OpenL for streamId", aStreamId )
   276 	__SUBCONTROLLER_INT1( "CMccSymSubthreadClient::OpenL for streamId", aStreamId )
   254 	__SUBCONTROLLER_INT1( "CMccSymSubthreadClient stream type", aStreamType )
   277 	__SUBCONTROLLER_INT1( "CMccSymSubthreadClient stream type", aStreamType )
   255     __ASSERT_ALWAYS( iSessionCreated, User::Leave( KErrNotReady ) );
   278     //__ASSERT_ALWAYS( iSessionCreated, User::Leave( KErrNotReady ) );
   256     __ASSERT_ALWAYS( aDatasource, User::Leave( KErrArgument ) );
   279     __ASSERT_ALWAYS( aDatasource, User::Leave( KErrArgument ) );
   257     __ASSERT_ALWAYS( aDatasink, User::Leave( KErrArgument ) );
   280     __ASSERT_ALWAYS( aDatasink, User::Leave( KErrArgument ) );
   258         
   281         
   259     TUid sourceType = aDatasource->DataSourceType();
   282     TUid sourceType = aDatasource->DataSourceType();
   260     TUid sinkType = aDatasink->DataSinkType();
   283     TUid sinkType = aDatasink->DataSinkType();
   268     TBool localAVToDisplayStream = ( aStreamType == KMccVideoLocalStream ||
   291     TBool localAVToDisplayStream = ( aStreamType == KMccVideoLocalStream ||
   269                                      aStreamType == KMccAudioLocalStream ) &&
   292                                      aStreamType == KMccAudioLocalStream ) &&
   270                                      sourceType == KMccFileSourceUid &&
   293                                      sourceType == KMccFileSourceUid &&
   271                                      sinkType == KMccVideoSinkUid;
   294                                      sinkType == KMccVideoSinkUid;
   272     
   295     
   273     if ( KMccDtmfStream == aStreamType && KMccRtpSourceUid == sourceType )
   296     if ( KMccMessageDownlinkStream == aStreamType )
       
   297         {
       
   298         __SUBCONTROLLER( "CMccSymSubthreadClient::OpenL, new CMccSymSimpleDlStream" )      
       
   299         stream = CMccSymSimpleDlStream::NewLC( aStreamId, 
       
   300                                                this, 
       
   301                                                iMccResources,
       
   302                                                iMsrpmanager, 
       
   303                                                aFourCC, 
       
   304                                                aStreamType,
       
   305                                                *iRtpMediaClock);
       
   306         }
       
   307     else if (KMccMessageUplinkStream == aStreamType)
       
   308         {
       
   309         __SUBCONTROLLER( "CMccSymSubthreadClient::OpenL, new CMccSymUlStream" )
       
   310         stream = CMccSymUlStream::NewLC( aStreamId, 
       
   311                                          this, 
       
   312                                          iMccResources, 
       
   313                                          iMsrpmanager, 
       
   314                                          aFourCC, 
       
   315                                          aStreamType,
       
   316                                          *iRtpMediaClock );
       
   317         }
       
   318     else if ( KMccDtmfStream == aStreamType && KMccRtpSourceUid == sourceType )
   274         {
   319         {
   275         __SUBCONTROLLER( "CMccSymSubthreadClient::OpenL, new CMccDtmfDlStream" )
   320         __SUBCONTROLLER( "CMccSymSubthreadClient::OpenL, new CMccDtmfDlStream" )
   276         
   321         
   277         stream = CMccDtmfDlStream::NewLC( aStreamId, this, iMccResources,
   322         stream = CMccDtmfDlStream::NewLC( aStreamId, this, iMccResources,
   278             iRtpmanager, aFourCC, aStreamType, *iRtpMediaClock );
   323             iRtpmanager, aFourCC, aStreamType, *iRtpMediaClock );
   446 
   491 
   447         // Stream was already deleted
   492         // Stream was already deleted
   448         iUnusedStreams.Remove( index );
   493         iUnusedStreams.Remove( index );
   449         }
   494         }
   450     
   495     
   451     // No need to fail stream deletion if manager update fails
   496     if(this->iLinkType == KMccLinkMessage)
   452     TRAP_IGNORE( iRtpmanager->UpdateL() )
   497         {
       
   498         // NOP, MSRP sesssion will be deleted in destructor.
       
   499         }
       
   500     else
       
   501         {
       
   502         // No need to fail stream deletion if manager update fails
       
   503         TRAP_IGNORE( iRtpmanager->UpdateL() )
       
   504         }
   453         
   505         
   454 	__SUBCONTROLLER( "CMccSymSubthreadClient::CloseL, exit" )
   506 	__SUBCONTROLLER( "CMccSymSubthreadClient::CloseL, exit" )
   455     }
   507     }
   456 
   508 
   457 // -----------------------------------------------------------------------------
   509 // -----------------------------------------------------------------------------
   642         {
   694         {
   643         iStreams[k]->ResetCountersL();
   695         iStreams[k]->ResetCountersL();
   644         }
   696         }
   645 	__SUBCONTROLLER( "CMccSymSubthreadClient::SetRemoteRtcpAddrL, exit" )
   697 	__SUBCONTROLLER( "CMccSymSubthreadClient::SetRemoteRtcpAddrL, exit" )
   646     }
   698     }
       
   699 
       
   700 
       
   701 // -----------------------------------------------------------------------------
       
   702 // CMccSymSubthreadClient::SetRemoteAddressL
       
   703 // Sets the remote address of uplink stream
       
   704 // -----------------------------------------------------------------------------
       
   705 void CMccSymSubthreadClient::SetRemoteMsrpPathL( TDes8& aRemoteMsrpPath, TDes8& aConnStatus )
       
   706     {    
       
   707     __SUBCONTROLLER( "CMccSymSubthreadClient::SetRemoteMsrpPathL" )
       
   708     __ASSERT_ALWAYS( iMsrpmanager, User::Leave( KErrArgument ) );
       
   709     
       
   710     if (iFileShare )
       
   711         {
       
   712         iMsrpmanager->SetFileShareAttrbs(iFileName, iFileSize, iFileType, iFTProgressNotification);
       
   713         }
       
   714     if(this->iLinkType == KMccLinkMessage) 
       
   715         { 
       
   716         User::LeaveIfError( iMsrpmanager->SetRemoteMsrpPathL( aRemoteMsrpPath, aConnStatus )); 
       
   717         }
       
   718     
       
   719     TInt strmCount = iStreams.Count();
       
   720     for( TInt k = 0; k < strmCount; k++ )
       
   721         {
       
   722         iStreams[k]->ResetCountersL();
       
   723         }
       
   724     __SUBCONTROLLER( "CMccSymSubthreadClient::SetRemoteMsrpPathL, exit" )
       
   725     }
       
   726 
   647     
   727     
   648 // -----------------------------------------------------------------------------
   728 // -----------------------------------------------------------------------------
   649 // CMccSymSubthreadClient::InitializeLinkL
   729 // CMccSymSubthreadClient::InitializeLinkL
   650 // Initializes the RTP session in the subthread
   730 // Initializes the RTP session in the subthread
   651 // -----------------------------------------------------------------------------
   731 // -----------------------------------------------------------------------------
   658     iRtpmanager->InitializeL( aStatus, aIapId );
   738     iRtpmanager->InitializeL( aStatus, aIapId );
   659 	__SUBCONTROLLER( "CMccSymSubthreadClient::InitializeLinkL, exit" )
   739 	__SUBCONTROLLER( "CMccSymSubthreadClient::InitializeLinkL, exit" )
   660     }
   740     }
   661 
   741 
   662 // -----------------------------------------------------------------------------
   742 // -----------------------------------------------------------------------------
       
   743 // CMccSymSubthreadClient::InitializeLinkL
       
   744 // Initializes the RTP session in the subthread
       
   745 // -----------------------------------------------------------------------------
       
   746 // 
       
   747 void CMccSymSubthreadClient::InitializeLinkL( TRequestStatus& aStatus,
       
   748                                               TInt aIapId,
       
   749                                               HBufC8*& aLocalMsrpPath)
       
   750     {    
       
   751     __SUBCONTROLLER( "CMccSymSubthreadClient::InitializeLinkL" )
       
   752     __ASSERT_ALWAYS( !iSessionCreated, User::Leave( KErrAlreadyExists ) );
       
   753     
       
   754     //Create MSRP session
       
   755     iMsrpmanager->iMsrpSession = iMsrpmanager->CreateMSRPSessionL(*iMsrpmanager->iMsrpObserver, aIapId);
       
   756     
       
   757     
       
   758     iSessionCreated = ETrue;
       
   759     
       
   760     aLocalMsrpPath = iMsrpmanager->GetLocalMSRPPath().Alloc();
       
   761     
       
   762     TRequestStatus* status = &aStatus;
       
   763     User::RequestComplete(status, KErrNone);
       
   764     __SUBCONTROLLER( "CMccSymSubthreadClient::InitializeLinkL, exit" )
       
   765     }
       
   766 
       
   767 // -----------------------------------------------------------------------------
   663 // CMccSymSubthreadClient::CreateRtpSessionL
   768 // CMccSymSubthreadClient::CreateRtpSessionL
   664 // Creates the RTP session in the subthread
   769 // Creates the RTP session in the subthread
   665 // -----------------------------------------------------------------------------
   770 // -----------------------------------------------------------------------------
   666 //
   771 //
   667 void CMccSymSubthreadClient::CreateRtpSessionL( TUint aPort, 
   772 void CMccSymSubthreadClient::CreateRtpSessionL( TUint aPort, 
   751 // -----------------------------------------------------------------------------
   856 // -----------------------------------------------------------------------------
   752 //
   857 //
   753 void CMccSymSubthreadClient::GetLocalIpAddressesL( TMccCreateLink& aClientData )
   858 void CMccSymSubthreadClient::GetLocalIpAddressesL( TMccCreateLink& aClientData )
   754 	{
   859 	{
   755 	__SUBCONTROLLER( "CMccSymSubthreadClient::GetLocalIpAddressesL" )
   860 	__SUBCONTROLLER( "CMccSymSubthreadClient::GetLocalIpAddressesL" )
   756 	
   861 	if(this->iLinkType == KMccLinkMessage)
   757 	iRtpmanager->GetLocalIpAddressesL( aClientData );
   862 	    {
       
   863 	    iMsrpmanager->GetLocalIpAddressesL( aClientData );
       
   864 	    }
       
   865 	else
       
   866 	    {
       
   867 	    iRtpmanager->GetLocalIpAddressesL( aClientData );
       
   868 	    }
   758 	                                      
   869 	                                      
   759 	__SUBCONTROLLER( "CMccSymSubthreadClient::GetLocalIpAddressesL, exit" )
   870 	__SUBCONTROLLER( "CMccSymSubthreadClient::GetLocalIpAddressesL, exit" )
   760 	}
   871 	}
   761 
   872 
   762 // -----------------------------------------------------------------------------
   873 // -----------------------------------------------------------------------------
   987                 }
  1098                 }
   988             }
  1099             }
   989         }
  1100         }
   990     return KErrNone;
  1101     return KErrNone;
   991     }
  1102     }
       
  1103 
       
  1104 // -----------------------------------------------------------------------------
       
  1105 // CMccUlDlClient::SetFileShareAttrbs()
       
  1106 // stores the File Sharing attributes
       
  1107 // -----------------------------------------------------------------------------
       
  1108 //
       
  1109 void CMccSymSubthreadClient::SetFileSharingAttrbs(HBufC16* aFileName, 
       
  1110         TInt aFileSize, 
       
  1111         HBufC8* aFileType,
       
  1112         TBool aFTProgressNotification) 
       
  1113     {
       
  1114     __SUBCONTROLLER( "CMccSymSubthreadClient::SetFileSharingAttrbs Entry" )
       
  1115     iFileShare = ETrue; 
       
  1116     if (NULL!=aFileName )
       
  1117         iFileName = aFileName->Des().Alloc();
       
  1118     iFileSize = aFileSize;
       
  1119     if (NULL!=aFileType )
       
  1120         iFileType = aFileType->Des().Alloc();
       
  1121     iFTProgressNotification = aFTProgressNotification;
       
  1122     __SUBCONTROLLER( "CMccSymSubthreadClient::SetFileSharingAttrbs Exit" )
       
  1123     }
       
  1124 
   992     
  1125     
   993 // ========================== OTHER EXPORTED FUNCTIONS =========================
  1126 // ========================== OTHER EXPORTED FUNCTIONS =========================
   994 
  1127 
   995 //  End of File
  1128 //  End of File