From 581eaab4c83d7c5fa7b563f450d9b292b09da487 Mon Sep 17 00:00:00 2001 From: Aleksoid Date: Mon, 2 Apr 2012 11:59:24 +0000 Subject: 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 --- src/filters/parser/BaseSplitter/BaseSplitter.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/filters/parser/BaseSplitter/BaseSplitter.cpp') 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& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr, int nBuffers) +CBaseSplitterOutputPin::CBaseSplitterOutputPin(CAtlArray& 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 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(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(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) { -- cgit v1.2.3