[prev in list] [next in list] [prev in thread] [next in thread]
List: helix-datatype-cvs
Subject: [Datatype-cvs] mkv/libmatroska Matroska.cpp, 1.1.2.22, 1.1.2.23 Matroska.h, 1.1.2.10, 1.1.2.11 Matro
From: xzhao () helixcommunity ! org
Date: 2012-01-20 2:18:42
[Download RAW message or body]
Update of /cvsroot/datatype/mkv/libmatroska
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv8962/libmatroska
Modified Files:
Tag: hxclient_3_6_1_atlas
Matroska.cpp Matroska.h MatroskaExports.cpp MatroskaExports.h
mkvtypes.h
Log Message:
Bug 14365: Fix MKV memory leak
> * make a new interface to let FF know core's subscription;
> * disable the queue of unactive track, so that the memory footprint is under \
> control
> * flush old track queue and re-fill new track queue when switch happens;
> * Some minor memory leak as I said in previous mail.
Index: MatroskaExports.h
===================================================================
RCS file: /cvsroot/datatype/mkv/libmatroska/MatroskaExports.h,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -d -r1.1.2.4 -r1.1.2.5
--- MatroskaExports.h 13 Dec 2011 07:22:14 -0000 1.1.2.4
+++ MatroskaExports.h 20 Jan 2012 02:18:39 -0000 1.1.2.5
@@ -40,6 +40,8 @@
HX_RESULT GetPacket(UINT32& strNum, IHXBuffer*& pBuffer, UINT64& uTimeCode, HXBOOL& \
bKey, UINT64& uDuration);
HX_RESULT Seek( double seekTime , UINT32& strNum, IHXBuffer*& pBuffer, UINT64& \
uTimeCode, HXBOOL& bKey); + HX_RESULT FlushQ();
+ HX_RESULT EnableTrack(UINT16 unStrmNum, HXBOOL enable);
HX_RESULT VerifyHeader();
HX_RESULT AnalyzeSegment();
Index: mkvtypes.h
===================================================================
RCS file: /cvsroot/datatype/mkv/libmatroska/mkvtypes.h,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -d -r1.1.2.5 -r1.1.2.6
--- mkvtypes.h 7 Nov 2011 06:48:00 -0000 1.1.2.5
+++ mkvtypes.h 20 Jan 2012 02:18:39 -0000 1.1.2.6
@@ -11,8 +11,6 @@
#include "ihxpckts.h"
#include <vector>
-#define PACKET_PRESEND_THRESHOLD 1500
-
/* ContentCompression Algorithm types */
typedef enum _ALG_COMPRESSION_TYPE
{
@@ -75,6 +73,7 @@
struct MKVTrack
{
HXBOOL bDefault;
+ // By default, all track are enabled
HXBOOL bEnabled;
HXBOOL bSilent;
UINT32 uNumber;
@@ -135,8 +134,11 @@
void PushPacket(IHXPacket* pp)
{
- pp->AddRef();
- vQueue.push_back( pp );
+ if (bEnabled)
+ {
+ pp->AddRef();
+ vQueue.push_back( pp );
+ }
}
IHXPacket* GetPacket()
@@ -151,29 +153,6 @@
return NULL;
}
- IHXPacket* GetPacketFromTS(ULONG32* ts = NULL)
- {
- // If ts is NULL, then should behave the same with GetPacket
- // Will strip off any packets before (*ts - 1500)
- IHXPacket* retPacket = NULL;
-
- while (vQueue.size() > 0)
- {
- retPacket = vQueue[0];
- vQueue.erase(vQueue.begin());
- if (ts == NULL ||
- (ts != NULL && retPacket->GetTime() >= ((*ts > \
PACKET_PRESEND_THRESHOLD) ? (*ts - PACKET_PRESEND_THRESHOLD) : 0)))
- {
- return retPacket;
- }
- else
- {
- HX_RELEASE(retPacket);
- }
- }
- return NULL;
- }
-
IHXPacket* PeepPacket()
{
if(vQueue.size() > 0)
@@ -194,6 +173,11 @@
vQueue.clear();
}
+ HX_RESULT SetEnable(HXBOOL enable)
+ {
+ bEnabled = enable;
+ }
+
std::vector<IHXPacket* > vQueue;
};
Index: Matroska.h
===================================================================
RCS file: /cvsroot/datatype/mkv/libmatroska/Matroska.h,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -u -d -r1.1.2.10 -r1.1.2.11
--- Matroska.h 13 Dec 2011 07:22:13 -0000 1.1.2.10
+++ Matroska.h 20 Jan 2012 02:18:38 -0000 1.1.2.11
@@ -99,6 +99,7 @@
HX_RESULT ParseStreams( KaxTracks *tracks);
HX_RESULT ParseCues( KaxCues *pCues, EbmlElement* & pElementLevel2, int& level );
HX_RESULT ParseTags( KaxTags *tags);
+ HX_RESULT EnableTrack( UINT16 unStrmNum, HXBOOL enable );
};
class MatrokaSegmentGlobalInit
{
Index: Matroska.cpp
===================================================================
RCS file: /cvsroot/datatype/mkv/libmatroska/Matroska.cpp,v
retrieving revision 1.1.2.22
retrieving revision 1.1.2.23
diff -u -d -r1.1.2.22 -r1.1.2.23
--- Matroska.cpp 13 Dec 2011 07:22:13 -0000 1.1.2.22
+++ Matroska.cpp 20 Jan 2012 02:18:38 -0000 1.1.2.23
@@ -2325,6 +2325,22 @@
return HXR_OK;
}
+HX_RESULT MatroskaSegment::EnableTrack( UINT16 unStrmNum, HXBOOL enable )
+{
+ HX_RESULT ret = HXR_FAIL;
+ if (unStrmNum < m_Tracks.size())
+ {
+ ret = m_Tracks[unStrmNum]->SetEnable(enable);
+ // Previously selected track is not used anymore
+ // Flush that queue to save memory
+ if (!enable)
+ {
+ m_Tracks[unStrmNum]->FlushQ();
+ }
+ }
+ return ret;
+}
+
MatrokaSegmentGlobalInit::MatrokaSegmentGlobalInit()
{
//Allocating memory for Global pointers in DLL LoadTime , assumed following \
global pointers shall only contain read only data
Index: MatroskaExports.cpp
===================================================================
RCS file: /cvsroot/datatype/mkv/libmatroska/MatroskaExports.cpp,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -d -r1.1.2.6 -r1.1.2.7
--- MatroskaExports.cpp 13 Dec 2011 07:22:13 -0000 1.1.2.6
+++ MatroskaExports.cpp 20 Jan 2012 02:18:39 -0000 1.1.2.7
@@ -231,4 +231,24 @@
return NULL;
}
+
+HX_RESULT MatroskaExports::FlushQ()
+{
+ if (m_pSeg)
+ {
+ m_pSeg->FlushQ();
+ return HXR_OK;
+ }
+ return HXR_FAIL;
+}
+
+HX_RESULT MatroskaExports::EnableTrack(UINT16 unStrmNum, HXBOOL enable)
+{
+ HX_RESULT ret = HXR_OK;
+ if (m_pSeg)
+ {
+ ret = m_pSeg->EnableTrack(unStrmNum, enable);
+ }
+ return ret;
+}
_______________________________________________
Datatype-cvs mailing list
Datatype-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/datatype-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic