multimediacommsengine/mmcesrv/mmcemediamanager/src/mcemediasdpcodec.cpp
changeset 26 bcc434605a01
parent 21 b7fa3d2db8f4
child 49 64c62431ac08
equal deleted inserted replaced
23:a297cbce4e85 26:bcc434605a01
   914                 {
   914                 {
   915                 // found remote IP4 RTCP address
   915                 // found remote IP4 RTCP address
   916                 const TUint8 KAddrOffsetFromNetType = 4;
   916                 const TUint8 KAddrOffsetFromNetType = 4;
   917                 TInt addr_offset = 
   917                 TInt addr_offset = 
   918                     value.Match( KMatchIp ) + KAddrOffsetFromNetType;
   918                     value.Match( KMatchIp ) + KAddrOffsetFromNetType;
   919                 TPtrC8 remoteRtcpAddr = value.Mid( addr_offset );
   919                 TPtrC8 remoteRtcpAddrTxt = value.Mid( addr_offset );
   920                 
   920                 
   921                 const TUint8 KPortOffsetFromIP = 1;
   921                 const TUint8 KPortOffsetFromIP = 1;
   922                 TInt port_offset = 
   922                 TInt port_offset = 
   923                     value.Match( KMatchIN ) - KPortOffsetFromIP;
   923                     value.Match( KMatchIN ) - KPortOffsetFromIP;
   924                 TPtrC8 remoteRtcpPort = value.Left( port_offset );
   924                 HBufC8* dataRemoteRtcpPort = value.Left( port_offset ).AllocLC();
   925                 
   925                 TPtr8 remoteRtcpPort( dataRemoteRtcpPort->Des() );
       
   926                 remoteRtcpPort.TrimAll();
   926                 TLex8 lexPT( remoteRtcpPort );
   927                 TLex8 lexPT( remoteRtcpPort );
   927                 User::LeaveIfError( lexPT.Val( rtcpPort, EDecimal ) );
   928                 User::LeaveIfError( lexPT.Val( rtcpPort, EDecimal ) );
   928                 // copy the address into correct format
   929                 // copy the address into correct format
   929                 TBuf16 <KMaxAddressLength> input;
   930                 TBuf16 <KMaxAddressLength> input;
   930                 input.Copy( remoteRtcpAddr );      
   931                 input.Copy( remoteRtcpAddrTxt );      
   931                 
   932                 input.TrimAll();
   932                 MCEMM_DEBUG_SVALUE( "Found RTCP address", input )
   933                 MCEMM_DEBUG_SVALUE( "Found RTCP address", input )
   933                 
   934                 
   934                 aStream.SetRemoteRtcpMediaAddrL( input );
   935                 TInetAddr remoteRtcpAddr;
       
   936                 User::LeaveIfError( remoteRtcpAddr.Input( input ) ); 
       
   937                 TInetAddr localIpAddr( aStream.Session()->iLocalIpAddress );
       
   938                 TBool validRemoteRtcpAddr( 
       
   939                     remoteRtcpAddr.IsLoopback() || !localIpAddr.Match( remoteRtcpAddr ) );
       
   940                 MCEMM_DEBUG_DVALUE( "Remote RTCP addr valid:", validRemoteRtcpAddr )
       
   941                 if ( validRemoteRtcpAddr )
       
   942                     {
       
   943                     aStream.SetRemoteRtcpMediaAddrL( input );
       
   944                     }
       
   945                 CleanupStack::PopAndDestroy( dataRemoteRtcpPort );
   935                 }
   946                 }
   936             else
   947             else
   937                 {
   948                 {
   938                 // only port present
   949                 // only port present
   939                 TLex8 lexPT( value );
   950                 HBufC8* dataRemoteRtcpPort = value.AllocLC();
       
   951                 TPtr8 remoteRtcpPort( dataRemoteRtcpPort->Des() );
       
   952                 remoteRtcpPort.TrimAll();
       
   953                 TLex8 lexPT( remoteRtcpPort );
   940                 User::LeaveIfError ( lexPT.Val( rtcpPort, EDecimal ) );
   954                 User::LeaveIfError ( lexPT.Val( rtcpPort, EDecimal ) );
       
   955                 CleanupStack::PopAndDestroy( dataRemoteRtcpPort );
   941                 }
   956                 }
   942 
   957 
   943 			aStream.SetRemoteRtcpMediaPort( rtcpPort );
   958 			aStream.SetRemoteRtcpMediaPort( rtcpPort );
   944             
   959             
   945             MCEMM_DEBUG_DVALUE( "RTCP Port", rtcpPort )
   960             MCEMM_DEBUG_DVALUE( "RTCP Port", rtcpPort )
  1038             }
  1053             }
  1039         }
  1054         }
  1040     else if ( secureSession && aRole == EMceRoleAnswerer && aUpdate )
  1055     else if ( secureSession && aRole == EMceRoleAnswerer && aUpdate )
  1041         {
  1056         {
  1042         // for long session
  1057         // for long session
  1043         if ( secureSession->iKeyNeedUpdated )
  1058           if( secureSession->SdpCryptoAttributeCount( aMediaLine ) )
  1044         	{
  1059         	{
  1045         	secureSession->DecodeSecureDesSdpUpdateL( aStream, aMediaLine ) ;
  1060             secureSession->DecodeSecureDesSdpUpdateL( aStream, aMediaLine ) ;
  1046         	}
  1061         	}
  1047         }
  1062         }
  1048     else if ( secureSession && aRole == EMceRoleOfferer )
  1063     else if ( secureSession && aRole == EMceRoleOfferer )
  1049         {
  1064         {
  1050        	// for Long Session
  1065        	// for Long Session