# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1262861249 -7200 # Node ID 4a81900cd18bfcea35e124184f38b034a564b5fd # Parent 4fbbce2c82baeb7c50c647310a63922263e34431 Revision: 200951 Kit: 201001 diff -r 4fbbce2c82ba -r 4a81900cd18b vtengines/videoteleng/Src/Media/CVtEngDrawNGA.cpp --- a/vtengines/videoteleng/Src/Media/CVtEngDrawNGA.cpp Thu Dec 17 08:46:53 2009 +0200 +++ b/vtengines/videoteleng/Src/Media/CVtEngDrawNGA.cpp Thu Jan 07 12:47:29 2010 +0200 @@ -356,6 +356,103 @@ void CVtEngDrawNGA::BaseVideoFrameSizeChangedL( const TSize& /*aTo*/ ) { __VTPRINTENTER( "RVD(NGA).BaseVideoFrameSizeChangedL" ) + BaseConstructL(); + + TInt err; + + iConfig.iRemoteWindow->RemoveBackgroundSurface(ETrue); + iConfig.iWsSession->UnregisterSurface(0, iSurfaceId); + + iSurfaceChunk->Close(); + delete iSurfaceChunk; + iSurfaceChunk = NULL; + iSurfaceManager->CloseSurface(iSurfaceId); + iSurfaceUpdateSession.CancelAllUpdateNotifications(); + iSurfaceUpdateSession.Close(); + + /* Close the surface manager handle */ + iSurfaceManager->Close(); + delete iSurfaceManager; + iSurfaceManager = 0; + + for ( TInt i = KVtEngMaxSurfaceBuffers-1; i >= 0 ; i-- ) + { + if (iCallBackTable[i]) + { + iCallBackTable[i]->Cancel(); + delete iCallBackTable[i]; + iCallBackTable[i] = NULL; + } + } + iSurfaceBuffers[ 0 ].UnSet(); + iSurfaceBuffers[ 1 ].UnSet(); + iSurfaceBuffer0.UnSet(); + iSurfaceBuffer1.UnSet(); + iWaitingBuffers.Reset(); + + err = iSurfaceUpdateSession.Connect(); + User::LeaveIfError(err); + + iSurfaceManager = new RSurfaceManager(); + + User::LeaveIfNull(iSurfaceManager); + err = iSurfaceManager->Open(); + User::LeaveIfError(err); + + RSurfaceManager::TSurfaceCreationAttributesBuf attributes; + attributes().iPixelFormat = iSurfaceFormat; + attributes().iSize = iSourceSize; + attributes().iBuffers = KVtEngMaxSurfaceBuffers; + + //attributes().iStride = iSourceSize.iWidth*2; + attributes().iStride = iSourceSize.iWidth*3/2; + + attributes().iOffsetToFirstBuffer = 0; + attributes().iAlignment = 4; + attributes().iContiguous = EFalse; + attributes().iMappable = ETrue; + + err = iSurfaceManager->CreateSurface(attributes, iSurfaceId); + User::LeaveIfError(err); + + // Map to chunk + iSurfaceChunk = new RChunk(); + User::LeaveIfNull(iSurfaceChunk); + err = iSurfaceManager->MapSurface(iSurfaceId, *iSurfaceChunk); + User::LeaveIfError(err); + + // Get the info from the surfaceManager + RSurfaceManager::TInfoBuf info; + err = iSurfaceManager->SurfaceInfo(iSurfaceId, info); + User::LeaveIfError(err); + + TInt offset; + iSurfaceManager->GetBufferOffset(iSurfaceId, 0, offset); + iSurfaceBuffer0.Set(iSurfaceChunk->Base() + offset, 0 ); + iSurfaceManager->GetBufferOffset(iSurfaceId, 1, offset); + iSurfaceBuffer1.Set(iSurfaceChunk->Base() + offset, 1 ); + + iConfig.iWsSession->RegisterSurface(0, iSurfaceId); + iConfig.iRemoteWindow->SetBackgroundSurface(iSurfaceId); + + iCallBackTable[0] = new(ELeave) CActiveCallBack( + TCallBack(SurfaceBuffer0Ready, this), + CActive::EPriorityStandard-1); + CActiveScheduler::Add(iCallBackTable[0]); + + iCallBackTable[1] = new(ELeave) CActiveCallBack( + TCallBack(SurfaceBuffer1Ready, this), + CActive::EPriorityStandard-1); + CActiveScheduler::Add(iCallBackTable[1]); + + iSurfaceCreated = ETrue; + + ClearFlag( EInitializePostingSurfaceCalled ); + + // set the params for DS + UpdateSinkParamsL(); + ClearFlag( EFirstFrameReceived ); + __VTPRINTEXIT( "RVD(NGA).BaseVideoFrameSizeChangedL" ) } @@ -553,27 +650,35 @@ if (iSurfaceManager) { - return; - - // Last return statement is for fixing an error causes - // green screen of remote video when swapping image after - // remote peer disabled video. - // So we return here to prevent recreate the surface object - // at this moment, codes below should NOT be removed due to - // potential future uses. + /* Change log for recreate surface objects + * Surface staffs should NOT be recreated once created, + * but unregister and register needs to be done since the + * bounding window change its position and size. At this + * moment, reset the iWaitingBuffers and reset the callbacks + * are recommended. + */ iConfig.iRemoteWindow->RemoveBackgroundSurface(ETrue); iConfig.iWsSession->UnregisterSurface(0, iSurfaceId); + + /* Comment out below code to prevent delete the surface objects + * at this current stage, code below should NOT be removed due to + * potential future uses. + */ + /* iSurfaceChunk->Close(); delete iSurfaceChunk; iSurfaceChunk = NULL; iSurfaceManager->CloseSurface(iSurfaceId); iSurfaceUpdateSession.CancelAllUpdateNotifications(); iSurfaceUpdateSession.Close(); - + */ + /* Close the surface manager handle */ + /* iSurfaceManager->Close(); delete iSurfaceManager; iSurfaceManager = 0; + */ } for ( TInt i = KVtEngMaxSurfaceBuffers-1; i >= 0 ; i-- ) { @@ -584,61 +689,77 @@ iCallBackTable[i] = NULL; } } + /* Comment out below code to prevent delete the surface buffers, + * otherwise the last buffer would not store the last frame. + * Code below should NOT be removed due to potential future uses. + */ + /* iSurfaceBuffers[ 0 ].UnSet(); iSurfaceBuffers[ 1 ].UnSet(); iSurfaceBuffer0.UnSet(); iSurfaceBuffer1.UnSet(); + */ iWaitingBuffers.Reset(); } + /* Add else branch to escape the recreate of the surface objects, + * it could be changed in future. + */ + else + { + err = iSurfaceUpdateSession.Connect(); + User::LeaveIfError(err); + + iSurfaceManager = new RSurfaceManager(); + + User::LeaveIfNull(iSurfaceManager); + err = iSurfaceManager->Open(); + User::LeaveIfError(err); + + RSurfaceManager::TSurfaceCreationAttributesBuf attributes; + attributes().iPixelFormat = iSurfaceFormat; + attributes().iSize = iSourceSize; + attributes().iBuffers = KVtEngMaxSurfaceBuffers; + + //attributes().iStride = iSourceSize.iWidth*2; + attributes().iStride = iSourceSize.iWidth*3/2; + + attributes().iOffsetToFirstBuffer = 0; + attributes().iAlignment = 4; + attributes().iContiguous = EFalse; + attributes().iMappable = ETrue; + + err = iSurfaceManager->CreateSurface(attributes, iSurfaceId); + User::LeaveIfError(err); + + // Map to chunk + iSurfaceChunk = new RChunk(); + User::LeaveIfNull(iSurfaceChunk); + err = iSurfaceManager->MapSurface(iSurfaceId, *iSurfaceChunk); + User::LeaveIfError(err); + + // Get the info from the surfaceManager + RSurfaceManager::TInfoBuf info; + err = iSurfaceManager->SurfaceInfo(iSurfaceId, info); + User::LeaveIfError(err); + + TInt offset; + iSurfaceManager->GetBufferOffset(iSurfaceId, 0, offset); + iSurfaceBuffer0.Set(iSurfaceChunk->Base() + offset, 0 ); + iSurfaceManager->GetBufferOffset(iSurfaceId, 1, offset); + iSurfaceBuffer1.Set(iSurfaceChunk->Base() + offset, 1 ); + } - err = iSurfaceUpdateSession.Connect(); - User::LeaveIfError(err); - - iSurfaceManager = new RSurfaceManager(); - - User::LeaveIfNull(iSurfaceManager); - err = iSurfaceManager->Open(); - User::LeaveIfError(err); - - RSurfaceManager::TSurfaceCreationAttributesBuf attributes; - attributes().iPixelFormat = iSurfaceFormat; - attributes().iSize = iSourceSize; - attributes().iBuffers = KVtEngMaxSurfaceBuffers; - - //attributes().iStride = iSourceSize.iWidth*2; - attributes().iStride = iSourceSize.iWidth*3/2; - - attributes().iOffsetToFirstBuffer = 0; - attributes().iAlignment = 4; - attributes().iContiguous = EFalse; - attributes().iMappable = ETrue; - - err = iSurfaceManager->CreateSurface(attributes, iSurfaceId); - User::LeaveIfError(err); - - // Map to chunk - iSurfaceChunk = new RChunk(); - User::LeaveIfNull(iSurfaceChunk); - err = iSurfaceManager->MapSurface(iSurfaceId, *iSurfaceChunk); - User::LeaveIfError(err); - - // Get the info from the surfaceManager - RSurfaceManager::TInfoBuf info; - err = iSurfaceManager->SurfaceInfo(iSurfaceId, info); - User::LeaveIfError(err); - - TInt offset; - iSurfaceManager->GetBufferOffset(iSurfaceId, 0, offset); - iSurfaceBuffer0.Set(iSurfaceChunk->Base() + offset, 0 ); - iSurfaceManager->GetBufferOffset(iSurfaceId, 1, offset); - iSurfaceBuffer1.Set(iSurfaceChunk->Base() + offset, 1 ); - iConfig.iWsSession->RegisterSurface(0, iSurfaceId); iConfig.iRemoteWindow->SetBackgroundSurface(iSurfaceId); - iCallBackTable[0] = new(ELeave) CActiveCallBack(TCallBack(SurfaceBuffer0Ready, this), CActive::EPriorityStandard-1); + iCallBackTable[0] = new(ELeave) CActiveCallBack( + TCallBack(SurfaceBuffer0Ready, this), + CActive::EPriorityStandard-1); CActiveScheduler::Add(iCallBackTable[0]); - iCallBackTable[1] = new(ELeave) CActiveCallBack(TCallBack(SurfaceBuffer1Ready, this), CActive::EPriorityStandard-1); + + iCallBackTable[1] = new(ELeave) CActiveCallBack( + TCallBack(SurfaceBuffer1Ready, this), + CActive::EPriorityStandard-1); CActiveScheduler::Add(iCallBackTable[1]); iSurfaceCreated = ETrue; diff -r 4fbbce2c82ba -r 4a81900cd18b vtuis/videotelui/src/CVtUiAppUi.cpp --- a/vtuis/videotelui/src/CVtUiAppUi.cpp Thu Dec 17 08:46:53 2009 +0200 +++ b/vtuis/videotelui/src/CVtUiAppUi.cpp Thu Jan 07 12:47:29 2010 +0200 @@ -1811,6 +1811,9 @@ } ExecuteCmdL( KVtEngStopRenderRemote ); + // Re-layout the remote video + iDownlinkWindow->LayoutRemoteVideo(); + const TBool uplinkWindowEqualsContextControl = ( iUplinkWindow == iInstance->iContextControl ); @@ -2198,7 +2201,6 @@ CleanupPushEnableBlindL(); iUiStates->SetDisableBlindSetting( ETrue ); CmdSwapImagesPlacesL(); - MVtEngMedia& media = Model().Media(); if ( VtUiUtility::GetFreezeState( media ) ) diff -r 4fbbce2c82ba -r 4a81900cd18b vtuis/videotelui/src/CVtUiContextControl.cpp --- a/vtuis/videotelui/src/CVtUiContextControl.cpp Thu Dec 17 08:46:53 2009 +0200 +++ b/vtuis/videotelui/src/CVtUiContextControl.cpp Thu Jan 07 12:47:29 2010 +0200 @@ -90,7 +90,12 @@ else if( iOkToSwapOnButtonUp ) { if ( !iUiStates.IsWhiteBalanceModeOn() && - !iUiStates.IsColorToneModeOn() ) + !iUiStates.IsColorToneModeOn() && + !iUiStates.IsZoomModeOn() && + !iUiStates.IsCaptureModeOn() && + !iUiStates.IsContrastModeOn() && + !iUiStates.IsBrightnessModeOn() && + !iUiStates.IsVolumeModeOn() ) { if ( !( iAppUi.CanSwapImagePlaces() ) ) { diff -r 4fbbce2c82ba -r 4a81900cd18b vtuis/videotelui/src/cvtuivideocontrolbase.cpp --- a/vtuis/videotelui/src/cvtuivideocontrolbase.cpp Thu Dec 17 08:46:53 2009 +0200 +++ b/vtuis/videotelui/src/cvtuivideocontrolbase.cpp Thu Jan 07 12:47:29 2010 +0200 @@ -401,11 +401,12 @@ void CVtUiVideoControlBase::SetBlind( TBool aBlindStatus ) { __VTPRINTENTER( "VidCtrlBase.SetBlind" ) - if ( iBlindStatus != aBlindStatus ) - { + /* Once SetBlind called, re-draw the control anyway */ +// if ( iBlindStatus != aBlindStatus ) +// { iBlindStatus = aBlindStatus; DrawNow(); - } +// } __VTPRINTEXITR( "VidCtrlBase.SetBlind %d", iBlindStatus ) }