# HG changeset patch # User William Roberts # Date 1279813047 -3600 # Node ID e07c9cb4153db47de1e867ef4b2e1da85dbd288d # Parent 11893e44ad1bab0f72efe3b0b3b0b9b45a14f318# Parent 72290a6868df0d7f9fb02155489afd3caf2c351d Catchup to latest Symbian^4 diff -r 11893e44ad1b -r e07c9cb4153d ipappsrv_info/ipappsrv_metadata/ipappsrv_metadata.mrp --- a/ipappsrv_info/ipappsrv_metadata/ipappsrv_metadata.mrp Thu Jun 17 22:31:54 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -component ipappsrv_metadata -source \sf\mw\ipappsrv\ipappsrv_info\ipappsrv_metadata -source \sf\mw\ipappsrv\package_definition.xml -source \sf\mw\ipappsrv\distribution.policy.s60 -notes_source \component_defs\release.src -ipr T diff -r 11893e44ad1b -r e07c9cb4153d ipappsrv_plat/media_control_api/inc/mmccinterfacedef.h --- a/ipappsrv_plat/media_control_api/inc/mmccinterfacedef.h Thu Jun 17 22:31:54 2010 +0100 +++ b/ipappsrv_plat/media_control_api/inc/mmccinterfacedef.h Thu Jul 22 16:37:27 2010 +0100 @@ -104,6 +104,12 @@ class TMccVideoSinkSetting { public: + TMccVideoSinkSetting() : iLocation(0,0), iSize(0,0), iVideoPayloadType(0), + iAudioPayloadType(0), iIAPId(0), iDeviceIndex(0), iWindowOrdinalPosition(0), + iWindowOrdinalPriority(0), iRotation(EMccNone), iVideoFrameRate(0.0), iEnabled(ETrue) + { + } + TPoint iLocation; TSize iSize; TUint iVideoPayloadType; @@ -115,6 +121,7 @@ TInt iWindowOrdinalPriority; TMccVideoRotation iRotation; TReal iVideoFrameRate; + TBool iEnabled; }; typedef TPckgBuf TMccVideoSinkSettingBuf; diff -r 11893e44ad1b -r e07c9cb4153d ipappsrv_plat/multimedia_comms_api/inc/mcefilesink.h --- a/ipappsrv_plat/multimedia_comms_api/inc/mcefilesink.h Thu Jun 17 22:31:54 2010 +0100 +++ b/ipappsrv_plat/multimedia_comms_api/inc/mcefilesink.h Thu Jul 22 16:37:27 2010 +0100 @@ -23,7 +23,7 @@ // INCLUDES #include -#include +#include // FORWARD DECLARATIONS diff -r 11893e44ad1b -r e07c9cb4153d ipappsrv_plat/multimedia_comms_api/inc/mcertpsink.h --- a/ipappsrv_plat/multimedia_comms_api/inc/mcertpsink.h Thu Jun 17 22:31:54 2010 +0100 +++ b/ipappsrv_plat/multimedia_comms_api/inc/mcertpsink.h Thu Jul 22 16:37:27 2010 +0100 @@ -23,7 +23,7 @@ // INCLUDES #include -#include +#include // CONSTANTS const TMceSinkType KMceRTPSink = 1; diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmcccontroller/data/102073F6.rss --- a/multimediacommscontroller/mmcccontroller/data/102073F6.rss Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmcccontroller/data/102073F6.rss Thu Jul 22 16:37:27 2010 +0100 @@ -41,7 +41,7 @@ version_no = KIpappsrvEcomVersionNumber; display_name = "MCC Controller"; default_data = ""; - opaque_data = "0x400000"; + opaque_data = "0x4000000x5000"; } }; } diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmcccontroller/src/mcccamerahandler.cpp --- a/multimediacommscontroller/mmcccontroller/src/mcccamerahandler.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmcccontroller/src/mcccamerahandler.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -150,6 +150,10 @@ iViewFinderSettings = aSetting; + if ( !iViewFinderSettings.iEnabled ){ + __CONTROLLER( "CMccCameraHandler::EnableViewFinderL, param update, exit" ) + return; + } __CONTROLLER( "CMccCameraHandler::EnableViewFinderL, starting vf" ) CCamera* cam = IsCameraReady() ? iCamera : NULL; @@ -217,8 +221,9 @@ iViewFinderSettings.iSize.iWidth) __CONTROLLER_INT2( "CMccCameraHandler::GetViewFinderSettingsL, location", iViewFinderSettings.iLocation.iX, - iViewFinderSettings.iLocation.iY) - aSetting = iViewFinderSettings; + iViewFinderSettings.iLocation.iY) + aSetting = iViewFinderSettings; + aSetting.iEnabled = iViewFinderEnabled; __CONTROLLER( "CMccCameraHandler::GetViewFinderSettingsL,exit" ) } @@ -731,10 +736,16 @@ void CMccCameraHandler::DoPowerOnComplete( TInt aError ) { __CONTROLLER_INT1( "CMccCameraHandler::DoPowerOnComplete, with value", aError ) + if ( aError == KErrNone ) { iState = EPowered; + // Notify observers about success, important to do before VF handling + // as VF behaves more nicely at enabling when it sees that media recorder + // is already using camera. + NotifyObservers( aError ); + // Viewfinder was enabled before resource release, enable again. // Also set old camera settings. if ( iViewFinderEnabled ) @@ -757,10 +768,10 @@ { __CONTROLLER_INT1( "CMccCameraHandler::DoPowerOnComplete, powering failed", aError ) iState = EFailed; - } - - // Notify observers about success or failure - NotifyObservers( aError ); + + // Notify observers about failure + NotifyObservers( aError ); + } __CONTROLLER( "CMccCameraHandler::DoPowerOnComplete, exit" ) } diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmcccontroller/tsrc/ut_controller/src/UT_CMccCameraHandler.cpp --- a/multimediacommscontroller/mmcccontroller/tsrc/ut_controller/src/UT_CMccCameraHandler.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmcccontroller/tsrc/ut_controller/src/UT_CMccCameraHandler.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -286,6 +286,22 @@ iCameraHandler->GetViewFinderSettingsL( settings2 ); EUNIT_ASSERT_EQUALS( settings2.iSize.iWidth, 0 ); EUNIT_ASSERT( iCameraHandler->iCamera->iVfStarted == EFalse ) + + // Check that iEnabled in settings is handled correctly + iCameraHandler->iViewFinderEnabled = EFalse; + settings.iEnabled = EFalse; + iCameraHandler->EnableViewFinderL( settings ); + EUNIT_ASSERT( iCameraHandler->iViewFinderEnabled == EFalse ) + EUNIT_ASSERT( iCameraHandler->iCamera->iVfStarted == EFalse ) + iCameraHandler->GetViewFinderSettingsL( settings2 ); + EUNIT_ASSERT( settings2.iEnabled == EFalse ) + + settings.iEnabled = ETrue; + iCameraHandler->EnableViewFinderL( settings ); + EUNIT_ASSERT( iCameraHandler->iViewFinderEnabled == ETrue ) + EUNIT_ASSERT( iCameraHandler->iCamera->iVfStarted == EFalse ) + iCameraHandler->GetViewFinderSettingsL( settings2 ); + EUNIT_ASSERT( settings2.iEnabled == ETrue ) } void UT_CMccCameraHandler::UT_CMccCameraHandler_DisableViewFinderL() diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccfilesourcesink/inc/mccfileaudio.h --- a/multimediacommscontroller/mmccfilesourcesink/inc/mccfileaudio.h Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccfilesourcesink/inc/mccfileaudio.h Thu Jul 22 16:37:27 2010 +0100 @@ -100,6 +100,7 @@ #ifdef EUNIT_TEST friend class UT_CMccFileAudio; friend class UT_CMccMultiplexer; + friend class UT_CMccFileSourceImpl; #endif }; diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccfilesourcesink/inc/mccfilesourceimpl.h --- a/multimediacommscontroller/mmccfilesourcesink/inc/mccfilesourceimpl.h Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccfilesourcesink/inc/mccfilesourceimpl.h Thu Jul 22 16:37:27 2010 +0100 @@ -283,6 +283,8 @@ void StopEofTimer(); void EofTimerExpiredL(); // from MMccEofTimerObserver + + void InvalidVideoFrame( TBool aInvalid = EFalse ); public: diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccfilesourcesink/inc/mccfilevideo.h --- a/multimediacommscontroller/mmccfilesourcesink/inc/mccfilevideo.h Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccfilesourcesink/inc/mccfilevideo.h Thu Jul 22 16:37:27 2010 +0100 @@ -26,6 +26,9 @@ #include "mccfilesourcetypebase.h" + +const TUint KMccReadFrameFailCountMax = 20; + // FORWARD DECLARATIONS class CMccFileSourceImpl; class MMccResources; @@ -53,6 +56,7 @@ TFourCC GetFourCC(); TCallBack TickCallBack(); HBufC8* GetConfigKeyL(); + TUint32 VideoType() const; public: static TInt TickVideoL( TAny* aObject ); @@ -112,6 +116,9 @@ TBool iIsVideoLeft; TBool iIsFirstFrame; TFourCC iFourCC; + + TInt iReadFrameFailCount; + TBool iSendReadFrameFailEvent; MMccResources* iMccResources; TUint32 iEndpointId; diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccfilesourcesink/src/mccfilesink.cpp --- a/multimediacommscontroller/mmccfilesourcesink/src/mccfilesink.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccfilesourcesink/src/mccfilesink.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -582,6 +582,7 @@ { iAddToTimestamp += ( currDifference + averageTimeStampDifference ); iTimestamps.Reset(); + iPausedDuration = 0; __FILESINK_CONTROLL_INT1("CMccFileSink::TimeToPlay, iAddToTimestamp=", iAddToTimestamp ) } diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccfilesourcesink/src/mccfilesourceimpl.cpp --- a/multimediacommscontroller/mmccfilesourcesink/src/mccfilesourceimpl.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccfilesourcesink/src/mccfilesourceimpl.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -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; } // ----------------------------------------------------------------------------- @@ -1086,6 +1089,27 @@ return startNeeded; } + +// ----------------------------------------------------------------------------- +// CMccFileSourceImpl::InvalidVideoFrame() +// ----------------------------------------------------------------------------- +// +void CMccFileSourceImpl::InvalidVideoFrame( TBool aInvalid ) + { + __FILESOURCE_CONTROLL( + "CMccFileSourceImpl::InvalidVideoFrame" ) + if( aInvalid ) + { + SendStreamEventToClient( KMccEventCategoryStream, + KMccStreamIdle ); + } + else + { + SendStreamEventToClient( KMccEventCategoryStream, + KMccStreamPlaying ); + } + } + #ifndef EKA2 // DLL interface code diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccfilesourcesink/src/mccfilevideo.cpp --- a/multimediacommscontroller/mmccfilesourcesink/src/mccfilevideo.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccfilesourcesink/src/mccfilevideo.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -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::FrameRateSanitizeL( modFrameRate, iFrameRate, iType ); + return modFrameRate; } // ----------------------------------------------------------------------------- @@ -402,11 +410,27 @@ { __FILESOURCE_CONTROLL( "CMccFileVideo::ReadFrameL, reading frame, NOT OK" ) CleanupStack::PopAndDestroy( mediaBuffer ); + if( !iSendReadFrameFailEvent ) + { + iReadFrameFailCount++; + if( iReadFrameFailCount >= KMccReadFrameFailCountMax ) + { + iSendReadFrameFailEvent = ETrue; + iSource.InvalidVideoFrame( ETrue ); + } + } } else { __FILESOURCE_CONTROLL_INT1( "CMccFileVideo::ReadFrameL, reading frame, OK, position", iPosition ) + + if( iSendReadFrameFailEvent ) + { + iSendReadFrameFailEvent = EFalse; + iReadFrameFailCount = 0; + iSource.InvalidVideoFrame( EFalse ); + } DoTimingCorrection( iPosition ); diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccfilesourcesink/tsrc/ut_filesourcesink/Src/UT_CMCCFileSourceImpl.cpp --- a/multimediacommscontroller/mmccfilesourcesink/tsrc/ut_filesourcesink/Src/UT_CMCCFileSourceImpl.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccfilesourcesink/tsrc/ut_filesourcesink/Src/UT_CMCCFileSourceImpl.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -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( ) diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccfilesourcesink/tsrc/ut_filesourcesink/Src/UT_CMccFileAudio.cpp --- a/multimediacommscontroller/mmccfilesourcesink/tsrc/ut_filesourcesink/Src/UT_CMccFileAudio.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccfilesourcesink/tsrc/ut_filesourcesink/Src/UT_CMccFileAudio.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -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( ) diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccshared/inc/mccinternaldef.h --- a/multimediacommscontroller/mmccshared/inc/mccinternaldef.h Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccshared/inc/mccinternaldef.h Thu Jul 22 16:37:27 2010 +0100 @@ -25,6 +25,8 @@ #include #include #include +#include +#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 FrameRateSanitizeL( + 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 diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccsubcontroller/src/mcccodecconfigurator.cpp --- a/multimediacommscontroller/mmccsubcontroller/src/mcccodecconfigurator.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccsubcontroller/src/mcccodecconfigurator.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -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::FrameRateSanitizeL( + 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 { diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccsubcontroller/src/mccsymulstream.cpp --- a/multimediacommscontroller/mmccsubcontroller/src/mccsymulstream.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccsubcontroller/src/mccsymulstream.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -288,6 +288,15 @@ UpdateCodecInformationL( iCodecInfo ); } + else if ( iDatasink->DataSinkType() == KMccRtpSinkUid ) + { + CMccRtpDataSink* dataSink = + static_cast( iDatasink ); + + // For updating keep alive parameters + TMccCodecInfoBuffer infoBuffer( iCodecInfo ); + dataSink->ConfigureL( infoBuffer ); + } } else if ( CurrentCodecState() == EStateCodecLoaded || CurrentCodecState() == EStateCodecLoadedAndUpdating ) diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccvideosourcesink/group/videosourcesink.mmp --- a/multimediacommscontroller/mmccvideosourcesink/group/videosourcesink.mmp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccvideosourcesink/group/videosourcesink.mmp Thu Jul 22 16:37:27 2010 +0100 @@ -35,7 +35,6 @@ SOURCE mccvideojitterbuffer.cpp SOURCE mccvideosourceimpl.cpp SOURCE mccvideosourcewrapper.cpp -SOURCE mccredrawhandler.cpp SOURCE mccvideosourcekeyretriever.cpp #if (defined WINS) diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccvideosourcesink/inc/mccvideosinkimpl.h --- a/multimediacommscontroller/mmccvideosourcesink/inc/mccvideosinkimpl.h Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccvideosourcesink/inc/mccvideosinkimpl.h Thu Jul 22 16:37:27 2010 +0100 @@ -61,7 +61,6 @@ class CMccVideoSinkUser; class MAsyncEventHandler; class MDataSource; -class CMccRedrawHandler; // CLASS DECLARATION @@ -453,6 +452,10 @@ TBool AllUsersReady(); + void UpdateScreenTransparencyL(const TMccVideoSinkSetting& aSettings); + void DeleteWindowingElements(); + void CreateWindowingElementsL(const TMccVideoSinkSetting& aSettings); + private: // Data RWsSession iRwSession; @@ -489,8 +492,6 @@ TBool iPrerollSet; - CMccRedrawHandler* iRedrawHandler; - TUint32 iNumPacketsEnqueued; TTimeIntervalMicroSeconds iPos; diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccvideosourcesink/inc/mccvideosourceimpl.h --- a/multimediacommscontroller/mmccvideosourcesink/inc/mccvideosourceimpl.h Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccvideosourcesink/inc/mccvideosourceimpl.h Thu Jul 22 16:37:27 2010 +0100 @@ -392,7 +392,7 @@ void RateAdaptationRequestL( const TMccEvent& aInputData, TMccEvent& aOutputData ); - void DoCodecSpecificConfigurationL( TUid& aEncoderUid ); + void DoCodecSpecificConfigurationL( TUid& aEncoderUid,TBool& aForceEncapsulationType ); HBufC8* GetFmtpLC( const TMccCodecInfo& aCodecInfo ); diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccvideosourcesink/inc/mccvideosourcewrapper.h --- a/multimediacommscontroller/mmccvideosourcesink/inc/mccvideosourcewrapper.h Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccvideosourcesink/inc/mccvideosourcewrapper.h Thu Jul 22 16:37:27 2010 +0100 @@ -63,7 +63,8 @@ TInt aCameraHandle, const TDesC8& aVideoMimeType = KNullDesC8, TFourCC aAudioType = KFourCCNULL, - TUid aEncoderUid = KNullUid ); + TUid aEncoderUid = KNullUid, + TBool aForceEncapsulationType = EFalse ); void PlayL(); diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccvideosourcesink/src/mccvideosinkimpl.cpp --- a/multimediacommscontroller/mmccvideosourcesink/src/mccvideosinkimpl.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccvideosourcesink/src/mccvideosinkimpl.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -31,7 +31,6 @@ #include "mmcccodecamr.h" #include "mccvideosinkuser.h" #include "mccdef.h" -#include "mccredrawhandler.h" #include "mccinternaldef.h" #include @@ -139,44 +138,7 @@ __V_SOURCESINK_CONTROLL_INT1( "CMccVideoSinkImpl rotation:", iSettings.iRotation ) - // Create window group - TInt groupId = iRwSession.GetFocusWindowGroup(); - iRwGroup = new (ELeave) RWindowGroup( iRwSession ); - - User::LeaveIfError( iRwGroup->Construct( groupId, EFalse ) ); - iRwGroup->SetName( KMccWindowGroupName ); - - // TBD: use also iWindowOrdinalPriority - iRwGroup->SetOrdinalPosition( iSettings.iWindowOrdinalPosition ); - - // Create screen device - iDev = new (ELeave) CWsScreenDevice( iRwSession ); - User::LeaveIfError( iDev->Construct( iSettings.iDeviceIndex ) ); - - // Create window - iRw = new (ELeave) RWindow( iRwSession ); - - User::LeaveIfError( iRw->Construct( *iRwGroup, (TUint32)iRw ) ); - - iRw->SetPosition( iSettings.iLocation ); - iRw->SetSize( iSettings.iSize ); - - iRw->SetOrdinalPosition( iSettings.iWindowOrdinalPosition ); - - __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl: creating graphics context ..." ) - User::LeaveIfError( iDev->CreateContext( iGc ) ); - __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl: graphics context created!" ) - - - iRw->Activate(); - - iRwSession.Flush(); - - __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl: creating redraw handler" ) - - iRedrawHandler = CMccRedrawHandler::NewL( iRwSession, *iRw, *iGc ); - - __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl: created redraw handler" ) + CreateWindowingElementsL(iSettings); // Videoplayer needs to be created last, otherwise destruction // order causes problems @@ -245,14 +207,10 @@ } delete iVideoPlayer; - - delete iRedrawHandler; + iVideoPlayer = NULL; - delete iGc; - delete iDev; + DeleteWindowingElements(); - delete iRw; - delete iRwGroup; iRwSession.Close(); delete iServerName; @@ -419,7 +377,6 @@ } else { - iRedrawHandler->BlackDrawingL( ETrue ); SendStreamEventToClient( KMccStreamStarted, iCurrentUser ); SetStartedOnce( userEntry, ETrue ); } @@ -777,8 +734,6 @@ user.PacketOverflowState() != CMccVideoSinkUser::EOccured && dataSize >= KMccMinPacketSize ) { - iRedrawHandler->BlackDrawingL( EFalse ); - __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl::EmptyBufferL, sending packet to helix" ) @@ -837,16 +792,11 @@ __V_SOURCESINK_CONTROLL_INT1( "CMccVideoSinkImpl rotation:", aSettings.iRotation ) - __ASSERT_ALWAYS( iRw && iRwGroup && iDev, User::Leave( KErrNotReady ) ); + // Need to recreate windowing stuff, otherwise orientation switch does not work + DeleteWindowingElements(); + CreateWindowingElementsL(aSettings); - // TBD: use also aSettings.iWindowOrdinalPriority - iRwGroup->SetOrdinalPosition( aSettings.iWindowOrdinalPosition ); - - iRw->SetPosition( aSettings.iLocation ); - iRw->SetSize( aSettings.iSize ); - iRw->SetOrdinalPosition( aSettings.iWindowOrdinalPosition ); - - iRwSession.Flush(); + UpdateScreenTransparencyL(aSettings); SetDisplayWindowL( iRwSession, *iDev, *iRw ); @@ -1946,6 +1896,97 @@ } return allUsersReady; } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CMccVideoSinkImpl::UpdateScreenTransparencyL(const TMccVideoSinkSetting& aSettings) + { + __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl::UpdateScreenTransparencyL" ) + __ASSERT_ALWAYS( iGc && iRw, User::Leave( KErrNotReady ) ); + TRect vfRect( TPoint( 0, 0 ), aSettings.iSize ); + iGc->Activate( *iRw ); + iRw->Invalidate( vfRect ); + iRw->BeginRedraw( vfRect ); + iGc->CancelClippingRect(); + iGc->SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha ); + iGc->SetBrushStyle( CGraphicsContext::ESolidBrush ); + iGc->SetBrushColor( TRgb( 0, 0, 0, 0 ) ); + iGc->DrawRect( vfRect ); + iRw->EndRedraw(); + iGc->Deactivate(); + iRwSession.Flush(); + __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl::UpdateScreenTransparencyL, exit" ) + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CMccVideoSinkImpl::DeleteWindowingElements() + { + __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl::DeleteWindowingElements" ) + if ( iVideoPlayer && iRw ) + { + __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl: removing window from player" ) + iVideoPlayer->RemoveDisplayWindow( *iRw ); + } + delete iGc; + iGc = NULL; + delete iDev; + iDev = NULL; + delete iRw; + iRw = NULL; + delete iRwGroup; + iRwGroup = NULL; + __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl::DeleteWindowingElements, exit" ) + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CMccVideoSinkImpl::CreateWindowingElementsL(const TMccVideoSinkSetting& aSettings) + { + __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl::CreateWindowingElementsL" ) + + __ASSERT_ALWAYS( !iGc && !iDev && !iRw && !iRwGroup, User::Leave( KErrAlreadyExists ) ); + + TInt groupId = iRwSession.GetFocusWindowGroup(); + iRwGroup = new (ELeave) RWindowGroup( iRwSession ); + + User::LeaveIfError( iRwGroup->Construct( groupId, EFalse ) ); + iRwGroup->SetName( KMccWindowGroupName ); + + // TBD: use also iWindowOrdinalPriority + iRwGroup->SetOrdinalPosition( aSettings.iWindowOrdinalPosition ); + iRwGroup->AutoForeground( EFalse ); + + // Create screen device + iDev = new (ELeave) CWsScreenDevice( iRwSession ); + User::LeaveIfError( iDev->Construct( aSettings.iDeviceIndex ) ); + + // Create window + iRw = new (ELeave) RWindow( iRwSession ); + + User::LeaveIfError( iRw->Construct( *iRwGroup, (TUint32)iRw ) ); + + iRw->SetPosition( aSettings.iLocation ); + iRw->SetSize( aSettings.iSize ); + + iRw->SetOrdinalPosition( aSettings.iWindowOrdinalPosition ); + + __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl: creating graphics context ..." ) + User::LeaveIfError( iDev->CreateContext( iGc ) ); + __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl: graphics context created!" ) + + iRw->Activate(); + + iRwSession.Flush(); + + __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl::CreateWindowingElementsL, exit" ) + } // End of file diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccvideosourcesink/src/mccvideosourceimpl.cpp --- a/multimediacommscontroller/mmccvideosourcesink/src/mccvideosourceimpl.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccvideosourcesink/src/mccvideosourceimpl.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -166,13 +166,14 @@ __V_SOURCESINK_CONTROLL( "CMccVideoSourceImpl::SourcePrimeL, prepare fully" ) TUid encoderUid( KNullUid ); - DoCodecSpecificConfigurationL( encoderUid ); + TBool forceEncapsulationType( EFalse ); + DoCodecSpecificConfigurationL( encoderUid, forceEncapsulationType ); __ASSERT_ALWAYS( iVideoCodecFourCC, User::Leave( KErrNotReady ) ); __V_SOURCESINK_CONTROLL( "CMccVideoSourceImpl::SourcePrimeL, opening source" ) iMediaRecorder->OpenL( iAudioSource, iCameraHandler->Handle(), - *iVideoCodecFourCC, iAudioFourCC, encoderUid ) ; + *iVideoCodecFourCC, iAudioFourCC, encoderUid, forceEncapsulationType ) ; } } else @@ -1218,7 +1219,8 @@ // CMccVideoSourceImpl::DoCodecSpecificConfigurationL // --------------------------------------------------------------------------- // -void CMccVideoSourceImpl::DoCodecSpecificConfigurationL( TUid& aEncoderUid ) +void CMccVideoSourceImpl::DoCodecSpecificConfigurationL( + TUid& aEncoderUid, TBool& aForceEncapsulationType ) { __V_SOURCESINK_CONTROLL( "CMccVideoSourceImpl::DoCodecSpecificConfigurationL" ) @@ -1264,6 +1266,7 @@ __V_SOURCESINK_CONTROLL_INT1( "CMccVideoSourceImpl::DoCodecSpecificConfigurationL, EncodingDecodingDeviceUid:", iVideoCodec.iEncodingDecodingDevice.iUid ) aEncoderUid = iVideoCodec.iEncodingDecodingDevice; + aForceEncapsulationType = ETrue; } else { diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccvideosourcesink/src/mccvideosourcewrapper.cpp --- a/multimediacommscontroller/mmccvideosourcesink/src/mccvideosourcewrapper.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccvideosourcesink/src/mccvideosourcewrapper.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -89,7 +89,8 @@ TInt aCameraHandle, const TDesC8& aVideoMimeType, TFourCC aAudioType, - TUid aEncoderUid ) + TUid aEncoderUid, + TBool aForceEncapsulationType ) { __V_SOURCESINK_CONTROLL( "CMccVideoSourceWrapper::OpenL" ) @@ -109,9 +110,12 @@ __V_SOURCESINK_CONTROLL_INT1( "SetPreferredVideoEncoderL, uid:", aEncoderUid.iUid ) iMediaRecorder->SetPreferredVideoEncoderL( aEncoderUid ); + } + if ( aForceEncapsulationType ) + { __V_SOURCESINK_CONTROLL( "SetPreferredVideoEncapsulationL" ) iMediaRecorder->SetPreferredVideoEncapsulationL( EDuElementaryStream ); - } + } __V_SOURCESINK_CONTROLL( "SetVideoCodingOptionsL" ) //set mediarecorder to insert GOB:s diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/group/UT_CMCCVideoSourceSink.mmp --- a/multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/group/UT_CMCCVideoSourceSink.mmp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/group/UT_CMCCVideoSourceSink.mmp Thu Jul 22 16:37:27 2010 +0100 @@ -44,7 +44,6 @@ SOURCE MccVideoSource.cpp SOURCE MccVideoSourceWrapper.cpp SOURCE MccVideoSourceSinkFactory.cpp -SOURCE MccRedrawHandler.cpp SOURCE mccvideosourcekeyretriever.cpp SOURCEPATH ../src diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/src/UT_CMCCVideoSinkImpl.cpp --- a/multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/src/UT_CMCCVideoSinkImpl.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/src/UT_CMCCVideoSinkImpl.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -41,6 +41,7 @@ #include "Mcctesteventhandler.h" #include "mmcccodecamr.h" #include "mccvideosinkuser.h" +#include "ws_stubs_helper.h" const TInt KVideoSinkTestFramerateNormal = 15; @@ -761,10 +762,16 @@ settings.iRotation = EMccNone; // No change + TWsStubsHelper::Reset(); + TInt numWindowCreated = TWsStubsHelper::NumWindowsCreated(); iSinkImpl->UpdateSettingsL( settings, EFalse ); + EUNIT_ASSERT( numWindowCreated == TWsStubsHelper::NumWindowsCreated() ); + EUNIT_ASSERT( TWsStubsHelper::CurrentDrawMode() != CGraphicsContext::EDrawModeWriteAlpha ); // Force iSinkImpl->UpdateSettingsL( settings, ETrue ); + EUNIT_ASSERT( ++numWindowCreated == TWsStubsHelper::NumWindowsCreated() ); // Window was recreated + EUNIT_ASSERT( TWsStubsHelper::CurrentDrawMode() == CGraphicsContext::EDrawModeWriteAlpha ); // Settings changed settings.iRotation = EMccClockwise180Degree; diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/src/UT_CMCCVideoSourceImpl.cpp --- a/multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/src/UT_CMCCVideoSourceImpl.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/src/UT_CMCCVideoSourceImpl.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -338,6 +338,11 @@ iSourceImpl->SetVideoCodecL( codecInfo ); iSourceImpl->SourcePrimeL(); EUNIT_ASSERT( iSourceImpl->iVideoCodecFourCC->Des().FindF( KH263SdpName ) != KErrNotFound ); + // Encoder uid should not be set in case of H263 is used + CCMRMediaRecorderStub* stub = + reinterpret_cast( iSourceImpl->iMediaRecorder->iMediaRecorder ); + EUNIT_ASSERT( stub->iEncoderUid == KNullUid ); + EUNIT_ASSERT( stub->iEncapsulation != EDuElementaryStream ); // Not forced in H263 case } void UT_CMccVideoSourceImpl::UT_CMccVideoSourceImpl_SourcePrimeL2L( ) @@ -436,6 +441,7 @@ CCMRMediaRecorderStub* stub = reinterpret_cast( iSourceImpl->iMediaRecorder->iMediaRecorder ); EUNIT_ASSERT( stub->iEncoderUid != KNullUid ); + EUNIT_ASSERT( stub->iEncapsulation == EDuElementaryStream ); // Forced in AVC case // Multiple codecs prepare iSourceImpl->SourceStopL(); diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/stubs/inc/CCMRMediaRecorder.h --- a/multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/stubs/inc/CCMRMediaRecorder.h Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/stubs/inc/CCMRMediaRecorder.h Thu Jul 22 16:37:27 2010 +0100 @@ -546,6 +546,8 @@ TUid iEncoderUid; + TVideoDataUnitEncapsulation iEncapsulation; + }; #endif // CCMRMEDIARECORDER_H diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/stubs/src/CCMRMediaRecorder_STUB.cpp --- a/multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/stubs/src/CCMRMediaRecorder_STUB.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/stubs/src/CCMRMediaRecorder_STUB.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -36,6 +36,7 @@ { iCurrentState = CCMRMediaRecorderStub::EStateNone; iVideoBitrate = 64000; + iEncapsulation = EDuGenericPayload; } CCMRMediaRecorderStub::~CCMRMediaRecorderStub() @@ -231,9 +232,10 @@ iEncoderUid = aEncoder; } -void CCMRMediaRecorderStub::SetPreferredVideoEncapsulationL(TVideoDataUnitEncapsulation /*aCapsulation*/) +void CCMRMediaRecorderStub::SetPreferredVideoEncapsulationL(TVideoDataUnitEncapsulation aCapsulation) { iLastFunctionCall = ETestPreferredEncapsulation; + iEncapsulation = aCapsulation; } // STUB STUFF diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/tsrc/stubs/inc/ws_stubs_helper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/multimediacommscontroller/tsrc/stubs/inc/ws_stubs_helper.h Thu Jul 22 16:37:27 2010 +0100 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + +#ifndef WSSTUBSHELPER_H +#define WSSTUBSHELPER_H + +// INCLUDES +#include + +// CONSTANTS + +// MACROS + +// DATA TYPES + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* +*/ +class TWsStubsHelper + { +public: + static CGraphicsContext::TDrawMode CurrentDrawMode(); + static TInt NumWindowsCreated(); + static void Reset(); + + }; + +#endif // WSSTUBSHELPER_H + +// End of File diff -r 11893e44ad1b -r e07c9cb4153d multimediacommscontroller/tsrc/stubs/src/ws_stubs.cpp --- a/multimediacommscontroller/tsrc/stubs/src/ws_stubs.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommscontroller/tsrc/stubs/src/ws_stubs.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -16,6 +16,26 @@ */ #include +#include "ws_stubs_helper.h" + +static CGraphicsContext::TDrawMode testDrawMode = CGraphicsContext::EDrawModeAND; +static TInt testNumWindowsCreated = 0; + +CGraphicsContext::TDrawMode TWsStubsHelper::CurrentDrawMode() +{ + return testDrawMode; +} + +TInt TWsStubsHelper::NumWindowsCreated() +{ + return testNumWindowsCreated; +} + +void TWsStubsHelper::Reset() +{ + testDrawMode = CGraphicsContext::EDrawModeAND; + testNumWindowsCreated = 0; +} // ----------------------------------------------------------------------------- // CWindowGc @@ -48,8 +68,9 @@ } void CWindowGc::SetDrawMode( TDrawMode aDrawingMode ) { - + testDrawMode = aDrawingMode; } + void CWindowGc::Deactivate() { @@ -145,6 +166,7 @@ } TInt RWindow::Construct(const RWindowTreeNode &parent,TUint32 aHandle) { + testNumWindowsCreated++; return KErrNone; } void RWindow::BeginRedraw(const TRect &aRect) @@ -262,6 +284,11 @@ return KErrNone; } +void RWindowGroup::AutoForeground(TBool /*aState*/) + { + + } + // ----------------------------------------------------------------------------- // RDrawableWindow // ----------------------------------------------------------------------------- diff -r 11893e44ad1b -r e07c9cb4153d multimediacommsengine/mmceshared/inc/mcecomaudiocodec.h --- a/multimediacommsengine/mmceshared/inc/mcecomaudiocodec.h Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommsengine/mmceshared/inc/mcecomaudiocodec.h Thu Jul 22 16:37:27 2010 +0100 @@ -263,7 +263,13 @@ * Comfort noise */ TBool iComfortNoiseEnabled; - + + +private: // Friend classes + + #ifdef TEST_EUNIT + friend class UT_CMceComAudioCodec; + #endif }; diff -r 11893e44ad1b -r e07c9cb4153d multimediacommsengine/mmceshared/src/mcecomamrwbcodec.cpp --- a/multimediacommsengine/mmceshared/src/mcecomamrwbcodec.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommsengine/mmceshared/src/mcecomamrwbcodec.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -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,8 +315,9 @@ mceBitrates > mccBitrates ) : ( mceBitrates && mccBitrates == 0 || mceBitrates < mccBitrates ); - - User::LeaveIfError( notValid ? KErrNotSupported : KErrNone ); + + */ +// User::LeaveIfError( notValid ? KErrNotSupported : KErrNone ); if ( aMccCodec.CodecMode() != (TCodecMode)iCodecMode ) { // codec-mode was different, fail. diff -r 11893e44ad1b -r e07c9cb4153d multimediacommsengine/mmceshared/src/mcecomaudiocodec.cpp --- a/multimediacommsengine/mmceshared/src/mcecomaudiocodec.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommsengine/mmceshared/src/mcecomaudiocodec.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -522,6 +522,10 @@ aStream.Data().BoundStreamL().RemoveCodecL( boundCnCodec ); } + + // update keep alive payload type and data + aMccCodec.SetKeepAlivePT( 120 ); + aMccCodec.SetKeepAliveData( KNullDesC8 ); } CleanupStack::PopAndDestroy( searchCodec ); diff -r 11893e44ad1b -r e07c9cb4153d multimediacommsengine/mmceshared/src/mcecomcodec.cpp --- a/multimediacommsengine/mmceshared/src/mcecomcodec.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommsengine/mmceshared/src/mcecomcodec.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -228,7 +228,14 @@ const TDesC8& /*aFmtpValue*/, TBool /*aIsStrictMatch*/ ) { - return aRtpmapValue.FindF( iSdpName ) == 0; + // find MIME type + TInt slashPos = aRtpmapValue.Find( _L8( "/" ) ); + if ( slashPos != KErrNotFound ) + { + return aRtpmapValue.Left(slashPos).Compare( iSdpName ) == 0; + } + + return aRtpmapValue.FindF(iSdpName) == 0; } // ----------------------------------------------------------------------------- diff -r 11893e44ad1b -r e07c9cb4153d multimediacommsengine/mmceshared/src/mcecomdisplaysink.cpp --- a/multimediacommsengine/mmceshared/src/mcecomdisplaysink.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommsengine/mmceshared/src/mcecomdisplaysink.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -347,6 +347,7 @@ displaySetting.iWindowOrdinalPosition = 1; displaySetting.iWindowOrdinalPriority = iPriority; displaySetting.iRotation = EMccNone; + displaySetting.iEnabled = ETrue; if ( aCodec.Stream() && aCodec.Stream()->iType == KMceVideo ) { diff -r 11893e44ad1b -r e07c9cb4153d multimediacommsengine/mmcesrv/mmcemediamanager/inc/mcesdpsession.h --- a/multimediacommsengine/mmcesrv/mmcemediamanager/inc/mcesdpsession.h Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommsengine/mmcesrv/mmcemediamanager/inc/mcesdpsession.h Thu Jul 22 16:37:27 2010 +0100 @@ -409,7 +409,8 @@ // old local port, used for refresh TUint iOldLocalMediaPort; - + + TBool iStoreRemoteOrigin; //definitions for unit testing MCEMM_UT_DEFINITIONS diff -r 11893e44ad1b -r e07c9cb4153d multimediacommsengine/mmcesrv/mmcemediamanager/src/mcemedianegotiated.cpp --- a/multimediacommsengine/mmcesrv/mmcemediamanager/src/mcemedianegotiated.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommsengine/mmcesrv/mmcemediamanager/src/mcemedianegotiated.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -286,9 +286,11 @@ TMceSipWarningCode TMceMediaNegotiated::TMceAnswererEndState::DecodeL( CSdpDocument& aSdpDocument ) { MCEMM_DEBUG("TMceMediaNegotiated::TMceAnswererEndState::DecodeL(), Entry "); - + + iSession.SdpSession().iStoreRemoteOrigin = EFalse; TMceSipWarningCode code = iSession.SdpSession().DecodeOfferL( aSdpDocument, iSession ); + iSession.SdpSession().iStoreRemoteOrigin = ETrue; MCEMM_DEBUG("TMceMediaNegotiated::TMceAnswererEndState::DecodeL(), Exit "); diff -r 11893e44ad1b -r e07c9cb4153d multimediacommsengine/mmcesrv/mmcemediamanager/src/mcemediasdpcodec.cpp --- a/multimediacommsengine/mmcesrv/mmcemediamanager/src/mcemediasdpcodec.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommsengine/mmcesrv/mmcemediamanager/src/mcemediasdpcodec.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -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 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 ) diff -r 11893e44ad1b -r e07c9cb4153d multimediacommsengine/mmcesrv/mmcemediamanager/src/mcesdpsession.cpp --- a/multimediacommsengine/mmcesrv/mmcemediamanager/src/mcesdpsession.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommsengine/mmcesrv/mmcemediamanager/src/mcesdpsession.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -95,7 +95,8 @@ iOOldSchoolProceeding( 0 ), iOOldSchoolCompleted( 0 ), iIsMaster( ETrue ), - iOldLocalMediaPort( 0 ) + iOldLocalMediaPort( 0 ), + iStoreRemoteOrigin ( ETrue ) { iSessionId = GetRandomNumber(); iSessionVersion = GetRandomNumber(); @@ -508,11 +509,15 @@ MCEMM_DEBUG("CMceSdpSession::DecodeOfferL(), Exit ") return KMceSipWarnIncompatibleMediaFormat; } - - // store the remote o= field - StoreRemoteOriginL(); - // store the remote a= field - StoreRemoteMediaFieldsL(); + + //avoid to store the value second time when in nat environment + if ( iStoreRemoteOrigin ) + { + // store the remote o= field + StoreRemoteOriginL(); + // store the remote a= field + StoreRemoteMediaFieldsL(); + } //set remote ip address result = SetRemoteIpAddressL( aSession, aSdpDocument ); @@ -921,7 +926,28 @@ CSdpConnectionField* connfield = aSdpDocument.ConnectionField(); const TInetAddr* inetAddr = NULL; - if( connfield ) + // find "c-" line from media level + TInt index = 0; + TBool found = ETrue; + while( found && index < mediaLines.Count() ) + { + RPointerArray& connfields = + mediaLines[index]->ConnectionFields(); + + if ( mediaLines[index++]->Port() > 0 ) + { + TInt cfindex = 0; + TBool cffound = EFalse; + while( !cffound && cfindex < connfields.Count() ) + { + inetAddr = connfields[cfindex++]->InetAddress(); + cffound = MCE_NOT_NULL_PTR( inetAddr ); + } + found = cffound; + } + } + + if( connfield && !found ) { inetAddr = connfield->InetAddress(); if( inetAddr ) @@ -931,29 +957,6 @@ MCE_SET_REMOTE_IP_ADDR( &aSession, inetAddress ); } } - - if ( !inetAddr ) - { - TInt index = 0; - TBool found = ETrue; - while( found && index < mediaLines.Count() ) - { - RPointerArray& connfields = - mediaLines[index]->ConnectionFields(); - - if ( mediaLines[index++]->Port() > 0 ) - { - TInt cfindex = 0; - TBool cffound = EFalse; - while( !cffound && cfindex < connfields.Count() ) - { - inetAddr = connfields[cfindex++]->InetAddress(); - cffound = MCE_NOT_NULL_PTR( inetAddr ); - } - found = cffound; - } - } - } if ( inetAddr ) { diff -r 11893e44ad1b -r e07c9cb4153d multimediacommsengine/mmcesrv/mmcemediamanager/tsrc/ut_mediamanager/inc/UT_CMCESdpSession.h --- a/multimediacommsengine/mmcesrv/mmcemediamanager/tsrc/ut_mediamanager/inc/UT_CMCESdpSession.h Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommsengine/mmcesrv/mmcemediamanager/tsrc/ut_mediamanager/inc/UT_CMCESdpSession.h Thu Jul 22 16:37:27 2010 +0100 @@ -120,6 +120,8 @@ void UT_CMceSdpSession_DecodeOfferL_2L(); void UT_CMceSdpSession_DecodeOfferL_3L( ); + + void UT_CMceSdpSession_DecodeOfferL_4L( ); void UT_CMceSdpSession_ForkLL(); diff -r 11893e44ad1b -r e07c9cb4153d multimediacommsengine/mmcesrv/mmcemediamanager/tsrc/ut_mediamanager/src/UT_CMCESdpSession.cpp --- a/multimediacommsengine/mmcesrv/mmcemediamanager/tsrc/ut_mediamanager/src/UT_CMCESdpSession.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommsengine/mmcesrv/mmcemediamanager/tsrc/ut_mediamanager/src/UT_CMCESdpSession.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -210,10 +210,10 @@ _LIT8( KConnectionField2, "v=0\r\n\ o=- 123 123 IN IP4 0.0.0.0\r\n\ s=-\r\n\ -c=IN IP4 10.36.7.239\r\n\ +c=IN IP4 10.36.7.229\r\n\ t=0 0\r\n\ m=audio 5000/1 RTP/AVP 96\r\n\ -c=IN IP4 10.36.7.229\r\n\ +c=IN IP4 10.36.7.239\r\n\ a=rtpmap:96 AMR/8000\r\n\ m=video 0 RTP/AVP 97\r\n\ c=IN IP4 193.65.182.50\r\n"); @@ -1333,6 +1333,35 @@ CleanupStack::PopAndDestroy( offer3 ); } + +void UT_CMceSdpSession::UT_CMceSdpSession_DecodeOfferL_4L() + { + iSdpSession->SetMediaSession( iInSession ); + iInSession->AttachSDPSessionL( *iSdpSession ); + + TInetAddr remoteIP; + remoteIP.SetAddress( INET_ADDR( 10,10,10,10 ) ); + + _LIT8( KMyUserName, "username" ); + const TInt64 KSessionId( 1234 ); + const TInt64 KSessionVersion( 5678 ); + CSdpOriginField* remoteorigin = + CSdpOriginField::NewL( KMyUserName, KSessionId, KSessionVersion, remoteIP ); + iSdpSession->iRemoteOrigin = remoteorigin; + + iSdpSession->iStoreRemoteOrigin = EFalse; + CSdpDocument* offer = CSdpDocument::DecodeL( KMceMMTestSdpMessage_MT_Confield_In_MediaLine ); + CleanupStack::PushL( offer ); + TInt err = iSdpSession->DecodeOfferL( *offer, *iInSession ); + EUNIT_ASSERT( err == KErrNone ); + EUNIT_ASSERT( iSdpSession->iRemoteOrigin->InetAddress()->CmpAddr( remoteIP ) ); + + iSdpSession->iStoreRemoteOrigin = ETrue; + err = iSdpSession->DecodeOfferL( *offer, *iInSession ); + EUNIT_ASSERT( err == KErrNone ); + EUNIT_ASSERT( !iSdpSession->iRemoteOrigin->InetAddress()->CmpAddr( remoteIP ) ); + CleanupStack::PopAndDestroy( offer ); + } void UT_CMceSdpSession::UT_CMceSdpSession_DecodeOfferLL_CreateAnswer_NOK_1( ) { @@ -2851,6 +2880,13 @@ "DecodeOffer3L", "FUNCTIONALITY", SetupL, UT_CMceSdpSession_DecodeOfferL_3L, Teardown) + +EUNIT_TEST( + "iStoreRemoteOrigin - test", + "CMceSdpSession", + "DecodeOffer4L", + "FUNCTIONALITY", + SetupL, UT_CMceSdpSession_DecodeOfferL_4L, Teardown) EUNIT_TEST( "ForkL - test", diff -r 11893e44ad1b -r e07c9cb4153d multimediacommsengine/mmcesrv/mmcemediamanager/tsrc/ut_mediamanager/src/UT_cmcemediasdpcodec.cpp --- a/multimediacommsengine/mmcesrv/mmcemediamanager/tsrc/ut_mediamanager/src/UT_cmcemediasdpcodec.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommsengine/mmcesrv/mmcemediamanager/tsrc/ut_mediamanager/src/UT_cmcemediasdpcodec.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -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() diff -r 11893e44ad1b -r e07c9cb4153d multimediacommsengine/mmcesrv/mmceserver/inc/mcestateoffering.h --- a/multimediacommsengine/mmcesrv/mmceserver/inc/mcestateoffering.h Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommsengine/mmcesrv/mmceserver/inc/mcestateoffering.h Thu Jul 22 16:37:27 2010 +0100 @@ -22,6 +22,7 @@ #define CMCESTATEOFFERING_H #include "mcestate.h" +#include "mcesrv.h" /** * Represents MCE server state Offering @@ -154,7 +155,12 @@ void ExitSIPEventL( TMceStateTransitionEvent& aEvent ); void EntryAnswerToOfferDecodedL( TMceStateTransitionEvent& aEvent ); + +private: + TInt iLastResponse; + TBool iReadyToSendACK; + MCESRV_UT_DEFINITIONS; }; #endif diff -r 11893e44ad1b -r e07c9cb4153d multimediacommsengine/mmcesrv/mmceserver/src/mcesipmanager.cpp --- a/multimediacommsengine/mmcesrv/mmceserver/src/mcesipmanager.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommsengine/mmcesrv/mmceserver/src/mcesipmanager.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -1084,5 +1084,21 @@ } } } + + // Update orphan subsessions + RPointerArray& orphanSubSessions = iOrphanSubSessions->SubSessions(); + TInt orphanSubSessionCount = orphanSubSessions.Count(); + + for ( TInt j = 0; j < orphanSubSessionCount; ++j ) + { + CSIPProfile& subSessionProfile = orphanSubSessions[ j ]->Profile(); + if ( &subSessionProfile == &aOldProfile ) + { + MCESRV_DEBUG_DVALUE("update orphan subsession profile, j", j ) + MCESRV_DEBUG_DVALUES("oldProfile", (TInt)&aOldProfile, + "newProfile", (TInt)&aNewProfile ) + orphanSubSessions[ j ]->SetProfile( aNewProfile ); + } + } MCESRV_DEBUG("CMceSipManager::UpdateProfileToSubSessions, Exit") } diff -r 11893e44ad1b -r e07c9cb4153d multimediacommsengine/mmcesrv/mmceserver/src/mcestateestablished.cpp --- a/multimediacommsengine/mmcesrv/mmceserver/src/mcestateestablished.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommsengine/mmcesrv/mmceserver/src/mcestateestablished.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -27,7 +27,7 @@ #include "mcenatmacros.h" #include "mcesdpsession.h" #include "mcesrvlogs.h" - +#include "mcenatsipsession.h" // ----------------------------------------------------------------------------- // CMceStateEstablished::CMceStateEstablished @@ -180,7 +180,12 @@ //and thus, refresh is launched (INVITE) case EMceSessionRefresh: { - session.Actions().EncodeL(); + session.Actions().EncodeL(); + if ( session.IsNatSession() ) + { + CMceNatSipSession* natSession = static_cast( &session ); + natSession->CreateOfferL(); + } session.FCActions().UpdateFCOfferL( *session.Offer() ); session.Actions().SendSessionRefreshL(); break; diff -r 11893e44ad1b -r e07c9cb4153d multimediacommsengine/mmcesrv/mmceserver/src/mcestateoffering.cpp --- a/multimediacommsengine/mmcesrv/mmceserver/src/mcestateoffering.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommsengine/mmcesrv/mmceserver/src/mcestateoffering.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -43,7 +43,9 @@ // ----------------------------------------------------------------------------- // CMceStateOffering::CMceStateOffering () - : CMceState( KMceStateOffering ) + : CMceState( KMceStateOffering ), + iLastResponse ( 0 ), + iReadyToSendACK ( ETrue ) { } @@ -264,6 +266,7 @@ TInt status = KErrNone; CMceSipSession& session = aEvent.Session(); CSIPClientTransaction& response = session.Response(); + iLastResponse = MceSip::ResponseCode( response ); session.Extensions().UpdateL( response ); session.Actions().CheckContactIsSecureL( response ); @@ -439,14 +442,35 @@ TInt status = KErrNone; CMceSipSession& session = aEvent.Session(); CMceSipSession::TSubState subState = session.SubState(); + TInt currentResponse = MceSip::ResponseCode( session.Response() ); + // If media handling is ongoing while 200OK arrives with certain SDP content + // don't send ACK thus the UAS will retransmit 200OK untile pervious meida handling + // finish. + + if ( KMceSipRinging == iLastResponse && + KMceSipOK == currentResponse && + MceSip::HasContent( session.Response() ) ) + { + if ( session.WaitingMediaCallback() ) + { + iReadyToSendACK = EFalse; + MCESRV_DEBUG("Waiting media callback, do not send ACK for this 200OK") + return; + } + else + { + iReadyToSendACK = ETrue; + MCESRV_DEBUG("Ready to send ACK") + } + } //send ACK session.Actions().SendACKL( session.Response() ); session.Actions().CheckContactIsSecureL( session.Response() ); session.ActiveBody().AnswerType() = KMceNegotiationAnswerTypeFinal; - // Handle the answer only if the media processing is not - // already ongoing + iLastResponse = currentResponse; + if ( !session.WaitingMediaCallback() ) { if ( MceSip::HasContent( session.Response() ) ) @@ -767,6 +791,11 @@ // void CMceStateOffering::ExitL( TMceStateTransitionEvent& aEvent ) { + if ( !iReadyToSendACK ) + { + MCESRV_DEBUG("Not ready, don't change any state"); + return; + } if ( IsExtensionRequestEvent( aEvent )) { diff -r 11893e44ad1b -r e07c9cb4153d multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/inc/UT_CMCESIPManager.h --- a/multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/inc/UT_CMCESIPManager.h Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/inc/UT_CMCESIPManager.h Thu Jul 22 16:37:27 2010 +0100 @@ -102,6 +102,8 @@ void UT_CMceSipManager_SIPClientL(); void UT_CMceSipManager_OrphanSubSessionCountL(); + + void UT_CMceSipManager_UpdateProfileToSubSessionsL(); private: // Data diff -r 11893e44ad1b -r e07c9cb4153d multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/src/UT_CMCESIPManager.cpp --- a/multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/src/UT_CMCESIPManager.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/src/UT_CMCESIPManager.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -480,6 +480,43 @@ EUNIT_ASSERT( iManager->OrphanSubSessionCount() == 0 ); } +void UT_CMceSipManager::UT_CMceSipManager_UpdateProfileToSubSessionsL() + { + iIds.iProfileID = 1; + iIds.iManagerType = KMceCSSIPSession; + iIds.iDialogType = KMceDlgTypeInvite; + + CDesC8ArrayFlat* params = new (ELeave) CDesC8ArrayFlat( KMceArrayGranularity ); + CleanupStack::PushL( params ); + params->AppendL( _L8("User ") ); + params->AppendL( _L8("User ") ); + + CMceCsSubSession* subsession = + iManager->CreateSubSessionL( *iSession, iIds, *params ); + CleanupStack::PushL( subsession ); + + CSIPProfile& profileOld = subsession->Profile(); + EUNIT_ASSERT( &profileOld != NULL ); + CSIPProfile& profileNew = iManager->ProfileL( 2 ); + EUNIT_ASSERT( &profileNew != NULL ); + + CMceCsSessionImplementation& session = iManager->iClients[ 0 ]->Implementation(); + RPointerArray& subSessions = session.SubSessions(); + subSessions.AppendL(subsession); + + iManager->UpdateProfileToSubSessions(profileNew, profileOld); + EUNIT_ASSERT(&subsession->Profile() == &profileNew) + subSessions.Remove(0); + + iManager->AddOrphanSubSessionL( subsession ); + iManager->UpdateProfileToSubSessions(profileOld, profileNew); + RPointerArray& orphanSubSessions = iManager->iOrphanSubSessions->SubSessions(); + EUNIT_ASSERT(&subsession->Profile() == &profileOld) + + CleanupStack::Pop( subsession ); + CleanupStack::PopAndDestroy( params ); + } + // TEST TABLE @@ -621,6 +658,12 @@ "FUNCTIONALITY", SetupL, UT_CMceSipManager_OrphanSubSessionCountL, Teardown) +EUNIT_TEST( + "UpdateProfileToSubSessions - test ", + "CMceSipManager", + "UpdateProfileToSubSessions", + "FUNCTIONALITY", + SetupL, UT_CMceSipManager_UpdateProfileToSubSessionsL, Teardown) EUNIT_END_TEST_TABLE diff -r 11893e44ad1b -r e07c9cb4153d multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/stubs/inc/sipprofile.h --- a/multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/stubs/inc/sipprofile.h Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/stubs/inc/sipprofile.h Thu Jul 22 16:37:27 2010 +0100 @@ -325,6 +325,11 @@ */ void ClearRegistry(); + /** + * Set context id + */ + void SetContextId(TInt aContextId); + public: // for unittesting void SetParam( TUint aParam, HBufC8* aValue ); @@ -377,6 +382,8 @@ HBufC8* iRequestUriUser; HBufC8* iContactHeader; + TInt iContextId; + //definitions for unit testing MCESRV_UT_DEFINITIONS diff -r 11893e44ad1b -r e07c9cb4153d multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/stubs/src/sipprofile.cpp --- a/multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/stubs/src/sipprofile.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/stubs/src/sipprofile.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -191,7 +191,7 @@ } if( aParam == KSIPProfileId ) { - aVal = 1; + aVal = ContextId(); } return ret; } @@ -279,7 +279,7 @@ // ----------------------------------------------------------------------------- // CSIPProfile::CSIPProfile(): - iEnabled(EFalse) + iEnabled(EFalse), iContextId(1) { } @@ -307,6 +307,11 @@ { return ETrue; } + +void CSIPProfile::SetContextId(TInt aContextId) + { + iContextId = aContextId; + } // ----------------------------------------------------------------------------- // CSIPProfile::ContextId @@ -314,7 +319,7 @@ // TUint32 CSIPProfile::ContextId() const { - return 1; + return iContextId; } // ----------------------------------------------------------------------------- diff -r 11893e44ad1b -r e07c9cb4153d multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/stubs/src/sipprofileregistrybase.cpp --- a/multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/stubs/src/sipprofileregistrybase.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/stubs/src/sipprofileregistrybase.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -52,9 +52,13 @@ // stubs CSIPProfileRegistry* reg = (CSIPProfileRegistry*) this; CSIPProfile* profile = CSIPProfile::NewLC(reg); + CSIPProfile* profile2 = CSIPProfile::NewLC(reg); + profile2->SetContextId(2); aProfiles.AppendL ( profile ); + aProfiles.AppendL ( profile2 ); + CleanupStack::Pop( profile2 ); CleanupStack::Pop( profile ); @@ -72,8 +76,12 @@ CSIPProfileRegistry* reg = (CSIPProfileRegistry*) this; CSIPProfile* profile = CSIPProfile::NewLC( reg ); + CSIPProfile* profile2 = CSIPProfile::NewLC(reg); + profile2->SetContextId(2); aProfiles.AppendL ( profile ); + aProfiles.AppendL ( profile2 ); + CleanupStack::Pop( profile2 ); CleanupStack::Pop( profile ); } diff -r 11893e44ad1b -r e07c9cb4153d natfw/natfwconnectionmultiplexer/src/cncmconnectionobserverhandler.cpp --- a/natfw/natfwconnectionmultiplexer/src/cncmconnectionobserverhandler.cpp Thu Jun 17 22:31:54 2010 +0100 +++ b/natfw/natfwconnectionmultiplexer/src/cncmconnectionobserverhandler.cpp Thu Jul 22 16:37:27 2010 +0100 @@ -260,20 +260,25 @@ const TInt KRtpRtcpDiffByteOffset( 1 ); const TInt KLowestAssignedRtcpMsgType = 200; const TInt KHighestAssignedRtcpMsgType = 209; + TInt rtcpType = aMessage[KRtpRtcpDiffByteOffset]; TBool isRtcp = - ( KLowestAssignedRtcpMsgType <= aMessage[KRtpRtcpDiffByteOffset] && - aMessage[KRtpRtcpDiffByteOffset] <= KHighestAssignedRtcpMsgType ); + ( KLowestAssignedRtcpMsgType <= rtcpType && + rtcpType <= KHighestAssignedRtcpMsgType ); - // This offset refers either to SR RTP timestamp or RR highest - // sequence number received. These are unique for a distinct - // RTCP packet. - const TInt KRtcpDiffByteOffset( 19 ); + // This offset refers to RR highest sequence number received. + const TInt KRRtcpDiffByteOffset( 19 ); + + // This offset refers either to SR RTP packet count received. + const TInt KSRtcpDiffByteOffset( 23 ); // This offset refers to lower byte of unique RTP sequence number. const TInt KRtpDiffByteOffset( 3 ); TInt diffByteOffset - = isRtcp ? KRtcpDiffByteOffset : KRtpDiffByteOffset; + = isRtcp ? KRRtcpDiffByteOffset : KRtpDiffByteOffset; + diffByteOffset = (rtcpType == KLowestAssignedRtcpMsgType)? + KSRtcpDiffByteOffset : diffByteOffset; + if ( diffByteOffset < aMessage.Size() ) { hash = aMessage[diffByteOffset]; @@ -294,14 +299,12 @@ } else { - isDuplicate = EFalse; - } - - iLatestHashes.Append( hash ); - const TInt KMaxHashCount( 5 ); - if ( KMaxHashCount <= iLatestHashes.Count() ) - { - iLatestHashes.Remove( 0 ); + iLatestHashes.Append( hash ); + const TInt KMaxHashCount( 5 ); + if ( KMaxHashCount <= iLatestHashes.Count() ) + { + iLatestHashes.Remove( 0 ); + } } } else diff -r 11893e44ad1b -r e07c9cb4153d package_definition.xml --- a/package_definition.xml Thu Jun 17 22:31:54 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,214 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -