diff options
author | Aleksoid <aleksoid@users.sourceforge.net> | 2012-04-02 15:59:24 +0400 |
---|---|---|
committer | Aleksoid <aleksoid@users.sourceforge.net> | 2012-04-02 15:59:24 +0400 |
commit | 581eaab4c83d7c5fa7b563f450d9b292b09da487 (patch) | |
tree | 02e86fbc4174d21b899e0d73844c36bea31ceb24 /src/filters/parser/BaseSplitter | |
parent | 5824f20c7a24100d9779cef554e8f7526da027fc (diff) |
Change : reduced the maximum number of packets in the Queue, except for AVI(For Avi need more packets for smooth seeking). This will reduce the amount of memory consumed by the player;
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@4241 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/parser/BaseSplitter')
-rw-r--r-- | src/filters/parser/BaseSplitter/BaseSplitter.cpp | 17 | ||||
-rw-r--r-- | src/filters/parser/BaseSplitter/BaseSplitter.h | 13 |
2 files changed, 18 insertions, 12 deletions
diff --git a/src/filters/parser/BaseSplitter/BaseSplitter.cpp b/src/filters/parser/BaseSplitter/BaseSplitter.cpp index 9f0583f84..ab766908d 100644 --- a/src/filters/parser/BaseSplitter/BaseSplitter.cpp +++ b/src/filters/parser/BaseSplitter/BaseSplitter.cpp @@ -27,11 +27,6 @@ #include "BaseSplitter.h"
-#define MINPACKETS 100 // Beliyaal: Changed the min number of packets to allow Bluray playback over network
-#define MINPACKETSIZE 256*1024 // Beliyaal: Changed the min packet size to allow Bluray playback over network
-#define MAXPACKETS 10000
-#define MAXPACKETSIZE 1024*1024*256
-
//
// CPacketQueue
//
@@ -195,11 +190,12 @@ STDMETHODIMP CBaseSplitterInputPin::EndFlush() // CBaseSplitterOutputPin
//
-CBaseSplitterOutputPin::CBaseSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr, int nBuffers)
+CBaseSplitterOutputPin::CBaseSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr, int nBuffers, int QueueMaxPackets)
: CBaseOutputPin(NAME("CBaseSplitterOutputPin"), pFilter, pLock, phr, pName)
, m_hrDeliver(S_OK) // just in case it were asked before the worker thread could be created and reset it
, m_fFlushing(false)
, m_eEndFlush(TRUE)
+ , m_QueueMaxPackets(QueueMaxPackets)
{
m_mts.Copy(mts);
m_nBuffers = max(nBuffers, 1);
@@ -400,8 +396,8 @@ HRESULT CBaseSplitterOutputPin::QueuePacket(CAutoPtr<Packet> p) }
while (S_OK == m_hrDeliver
- && ((m_queue.GetCount() > 2*MAXPACKETS || m_queue.GetSize() > (MAXPACKETSIZE*3/2))
- || ((m_queue.GetCount() > MAXPACKETS || m_queue.GetSize() > MAXPACKETSIZE) && !(static_cast<CBaseSplitterFilter*>(m_pFilter))->IsAnyPinDrying()))) {
+ && ((m_queue.GetCount() > 2*m_QueueMaxPackets || m_queue.GetSize() > (MAXPACKETSIZE*3/2))
+ || ((m_queue.GetCount() > m_QueueMaxPackets || m_queue.GetSize() > MAXPACKETSIZE) && !(static_cast<CBaseSplitterFilter*>(m_pFilter))->IsAnyPinDrying()))) {
Sleep(10);
}
@@ -773,7 +769,7 @@ STDMETHODIMP CBaseSplitterOutputPin::GetPreroll(LONGLONG* pllPreroll) // CBaseSplitterFilter
//
-CBaseSplitterFilter::CBaseSplitterFilter(LPCTSTR pName, LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid)
+CBaseSplitterFilter::CBaseSplitterFilter(LPCTSTR pName, LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid, int QueueMaxPackets)
: CBaseFilter(pName, pUnk, this, clsid)
, m_rtDuration(0), m_rtStart(0), m_rtStop(0), m_rtCurrent(0)
, m_dRate(1.0)
@@ -782,6 +778,7 @@ CBaseSplitterFilter::CBaseSplitterFilter(LPCTSTR pName, LPUNKNOWN pUnk, HRESULT* , m_rtLastStart(_I64_MIN)
, m_rtLastStop(_I64_MIN)
, m_priority(THREAD_PRIORITY_NORMAL)
+ , m_QueueMaxPackets(QueueMaxPackets)
{
if (phr) {
*phr = S_OK;
@@ -1103,7 +1100,7 @@ bool CBaseSplitterFilter::IsAnyPinDrying() totalsize += size;
}
- if (m_priority != THREAD_PRIORITY_NORMAL && (totalcount > MAXPACKETS*2/3 || totalsize > MAXPACKETSIZE*2/3)) {
+ if (m_priority != THREAD_PRIORITY_NORMAL && (totalcount > m_QueueMaxPackets*2/3 || totalsize > MAXPACKETSIZE*2/3)) {
// SetThreadPriority(m_hThread, m_priority = THREAD_PRIORITY_NORMAL);
POSITION pos = m_pOutputs.GetHeadPosition();
while (pos) {
diff --git a/src/filters/parser/BaseSplitter/BaseSplitter.h b/src/filters/parser/BaseSplitter/BaseSplitter.h index b35e16f91..2368c122d 100644 --- a/src/filters/parser/BaseSplitter/BaseSplitter.h +++ b/src/filters/parser/BaseSplitter/BaseSplitter.h @@ -32,6 +32,11 @@ #include "../../../DSUtil/DSMPropertyBag.h"
#include "../../../DSUtil/FontInstaller.h"
+#define MINPACKETS 100 // Beliyaal: Changed the min number of packets to allow Bluray playback over network
+#define MINPACKETSIZE 256*1024 // Beliyaal: Changed the min packet size to allow Bluray playback over network
+#define MAXPACKETS 2000
+#define MAXPACKETSIZE 1024*1024*256
+
enum {
/* various PCM "codecs" */
FF_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
@@ -201,6 +206,8 @@ private: DWORD nAverageBitRate;
} m_brs;
+ int m_QueueMaxPackets;
+
protected:
REFERENCE_TIME m_rtStart;
@@ -229,7 +236,7 @@ protected: STDMETHODIMP GetPreroll(LONGLONG* pllPreroll);
public:
- CBaseSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr, int nBuffers = 0);
+ CBaseSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr, int nBuffers = 0, int QueueMaxPackets = MAXPACKETS);
CBaseSplitterOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr, int nBuffers = 0);
virtual ~CBaseSplitterOutputPin();
@@ -347,6 +354,8 @@ protected: CFontInstaller m_fontinst;
+ int m_QueueMaxPackets;
+
protected:
enum {CMD_EXIT, CMD_SEEK};
DWORD ThreadProc();
@@ -361,7 +370,7 @@ protected: virtual bool BuildChapters(LPCTSTR pszFileName, CAtlList<CHdmvClipInfo::PlaylistItem>& PlaylistItems, CAtlList<CHdmvClipInfo::PlaylistChapter>& Items) { return false; };
public:
- CBaseSplitterFilter(LPCTSTR pName, LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid);
+ CBaseSplitterFilter(LPCTSTR pName, LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid, int QueueMaxPackets = MAXPACKETS);
virtual ~CBaseSplitterFilter();
DECLARE_IUNKNOWN;
|