[prev in list] [next in list] [prev in thread] [next in thread]
List: helix-server-cvs
Subject: [Server-cvs] engine/session clientsession.cpp,1.12.2.35,1.12.2.36
From: rasher () helixcommunity ! org
Date: 2007-08-31 3:29:26
Message-ID: 200708310329.l7V3TZns006496 () mailer ! progressive-comp ! com
[Download RAW message or body]
Update of /cvsroot/server/engine/session
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv5640
Modified Files:
Tag: SERVER_BORABORA
clientsession.cpp
Log Message:
Synopsis
==========
This CR includes fix for PR 201655 : Memory Leaks when switching content
Quick link to the PR :
https://bugs.dev.prognet.com/show_bug.cgi?id=201655
Branches : HEAD , BORABORA
Suggested Reviewer : Jamie Gordon
Description
============
Memory leaks occuring when switching content
a) Circular reference between ClientSession and CSessionSourceControl.
CSessionSourceControl releases ClientSession in its done but its done is
called only when ClientSession releases it in it dtor.
b) When a switch request comes for a new clip a CSwitchabilityTest object
created and CurrentSwitch holds a pointer to it.This CSwitchabilityTest
object holds a pointer to ClientSession, so need to delete the
CurrentSwitch objects in ClientSession Done which will release
CSwitchabilityTest.
c)there are Memory leaks while switching content while one switch is waiting for \
stream done and is replaced.Also Done gets called multiple times.
Fix
===========
Shifted the release of the above objects to ClientSession's Done method
instead of the destructor.
When a switch occurs and a switch is waiting then added a call to the
SwitchElement's switch source i.e. CSwitchabilityTest's Done()
Removed Done() call at places as getting called multiple times.
Removed assertion failure at StreamDone as CSwitchabilityTest might
have no sink while it is waiting for a switch and it is replaced.
Files Affected
================
server\engine\session\clientsession.cpp
Testing Performed
=================
Since just changed the place of the release no extra tests required apart
from LCT.
Functional-Testing:
Checked clips play and switch using FCS.
Leak-Tests:
LCT test done and leaks due to switching do not exist.
Build verified : win32-i386-vc7
Platforms tested: win32-i386-vc7
QA Hints
===========
Thanks
Raj Asher
Index: clientsession.cpp
===================================================================
RCS file: /cvsroot/server/engine/session/clientsession.cpp,v
retrieving revision 1.12.2.35
retrieving revision 1.12.2.36
diff -u -d -r1.12.2.35 -r1.12.2.36
--- clientsession.cpp 31 Aug 2007 01:33:58 -0000 1.12.2.35
+++ clientsession.cpp 31 Aug 2007 03:29:23 -0000 1.12.2.36
@@ -241,7 +241,7 @@
ClientSession::~ClientSession()
{
DPRINTF(D_INFO, ("Session::~Session: %s\n", (const char*)m_sessionID));
-
+
HX_ASSERT(!m_ulFunctionsInUse);
HX_DELETE(m_url);
@@ -255,13 +255,7 @@
m_pSignalBusCtl = NULL;
}
- if (m_pSourceControl)
- {
- m_pSourceControl->Done();
- m_pSourceControl->Release();
- m_pSourceControl = 0;
- }
-
+
HX_RELEASE(m_pFileFormat);
HX_RELEASE(m_pBlockTransferFileFormat);
HX_RELEASE(m_pFFAdvise);
@@ -333,17 +327,7 @@
HX_DELETE(m_pAggRateAdaptParams);
-#ifdef HELIX_FEATURE_SERVER_FCS
- if(m_pSwitchabilityTest)
- {
- m_pSwitchabilityTest->Done();
- HX_RELEASE(m_pSwitchabilityTest);
- }
- HX_DELETE(m_pCurrentSwitch);
- HX_DELETE(m_pWaitingSwitch);
- HX_DELETE(m_pCompletedSwitch);
- HX_RELEASE(m_pPPMShim);
-#endif //HELIX_FEATURE_SERVER_FCS
+
}
void
@@ -360,6 +344,13 @@
HX_ASSERT(m_pStats);
+ if (m_pSourceControl)
+ {
+ m_pSourceControl->Done();
+ m_pSourceControl->Release();
+ m_pSourceControl = 0;
+ }
+
// write final status
if (m_pStats2)
@@ -427,6 +418,13 @@
#endif
ClipDone();
}
+#ifdef HELIX_FEATURE_SERVER_FCS
+ HX_RELEASE(m_pSwitchabilityTest);
+ HX_DELETE(m_pCurrentSwitch);
+ HX_DELETE(m_pWaitingSwitch);
+ HX_DELETE(m_pCompletedSwitch);
+ HX_RELEASE(m_pPPMShim);
+#endif //HELIX_FEATURE_SERVER_FCS
m_pProc->pc->client_stats_manager->SessionDone(m_pClient->GetClientStats(),
m_pStats, m_pProc);
@@ -5080,6 +5078,7 @@
// not been called.So no need to wait.Terminate the current switch and let \
the new one start. if(m_pSourceControl->GetWatchForStreamDone())
{
+ m_pCurrentSwitch->m_pSwitchSource->Done();
HX_DELETE(m_pCurrentSwitch);
m_pSourceControl->SetWatchForStreamDone(FALSE);
}
@@ -5679,7 +5678,7 @@
CSessionSourceControl::~CSessionSourceControl()
{
- Done();
+
}
void CSessionSourceControl::Done()
@@ -5706,7 +5705,7 @@
}
if(m_pRealSourceControl)
- {
+ {
m_pRealSourceControl->Done();
HX_RELEASE(m_pRealSourceControl);
}
@@ -6120,7 +6119,7 @@
CSwitchabilityTest::~CSwitchabilityTest()
{
- Done();
+
}
HX_RESULT CSwitchabilityTest::TestSource(IUnknown* pSource)
@@ -6228,7 +6227,6 @@
STDMETHODIMP
CSwitchabilityTest::StreamDone(UINT16 unStreamNumber)
{
- HX_ASSERT(m_pSinkControl);
if(m_pSinkControl)
{
return m_pSinkControl->StreamDone(unStreamNumber);
@@ -6377,8 +6375,8 @@
HX_RESULT
CSwitchabilityTest::GetFileDuration(ULONG32 &ulFileDuration)
{
- /* Get the duration of the file, required for stats purposes */
- if (SUCCEEDED(m_pFileHeader->GetPropertyULONG32("Duration", ulFileDuration)))
+ /* Get the duration of the file, required for stats purposes */
+ if (SUCCEEDED(m_pFileHeader->GetPropertyULONG32("Duration", ulFileDuration)))
{
return HXR_OK;
}
_______________________________________________
Server-cvs mailing list
Server-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/server-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic