# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1273584880 -10800 # Node ID a5ac35ca6d81b6d022a05fb3a3433cfd82038b42 # Parent 5bf83dc720b3d1cb7ec107de6dff9f1ce5c3cd01 Revision: 201016 Kit: 201019 diff -r 5bf83dc720b3 -r a5ac35ca6d81 multimediacommscontroller/mmcccontroller/data/102073F6.rss --- a/multimediacommscontroller/mmcccontroller/data/102073F6.rss Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommscontroller/mmcccontroller/data/102073F6.rss Tue May 11 16:34:40 2010 +0300 @@ -41,7 +41,7 @@ version_no = KIpappsrvEcomVersionNumber; display_name = "MCC Controller"; default_data = ""; - opaque_data = "0x400000"; + opaque_data = "0x4000000x5000"; } }; } diff -r 5bf83dc720b3 -r a5ac35ca6d81 multimediacommscontroller/mmcccontroller/src/mcccamerahandler.cpp --- a/multimediacommscontroller/mmcccontroller/src/mcccamerahandler.cpp Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommscontroller/mmcccontroller/src/mcccamerahandler.cpp Tue May 11 16:34:40 2010 +0300 @@ -731,10 +731,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 +763,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 5bf83dc720b3 -r a5ac35ca6d81 multimediacommscontroller/mmccfilesourcesink/src/mccfilesink.cpp --- a/multimediacommscontroller/mmccfilesourcesink/src/mccfilesink.cpp Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommscontroller/mmccfilesourcesink/src/mccfilesink.cpp Tue May 11 16:34:40 2010 +0300 @@ -582,6 +582,7 @@ { iAddToTimestamp += ( currDifference + averageTimeStampDifference ); iTimestamps.Reset(); + iPausedDuration = 0; __FILESINK_CONTROLL_INT1("CMccFileSink::TimeToPlay, iAddToTimestamp=", iAddToTimestamp ) } diff -r 5bf83dc720b3 -r a5ac35ca6d81 multimediacommscontroller/mmccvideosourcesink/group/videosourcesink.mmp --- a/multimediacommscontroller/mmccvideosourcesink/group/videosourcesink.mmp Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommscontroller/mmccvideosourcesink/group/videosourcesink.mmp Tue May 11 16:34:40 2010 +0300 @@ -35,7 +35,6 @@ SOURCE mccvideojitterbuffer.cpp SOURCE mccvideosourceimpl.cpp SOURCE mccvideosourcewrapper.cpp -SOURCE mccredrawhandler.cpp SOURCE mccvideosourcekeyretriever.cpp #if (defined WINS) diff -r 5bf83dc720b3 -r a5ac35ca6d81 multimediacommscontroller/mmccvideosourcesink/inc/mccvideosinkimpl.h --- a/multimediacommscontroller/mmccvideosourcesink/inc/mccvideosinkimpl.h Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommscontroller/mmccvideosourcesink/inc/mccvideosinkimpl.h Tue May 11 16:34:40 2010 +0300 @@ -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 5bf83dc720b3 -r a5ac35ca6d81 multimediacommscontroller/mmccvideosourcesink/inc/mccvideosourceimpl.h --- a/multimediacommscontroller/mmccvideosourcesink/inc/mccvideosourceimpl.h Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommscontroller/mmccvideosourcesink/inc/mccvideosourceimpl.h Tue May 11 16:34:40 2010 +0300 @@ -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 5bf83dc720b3 -r a5ac35ca6d81 multimediacommscontroller/mmccvideosourcesink/inc/mccvideosourcewrapper.h --- a/multimediacommscontroller/mmccvideosourcesink/inc/mccvideosourcewrapper.h Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommscontroller/mmccvideosourcesink/inc/mccvideosourcewrapper.h Tue May 11 16:34:40 2010 +0300 @@ -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 5bf83dc720b3 -r a5ac35ca6d81 multimediacommscontroller/mmccvideosourcesink/src/mccredrawhandler.cpp --- a/multimediacommscontroller/mmccvideosourcesink/src/mccredrawhandler.cpp Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommscontroller/mmccvideosourcesink/src/mccredrawhandler.cpp Tue May 11 16:34:40 2010 +0300 @@ -61,7 +61,6 @@ __V_SOURCESINK_CONTROLL_INT1( "CMccRedrawHandler::BlackDrawingL, enabled:", aIsEnabled ) - iDrawBlack = aIsEnabled; if ( DoRedrawing() ) { @@ -116,8 +115,7 @@ CActive( CActive::EPriorityStandard ), iWsSession( aWsSession ), iWindow( aWindow ), - iGc( aGc ), - iDrawBlack( EFalse ) + iGc( aGc ) { CActiveScheduler::Add( this ); } @@ -150,14 +148,7 @@ iWindow.Invalidate( aRect ); iWindow.BeginRedraw( aRect ); - if ( iDrawBlack ) - { - iGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); - iGc.SetBrushColor( KRgbBlack ); - iGc.Clear( aRect ); - iDrawBlack = EFalse; - } - else if ( iWindow.DisplayMode() >= EColor16MA ) + if ( iWindow.DisplayMode() >= EColor16MA ) { // Need to set alpha mode, otherwise video cannot be seen iGc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha ); @@ -182,7 +173,7 @@ // TBool CMccRedrawHandler::DoRedrawing() const { - return ( iDrawBlack || iWindow.DisplayMode() >= EColor16MA ); + return ( iWindow.DisplayMode() >= EColor16MA ); } // ----------------------------------------------------------------------------- diff -r 5bf83dc720b3 -r a5ac35ca6d81 multimediacommscontroller/mmccvideosourcesink/src/mccvideosinkimpl.cpp --- a/multimediacommscontroller/mmccvideosourcesink/src/mccvideosinkimpl.cpp Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommscontroller/mmccvideosourcesink/src/mccvideosinkimpl.cpp Tue May 11 16:34:40 2010 +0300 @@ -31,7 +31,6 @@ #include "mmcccodecamr.h" #include "mccvideosinkuser.h" #include "mccdef.h" -#include "mccredrawhandler.h" #include "mccinternaldef.h" #include @@ -139,45 +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 ); - iRwGroup->AutoForeground( EFalse ); - - // 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 @@ -246,14 +207,10 @@ } delete iVideoPlayer; - - delete iRedrawHandler; + iVideoPlayer = NULL; - delete iGc; - delete iDev; + DeleteWindowingElements(); - delete iRw; - delete iRwGroup; iRwSession.Close(); delete iServerName; @@ -420,7 +377,6 @@ } else { - iRedrawHandler->BlackDrawingL( ETrue ); SendStreamEventToClient( KMccStreamStarted, iCurrentUser ); SetStartedOnce( userEntry, ETrue ); } @@ -778,8 +734,6 @@ user.PacketOverflowState() != CMccVideoSinkUser::EOccured && dataSize >= KMccMinPacketSize ) { - iRedrawHandler->BlackDrawingL( EFalse ); - __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl::EmptyBufferL, sending packet to helix" ) @@ -838,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 ); @@ -1947,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 5bf83dc720b3 -r a5ac35ca6d81 multimediacommscontroller/mmccvideosourcesink/src/mccvideosourceimpl.cpp --- a/multimediacommscontroller/mmccvideosourcesink/src/mccvideosourceimpl.cpp Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommscontroller/mmccvideosourcesink/src/mccvideosourceimpl.cpp Tue May 11 16:34:40 2010 +0300 @@ -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 5bf83dc720b3 -r a5ac35ca6d81 multimediacommscontroller/mmccvideosourcesink/src/mccvideosourcewrapper.cpp --- a/multimediacommscontroller/mmccvideosourcesink/src/mccvideosourcewrapper.cpp Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommscontroller/mmccvideosourcesink/src/mccvideosourcewrapper.cpp Tue May 11 16:34:40 2010 +0300 @@ -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 5bf83dc720b3 -r a5ac35ca6d81 multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/group/UT_CMCCVideoSourceSink.mmp --- a/multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/group/UT_CMCCVideoSourceSink.mmp Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/group/UT_CMCCVideoSourceSink.mmp Tue May 11 16:34:40 2010 +0300 @@ -44,7 +44,6 @@ SOURCE MccVideoSource.cpp SOURCE MccVideoSourceWrapper.cpp SOURCE MccVideoSourceSinkFactory.cpp -SOURCE MccRedrawHandler.cpp SOURCE mccvideosourcekeyretriever.cpp SOURCEPATH ../src diff -r 5bf83dc720b3 -r a5ac35ca6d81 multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/src/UT_CMCCVideoSinkImpl.cpp --- a/multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/src/UT_CMCCVideoSinkImpl.cpp Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/src/UT_CMCCVideoSinkImpl.cpp Tue May 11 16:34:40 2010 +0300 @@ -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 5bf83dc720b3 -r a5ac35ca6d81 multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/src/UT_CMCCVideoSourceImpl.cpp --- a/multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/src/UT_CMCCVideoSourceImpl.cpp Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/src/UT_CMCCVideoSourceImpl.cpp Tue May 11 16:34:40 2010 +0300 @@ -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 5bf83dc720b3 -r a5ac35ca6d81 multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/stubs/inc/CCMRMediaRecorder.h --- a/multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/stubs/inc/CCMRMediaRecorder.h Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/stubs/inc/CCMRMediaRecorder.h Tue May 11 16:34:40 2010 +0300 @@ -546,6 +546,8 @@ TUid iEncoderUid; + TVideoDataUnitEncapsulation iEncapsulation; + }; #endif // CCMRMEDIARECORDER_H diff -r 5bf83dc720b3 -r a5ac35ca6d81 multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/stubs/src/CCMRMediaRecorder_STUB.cpp --- a/multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/stubs/src/CCMRMediaRecorder_STUB.cpp Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommscontroller/mmccvideosourcesink/tsrc/ut_videosourcesink/stubs/src/CCMRMediaRecorder_STUB.cpp Tue May 11 16:34:40 2010 +0300 @@ -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 5bf83dc720b3 -r a5ac35ca6d81 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 Tue May 11 16:34:40 2010 +0300 @@ -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 5bf83dc720b3 -r a5ac35ca6d81 multimediacommscontroller/tsrc/stubs/src/ws_stubs.cpp --- a/multimediacommscontroller/tsrc/stubs/src/ws_stubs.cpp Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommscontroller/tsrc/stubs/src/ws_stubs.cpp Tue May 11 16:34:40 2010 +0300 @@ -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 5bf83dc720b3 -r a5ac35ca6d81 multimediacommsengine/mmcesrv/mmcemediamanager/inc/mcesdpsession.h --- a/multimediacommsengine/mmcesrv/mmcemediamanager/inc/mcesdpsession.h Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommsengine/mmcesrv/mmcemediamanager/inc/mcesdpsession.h Tue May 11 16:34:40 2010 +0300 @@ -409,7 +409,8 @@ // old local port, used for refresh TUint iOldLocalMediaPort; - + + TBool iStoreRemoteOrigin; //definitions for unit testing MCEMM_UT_DEFINITIONS diff -r 5bf83dc720b3 -r a5ac35ca6d81 multimediacommsengine/mmcesrv/mmcemediamanager/src/mcemedianegotiated.cpp --- a/multimediacommsengine/mmcesrv/mmcemediamanager/src/mcemedianegotiated.cpp Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommsengine/mmcesrv/mmcemediamanager/src/mcemedianegotiated.cpp Tue May 11 16:34:40 2010 +0300 @@ -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 5bf83dc720b3 -r a5ac35ca6d81 multimediacommsengine/mmcesrv/mmcemediamanager/src/mcesdpsession.cpp --- a/multimediacommsengine/mmcesrv/mmcemediamanager/src/mcesdpsession.cpp Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommsengine/mmcesrv/mmcemediamanager/src/mcesdpsession.cpp Tue May 11 16:34:40 2010 +0300 @@ -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 ); diff -r 5bf83dc720b3 -r a5ac35ca6d81 multimediacommsengine/mmcesrv/mmcemediamanager/tsrc/ut_mediamanager/inc/UT_CMCESdpSession.h --- a/multimediacommsengine/mmcesrv/mmcemediamanager/tsrc/ut_mediamanager/inc/UT_CMCESdpSession.h Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommsengine/mmcesrv/mmcemediamanager/tsrc/ut_mediamanager/inc/UT_CMCESdpSession.h Tue May 11 16:34:40 2010 +0300 @@ -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 5bf83dc720b3 -r a5ac35ca6d81 multimediacommsengine/mmcesrv/mmcemediamanager/tsrc/ut_mediamanager/src/UT_CMCESdpSession.cpp --- a/multimediacommsengine/mmcesrv/mmcemediamanager/tsrc/ut_mediamanager/src/UT_CMCESdpSession.cpp Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommsengine/mmcesrv/mmcemediamanager/tsrc/ut_mediamanager/src/UT_CMCESdpSession.cpp Tue May 11 16:34:40 2010 +0300 @@ -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 5bf83dc720b3 -r a5ac35ca6d81 multimediacommsengine/mmcesrv/mmceserver/src/mcestateestablished.cpp --- a/multimediacommsengine/mmcesrv/mmceserver/src/mcestateestablished.cpp Tue Apr 27 17:02:55 2010 +0300 +++ b/multimediacommsengine/mmcesrv/mmceserver/src/mcestateestablished.cpp Tue May 11 16:34:40 2010 +0300 @@ -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;