diff options
-rw-r--r-- | src/filters/parser/AviSplitter/AviSplitter.cpp | 6 | ||||
-rw-r--r-- | src/filters/parser/BaseSplitter/BaseSplitter.cpp | 17 | ||||
-rw-r--r-- | src/filters/parser/BaseSplitter/BaseSplitter.h | 13 |
3 files changed, 22 insertions, 14 deletions
diff --git a/src/filters/parser/AviSplitter/AviSplitter.cpp b/src/filters/parser/AviSplitter/AviSplitter.cpp index 7e1e4114b..218393236 100644 --- a/src/filters/parser/AviSplitter/AviSplitter.cpp +++ b/src/filters/parser/AviSplitter/AviSplitter.cpp @@ -25,6 +25,8 @@ #include "AviReportWnd.h"
#include "AviSplitter.h"
+#define MAXPACKETS_AVI MAXPACKETS*5
+
#ifdef REGISTER_FILTER
const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] = {
@@ -111,7 +113,7 @@ CAviSplitterApp theApp; //
CAviSplitterFilter::CAviSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
- : CBaseSplitterFilter(NAME("CAviSplitterFilter"), pUnk, phr, __uuidof(this))
+ : CBaseSplitterFilter(NAME("CAviSplitterFilter"), pUnk, phr, __uuidof(this), MAXPACKETS_AVI)
, m_timeformat(TIME_FORMAT_MEDIA_TIME)
{
}
@@ -900,7 +902,7 @@ CAviSourceFilter::CAviSourceFilter(LPUNKNOWN pUnk, HRESULT* phr) //
CAviSplitterOutputPin::CAviSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
- : CBaseSplitterOutputPin(mts, pName, pFilter, pLock, phr)
+ : CBaseSplitterOutputPin(mts, pName, pFilter, pLock, phr, 0, MAXPACKETS_AVI)
{
}
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;
|