--- a/multimediacommscontroller/mmccfilesourcesink/inc/mccfileaudio.h Fri May 28 16:08:43 2010 +0300
+++ b/multimediacommscontroller/mmccfilesourcesink/inc/mccfileaudio.h Fri Jun 11 11:20:25 2010 +0300
@@ -100,6 +100,7 @@
#ifdef EUNIT_TEST
friend class UT_CMccFileAudio;
friend class UT_CMccMultiplexer;
+ friend class UT_CMccFileSourceImpl;
#endif
};
--- a/multimediacommscontroller/mmccfilesourcesink/inc/mccfilevideo.h Fri May 28 16:08:43 2010 +0300
+++ b/multimediacommscontroller/mmccfilesourcesink/inc/mccfilevideo.h Fri Jun 11 11:20:25 2010 +0300
@@ -56,6 +56,7 @@
TFourCC GetFourCC();
TCallBack TickCallBack();
HBufC8* GetConfigKeyL();
+ TUint32 VideoType() const;
public:
static TInt TickVideoL( TAny* aObject );
--- a/multimediacommscontroller/mmccfilesourcesink/src/mccfilesourceimpl.cpp Fri May 28 16:08:43 2010 +0300
+++ b/multimediacommscontroller/mmccfilesourcesink/src/mccfilesourceimpl.cpp Fri Jun 11 11:20:25 2010 +0300
@@ -28,6 +28,7 @@
#include "mccfilevideo.h"
#include "mccinternalevents.h"
#include "mmccinterfacedef.h"
+#include "mccinternaldef.h"
@@ -368,12 +369,14 @@
// Average bitrate is for the whole stream,
// subtract audio average to get video average
- TUint32 averageBitRate = iFileVideo->StreamAverageBitRate() - audioBitRate;
+ TUint32 videoBitRate = iFileVideo->StreamAverageBitRate() - audioBitRate;
+ MccConversionUtility::BitRateSanitize(
+ videoBitRate, videoBitRate, iFileVideo->VideoType() );
__FILESOURCE_CONTROLL_INT1( "CMccFileSourceImpl::VideoBitRateL, videoBitRate",
- averageBitRate )
+ videoBitRate )
- return averageBitRate;
+ return videoBitRate;
}
// -----------------------------------------------------------------------------
--- a/multimediacommscontroller/mmccfilesourcesink/src/mccfilevideo.cpp Fri May 28 16:08:43 2010 +0300
+++ b/multimediacommscontroller/mmccfilesourcesink/src/mccfilevideo.cpp Fri Jun 11 11:20:25 2010 +0300
@@ -231,7 +231,16 @@
ExtractH264ParameterSetNALUsL( &configKey, ETrue );
return configKey;
}
-
+
+// -----------------------------------------------------------------------------
+// CMccFileVideo::VideoType
+// -----------------------------------------------------------------------------
+//
+TUint32 CMccFileVideo::VideoType() const
+ {
+ return iType;
+ }
+
// -----------------------------------------------------------------------------
// CMccFileVideo::Position
// -----------------------------------------------------------------------------
@@ -279,10 +288,9 @@
//
TReal CMccFileVideo::VideoFrameRateL()
{
- // Round to have zero decimals for clearness sake
- TReal roundedFrameRate;
- User::LeaveIfError( Math::Round( roundedFrameRate, iFrameRate, 0 ) );
- return roundedFrameRate;
+ TReal modFrameRate;
+ MccConversionUtility::FrameRateSanitize( modFrameRate, iFrameRate, iType );
+ return modFrameRate;
}
// -----------------------------------------------------------------------------
--- a/multimediacommscontroller/mmccfilesourcesink/tsrc/ut_filesourcesink/Src/UT_CMCCFileSourceImpl.cpp Fri May 28 16:08:43 2010 +0300
+++ b/multimediacommscontroller/mmccfilesourcesink/tsrc/ut_filesourcesink/Src/UT_CMCCFileSourceImpl.cpp Fri Jun 11 11:20:25 2010 +0300
@@ -23,6 +23,7 @@
#include "mmcccodecinformation.h"
#include "mccresourcepool.h"
#include "mmccinterfacedef.h"
+#include "mccinternaldef.h"
#include "mccunittestmacros.h"
@@ -252,6 +253,12 @@
void UT_CMccFileSourceImpl::UT_CMccFileSourceImpl_VideoBitRateLL( )
{
TUint32 videoBitRate = iSourceImp->VideoBitRateL();
+ EUNIT_ASSERT_EQUALS(videoBitRate, KMccH263ProfileZeroMinBitRateIOP); // Low bitrate increased to more interoperable
+
+ // Test situation where no need to make iop modification for bitrate
+ iSourceImp->iFileVideo->iStreamAverageBitRate = 100000;
+ videoBitRate = iSourceImp->VideoBitRateL();
+ EUNIT_ASSERT_EQUALS(videoBitRate, iSourceImp->iFileVideo->iStreamAverageBitRate - iSourceImp->iFileAudio->iAverageBitRate);
}
void UT_CMccFileSourceImpl::UT_CMccFileSourceImpl_PositionLL( )
--- a/multimediacommscontroller/mmccfilesourcesink/tsrc/ut_filesourcesink/Src/UT_CMccFileAudio.cpp Fri May 28 16:08:43 2010 +0300
+++ b/multimediacommscontroller/mmccfilesourcesink/tsrc/ut_filesourcesink/Src/UT_CMccFileAudio.cpp Fri Jun 11 11:20:25 2010 +0300
@@ -32,6 +32,7 @@
#include "mmccinterfacedef.h"
#include "mccresourcepool.h"
#include "Mcculdatapath.h"
+#include "mccinternaldef.h"
// CONSTRUCTION
UT_CMccFileAudio* UT_CMccFileAudio::NewL()
@@ -315,7 +316,20 @@
void UT_CMccFileAudio::UT_CMccFileAudio_VideoFrameRateLL( )
{
TReal videoFrameRate = iAudio->VideoFrameRateL();
+ EUNIT_ASSERT_EQUALS( (TInt)videoFrameRate, 0 );
TReal videoFrameRate2 = iVideo->VideoFrameRateL();
+ EUNIT_ASSERT_EQUALS( (TInt)videoFrameRate2, 5 );
+
+ // Test that framerate is limited to more interoperable value if value is too high for codec type
+ iVideo->iType = MP4_TYPE_H263_PROFILE_0;
+ iVideo->iFrameRate = 21;
+ videoFrameRate2 = iVideo->VideoFrameRateL();
+ EUNIT_ASSERT_EQUALS( (TInt)videoFrameRate2, KMccH263ProfileZeroMaxFramerateIOP );
+
+ iVideo->iType = MP4_TYPE_AVC_PROFILE_BASELINE;
+ iVideo->iFrameRate = 18;
+ videoFrameRate2 = iVideo->VideoFrameRateL();
+ EUNIT_ASSERT_EQUALS( (TInt)videoFrameRate2, 18 ); // Value not changed for AVC
}
void UT_CMccFileAudio::UT_CMccFileAudio_StartTimerL( )
--- a/multimediacommscontroller/mmccshared/inc/mccinternaldef.h Fri May 28 16:08:43 2010 +0300
+++ b/multimediacommscontroller/mmccshared/inc/mccinternaldef.h Fri Jun 11 11:20:25 2010 +0300
@@ -25,6 +25,8 @@
#include <e32base.h>
#include <mmf/common/mmfcontroller.h>
#include <tconvbase64.h>
+#include <e32math.h>
+#include <3gplibrary/mp4lib.h>
#include "rtpdef.h"
@@ -68,6 +70,10 @@
// Increased RTP socket size in bytes, default socket size is around 4KB
const TInt KMccIncreasedRtpSocketSize = 10000;
+// Values used to force better interoperability against some vendors
+const TReal KMccH263ProfileZeroMaxFramerateIOP = 15;
+const TUint32 KMccH263ProfileZeroMinBitRateIOP = 64001;
+
// MACROS
#ifdef _DEBUG
@@ -782,6 +788,35 @@
User::LeaveIfError( encoder.Encode( aInput, ptrOutput ) );
return output;
}
+
+ static void FrameRateSanitize(
+ TReal& aSanitizedFrameRate, TReal aOrigFrameRate, TUint32 aVideoType )
+ {
+ // Round to have zero decimals for clearness sake
+ User::LeaveIfError( Math::Round( aSanitizedFrameRate, aOrigFrameRate, 0 ) );
+
+ if ( aVideoType == MP4_TYPE_H263_PROFILE_0 &&
+ aSanitizedFrameRate > KMccH263ProfileZeroMaxFramerateIOP )
+ {
+ aSanitizedFrameRate = KMccH263ProfileZeroMaxFramerateIOP;
+ }
+ }
+
+ static void BitRateSanitize(
+ TUint32& aSanitizedBitRate, TUint32 aOrigBitRate, TUint32 aVideoType )
+ {
+ if ( aVideoType == MP4_TYPE_H263_PROFILE_0 &&
+ aOrigBitRate > 0 &&
+ aOrigBitRate < KMccH263ProfileZeroMinBitRateIOP )
+ {
+ aSanitizedBitRate = KMccH263ProfileZeroMinBitRateIOP;
+ }
+ else
+ {
+ aSanitizedBitRate = aOrigBitRate;
+ }
+ }
+
};
#endif
--- a/multimediacommscontroller/mmccsubcontroller/src/mcccodecconfigurator.cpp Fri May 28 16:08:43 2010 +0300
+++ b/multimediacommscontroller/mmccsubcontroller/src/mcccodecconfigurator.cpp Fri Jun 11 11:20:25 2010 +0300
@@ -667,14 +667,19 @@
__SUBCONTROLLER( "AVC" )
setting.iVideoFourCC = TFourCC( KMccFourCCIdAVC );
}
- // Round to have zero decimals for clearness sake
- User::LeaveIfError( Math::Round( setting.iVideoFrameRate, frameRate, 0 ) );
+
+ MccConversionUtility::FrameRateSanitize(
+ setting.iVideoFrameRate, frameRate, videoType );
+
setting.iVideoFrameSize.iWidth = videoWidth;
setting.iVideoFrameSize.iHeight = videoHeight;
// Average bitrate is for the whole stream,
// subtract audio average to get video average
setting.iVideoBitRate = videoAverageBitRate - audioAverageBitRate;
+
+ MccConversionUtility::BitRateSanitize(
+ setting.iVideoBitRate, setting.iVideoBitRate, videoType );
}
else
{
--- a/multimediacommsengine/mmceshared/src/mcecomamrwbcodec.cpp Fri May 28 16:08:43 2010 +0300
+++ b/multimediacommsengine/mmceshared/src/mcecomamrwbcodec.cpp Fri Jun 11 11:20:25 2010 +0300
@@ -306,6 +306,7 @@
//if offerer codec represents the sent offer and mcc codec the answer
// Bitrates field contains also additional information, mask it away
+ /*
TUint mccBitrates = ( aMccCodec.AllowedBitrates() & KMceAllowedAmrWbBitrateAll );
TUint mceBitrates = ( iAllowedBitrates & KMceAllowedAmrWbBitrateAll );
@@ -314,7 +315,9 @@
mceBitrates > mccBitrates ) :
( mceBitrates && mccBitrates == 0 ||
mceBitrates < mccBitrates );
-
+
+ */
+// User::LeaveIfError( notValid ? KErrNotSupported : KErrNone );
if ( aMccCodec.CodecMode() != (TCodecMode)iCodecMode )
{
// codec-mode was different, fail.
--- a/multimediacommsengine/mmcesrv/mmcemediamanager/src/mcemediasdpcodec.cpp Fri May 28 16:08:43 2010 +0300
+++ b/multimediacommsengine/mmcesrv/mmcemediamanager/src/mcemediasdpcodec.cpp Fri Jun 11 11:20:25 2010 +0300
@@ -916,28 +916,43 @@
const TUint8 KAddrOffsetFromNetType = 4;
TInt addr_offset =
value.Match( KMatchIp ) + KAddrOffsetFromNetType;
- TPtrC8 remoteRtcpAddr = value.Mid( addr_offset );
+ TPtrC8 remoteRtcpAddrTxt = value.Mid( addr_offset );
const TUint8 KPortOffsetFromIP = 1;
TInt port_offset =
value.Match( KMatchIN ) - KPortOffsetFromIP;
- TPtrC8 remoteRtcpPort = value.Left( port_offset );
-
+ HBufC8* dataRemoteRtcpPort = value.Left( port_offset ).AllocLC();
+ TPtr8 remoteRtcpPort( dataRemoteRtcpPort->Des() );
+ remoteRtcpPort.TrimAll();
TLex8 lexPT( remoteRtcpPort );
User::LeaveIfError( lexPT.Val( rtcpPort, EDecimal ) );
// copy the address into correct format
TBuf16 <KMaxAddressLength> input;
- input.Copy( remoteRtcpAddr );
-
+ input.Copy( remoteRtcpAddrTxt );
+ input.TrimAll();
MCEMM_DEBUG_SVALUE( "Found RTCP address", input )
- aStream.SetRemoteRtcpMediaAddrL( input );
+ TInetAddr remoteRtcpAddr;
+ User::LeaveIfError( remoteRtcpAddr.Input( input ) );
+ TInetAddr localIpAddr( aStream.Session()->iLocalIpAddress );
+ TBool validRemoteRtcpAddr(
+ remoteRtcpAddr.IsLoopback() || !localIpAddr.Match( remoteRtcpAddr ) );
+ MCEMM_DEBUG_DVALUE( "Remote RTCP addr valid:", validRemoteRtcpAddr )
+ if ( validRemoteRtcpAddr )
+ {
+ aStream.SetRemoteRtcpMediaAddrL( input );
+ }
+ CleanupStack::PopAndDestroy( dataRemoteRtcpPort );
}
else
{
// only port present
- TLex8 lexPT( value );
+ HBufC8* dataRemoteRtcpPort = value.AllocLC();
+ TPtr8 remoteRtcpPort( dataRemoteRtcpPort->Des() );
+ remoteRtcpPort.TrimAll();
+ TLex8 lexPT( remoteRtcpPort );
User::LeaveIfError ( lexPT.Val( rtcpPort, EDecimal ) );
+ CleanupStack::PopAndDestroy( dataRemoteRtcpPort );
}
aStream.SetRemoteRtcpMediaPort( rtcpPort );
@@ -1040,9 +1055,9 @@
else if ( secureSession && aRole == EMceRoleAnswerer && aUpdate )
{
// for long session
- if ( secureSession->iKeyNeedUpdated )
+ if( secureSession->SdpCryptoAttributeCount( aMediaLine ) )
{
- secureSession->DecodeSecureDesSdpUpdateL( aStream, aMediaLine ) ;
+ secureSession->DecodeSecureDesSdpUpdateL( aStream, aMediaLine ) ;
}
}
else if ( secureSession && aRole == EMceRoleOfferer )
--- a/multimediacommsengine/mmcesrv/mmcemediamanager/tsrc/ut_mediamanager/src/UT_cmcemediasdpcodec.cpp Fri May 28 16:08:43 2010 +0300
+++ b/multimediacommsengine/mmcesrv/mmcemediamanager/tsrc/ut_mediamanager/src/UT_cmcemediasdpcodec.cpp Fri Jun 11 11:20:25 2010 +0300
@@ -908,6 +908,42 @@
EUNIT_ASSERT( mediaStream->iRemoteRtcpAddress.IsUnspecified() )
audioLine->AttributeFields().ResetAndDestroy();
+ // Rtcp attribute has incorrectly our local address, it should not be used
+ mediaStream->Session()->iLocalIpAddress.Input( _L("10.20.30.40") );
+ rtcp = CSdpAttributeField::DecodeLC( _L8( "a=rtcp:5020 IN IP4 10.20.30.40\r\n" ) );
+ audioLine->AttributeFields().AppendL( rtcp );
+ CleanupStack::Pop( rtcp );
+ iSdpCodec->DecodeRemoteRtcpFieldL( *audioLine, *mediaStream );
+ EUNIT_ASSERT_EQUALS( 5020, mediaStream->iRemoteRtcpPort )
+ EUNIT_ASSERT( mediaStream->iRemoteRtcpAddress.IsUnspecified() ) // Not changed
+ audioLine->AttributeFields().ResetAndDestroy();
+
+ // Rtcp attrubute is local loopback address, ok to use
+ rtcp = CSdpAttributeField::DecodeLC( _L8( "a=rtcp:5020 IN IP4 127.0.0.1\r\n" ) );
+ audioLine->AttributeFields().AppendL( rtcp );
+ CleanupStack::Pop( rtcp );
+ iSdpCodec->DecodeRemoteRtcpFieldL( *audioLine, *mediaStream );
+ EUNIT_ASSERT_EQUALS( 5020, mediaStream->iRemoteRtcpPort )
+ EUNIT_ASSERT_EQUALS( INET_ADDR( 127,0,0,1 ), mediaStream->iRemoteRtcpAddress.Address() )
+ audioLine->AttributeFields().ResetAndDestroy();
+
+ // Incorrect white space usage
+ rtcp = CSdpAttributeField::DecodeLC( _L8( "a=rtcp: 5050 IN IP4 2.2.2.2 \r\n" ) );
+ audioLine->AttributeFields().AppendL( rtcp );
+ CleanupStack::Pop( rtcp );
+ iSdpCodec->DecodeRemoteRtcpFieldL( *audioLine, *mediaStream );
+ EUNIT_ASSERT_EQUALS( 5050, mediaStream->iRemoteRtcpPort )
+ EUNIT_ASSERT_EQUALS( INET_ADDR( 2,2,2,2 ), mediaStream->iRemoteRtcpAddress.Address() )
+ audioLine->AttributeFields().ResetAndDestroy();
+
+ rtcp = CSdpAttributeField::DecodeLC( _L8( "a=rtcp: 50506\r\n" ) );
+ audioLine->AttributeFields().AppendL( rtcp );
+ CleanupStack::Pop( rtcp );
+ iSdpCodec->DecodeRemoteRtcpFieldL( *audioLine, *mediaStream );
+ EUNIT_ASSERT_EQUALS( 50506, mediaStream->iRemoteRtcpPort )
+ EUNIT_ASSERT_EQUALS( INET_ADDR( 2,2,2,2 ), mediaStream->iRemoteRtcpAddress.Address() )
+ audioLine->AttributeFields().ResetAndDestroy();
+
CleanupStack::PopAndDestroy( sdp );
}
@@ -1349,7 +1385,6 @@
CleanupStack::PopAndDestroy( sdp );
}
-
void UT_CMceMediaSdpCodec::UT_CMceMediaSdpCodec_DecodeDirectionLL()