--- a/connectivitymodules/SeCon/services/pcd/src/sconvideoparser.cpp Mon May 03 12:24:28 2010 +0300
+++ b/connectivitymodules/SeCon/services/pcd/src/sconvideoparser.cpp Tue Jul 13 03:28:47 2010 +0530
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 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"
@@ -27,7 +27,7 @@
_LIT( KMimeTypeAudio, "audio/*" );
_LIT( KMimeTypeVideo, "video/*" );
-const TInt KVideoClipTimeout( 10000000 ); // 10 sec.
+const TInt KRequestTimeOut( 20000000 ); // 20 sec.
// -----------------------------------------------------------------------------
// CSConVideoParser::CSConVideoParser()
@@ -57,6 +57,13 @@
iVideoUtil->Close();
}
delete iVideoUtil;
+
+ if ( iWindow )
+ {
+ iWindow->Close();
+ }
+ delete iWindow;
+ iRootWindow.Close();
delete iScreen;
iWsSession.Close();
@@ -90,26 +97,16 @@
User::LeaveIfError( iWsSession.Connect() );
iScreen = new(ELeave) CWsScreenDevice( iWsSession );
- iScreen->Construct();
-
- RWindowGroup wg( iWsSession );
- User::LeaveIfError( wg.Construct(reinterpret_cast<TUint32>(&wg), EFalse) );
- CleanupClosePushL( wg );
+ User::LeaveIfError( iScreen->Construct() );
- CWindowGc* gc;
- User::LeaveIfError( iScreen->CreateContext(gc) );
- CleanupStack::PushL(gc);
+ iRootWindow = RWindowGroup(iWsSession);
+ User::LeaveIfError( iRootWindow.Construct(reinterpret_cast<TUint32>(&iWsSession), EFalse) );
- RWindow window( iWsSession );
- User::LeaveIfError( window.Construct(wg, reinterpret_cast<TUint32>(&wg) + 1) );
- CleanupClosePushL( window );
+ iWindow = new(ELeave) RWindow( iWsSession );
+ User::LeaveIfError( iWindow->Construct(iRootWindow, reinterpret_cast<TUint32>(&iRootWindow) + 1) );
TRect temp(0,0,320,240); // dummy parameter
- iVideoUtil = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceNone, iWsSession, *(iScreen), window, temp, temp);
-
- CleanupStack::PopAndDestroy( &window );
- CleanupStack::PopAndDestroy( gc );
- CleanupStack::PopAndDestroy( &wg );
+ iVideoUtil = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceNone, iWsSession, *iScreen, *iWindow, temp, temp);
iTimeOut = CSconTimeOut::NewL( *this );
@@ -153,11 +150,13 @@
{
User::Leave( KErrNotFound );
}
-
+ iAsyncStopCalled = EFalse;
iVideoClip = CTNEVideoClipInfo::NewL( aFileName, *this );
iVideoUtil->OpenFileL( aFileName );
+ LOGGER_WRITE("Start timeout");
+ iTimeOut->Start( KRequestTimeOut );
LOGGER_WRITE("iWait.Start()");
iWait.Start();
@@ -356,6 +355,12 @@
void CSConVideoParser::MvpuoOpenComplete( TInt aError )
{
TRACE_FUNC_ENTRY;
+ if ( iVideoUtilReady )
+ {
+ // already timeout
+ LOGGER_WRITE("Already timeout");
+ return;
+ }
LOGGER_WRITE_1( "aError: %d", aError );
if ( aError == KErrNone )
{
@@ -367,8 +372,10 @@
iVideoUtilErr = aError;
}
- if ( iVideoUtilReady && iVideoClipReady )
+ if ( iVideoUtilReady && iVideoClipReady && !iAsyncStopCalled )
{
+ iAsyncStopCalled = ETrue;
+ iTimeOut->Cancel();
LOGGER_WRITE("AsyncStop");
iWait.AsyncStop();
}
@@ -383,13 +390,21 @@
void CSConVideoParser::MvpuoPrepareComplete( TInt aError )
{
TRACE_FUNC_ENTRY;
+ if ( iVideoUtilReady )
+ {
+ // already timeout
+ LOGGER_WRITE("Already timeout");
+ return;
+ }
LOGGER_WRITE_1( "aError: %d", aError );
iVideoUtilReady = ETrue;
iVideoUtilErr = aError;
- if ( iVideoUtilReady && iVideoClipReady )
+ if ( iVideoUtilReady && iVideoClipReady && !iAsyncStopCalled )
{
+ iAsyncStopCalled = ETrue;
+ iTimeOut->Cancel();
LOGGER_WRITE("AsyncStop");
iWait.AsyncStop();
}
@@ -431,6 +446,12 @@
void CSConVideoParser::NotifyVideoClipInfoReady(CTNEVideoClipInfo& aInfo, TInt aError)
{
TRACE_FUNC_ENTRY;
+ if ( iVideoClipReady )
+ {
+ // already timeout
+ LOGGER_WRITE("Already timeout");
+ return;
+ }
LOGGER_WRITE_1("aError: %d", aError);
if ( aError == KErrNone )
{
@@ -443,11 +464,6 @@
iVideoClipReady = ETrue;
iVideoClipErr = err;
}
- else
- {
- LOGGER_WRITE("Start timeout");
- iTimeOut->Start( KVideoClipTimeout );
- }
}
else
{
@@ -455,8 +471,10 @@
iVideoClipErr = aError;
}
- if ( iVideoUtilReady && iVideoClipReady )
+ if ( iVideoUtilReady && iVideoClipReady && !iAsyncStopCalled )
{
+ iAsyncStopCalled = ETrue;
+ iTimeOut->Cancel();
LOGGER_WRITE("AsyncStop");
iWait.AsyncStop();
}
@@ -473,8 +491,14 @@
CFbsBitmap* aThumb)
{
TRACE_FUNC_ENTRY;
+ if ( iVideoClipReady )
+ {
+ // already timeout
+ LOGGER_WRITE("Already timeout");
+ delete aThumb;
+ return;
+ }
LOGGER_WRITE_1("aError: %d", aError);
- iTimeOut->Cancel();
if ( aError == KErrNone)
{
delete iThumbnail;
@@ -500,8 +524,10 @@
iVideoClipReady = ETrue;
iVideoClipErr = aError;
- if ( iVideoUtilReady && iVideoClipReady )
+ if ( iVideoUtilReady && iVideoClipReady && !iAsyncStopCalled )
{
+ iAsyncStopCalled = ETrue;
+ iTimeOut->Cancel();
LOGGER_WRITE("AsyncStop");
iWait.AsyncStop();
}
@@ -525,9 +551,17 @@
iVideoClipErr = KErrCancel;
}
- if ( iVideoUtilReady && iVideoClipReady )
+ if ( !iVideoUtilReady )
+ {
+ LOGGER_WRITE("videoUtil cancelled");
+ iVideoUtilReady = ETrue;
+ iVideoUtilErr = KErrCancel;
+ }
+
+ if ( iVideoUtilReady && iVideoClipReady && !iAsyncStopCalled )
{
LOGGER_WRITE("AsyncStop");
+ iAsyncStopCalled = ETrue;
iWait.AsyncStop();
}
TRACE_FUNC_EXIT;