STDMETHODIMP CBaseSplitterFilter::GetStatus(int i, int& samples, int& size) { CAutoLock cAutoLock(m_pLock); if (POSITION pos = m_pOutputs.FindIndex(i)) { CBaseSplitterOutputPin* pPin = m_pOutputs.GetAt(pos); samples = pPin->QueueCount(); size = pPin->QueueSize(); return pPin->IsConnected() ? S_OK : S_FALSE; } return E_INVALIDARG; }
bool CBaseSplitterFilter::IsAnyPinDrying() { int totalcount = 0, totalsize = 0; POSITION pos = m_pActivePins.GetHeadPosition(); while (pos) { CBaseSplitterOutputPin* pPin = m_pActivePins.GetNext(pos); int count = pPin->QueueCount(); int size = pPin->QueueSize(); if (!pPin->IsDiscontinuous() && (count < MINPACKETS || size < MINPACKETSIZE)) { // if (m_priority != THREAD_PRIORITY_ABOVE_NORMAL && (count < MINPACKETS/3 || size < MINPACKETSIZE/3)) if (m_priority != THREAD_PRIORITY_BELOW_NORMAL && (count < MINPACKETS / 3 || size < MINPACKETSIZE / 3)) { // SetThreadPriority(m_hThread, m_priority = THREAD_PRIORITY_ABOVE_NORMAL); POSITION pos = m_pOutputs.GetHeadPosition(); while (pos) { m_pOutputs.GetNext(pos)->SetThreadPriority(THREAD_PRIORITY_BELOW_NORMAL); } m_priority = THREAD_PRIORITY_BELOW_NORMAL; } return true; } totalcount += count; totalsize += size; } 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) { m_pOutputs.GetNext(pos)->SetThreadPriority(THREAD_PRIORITY_NORMAL); } m_priority = THREAD_PRIORITY_NORMAL; } if (totalcount < m_QueueMaxPackets && totalsize < MAXPACKETSIZE) { return true; } return false; }
bool CBaseSplitterFilter::IsAnyPinDrying(DWORD MaxQueuePackets) { size_t totalcount = 0, totalsize = 0; POSITION pos = m_pActivePins.GetHeadPosition(); while (pos) { CBaseSplitterOutputPin* pPin = m_pActivePins.GetNext(pos); size_t count = pPin->QueueCount(); size_t size = pPin->QueueSize(); if (!pPin->IsDiscontinuous() && (count < m_MinQueuePackets || size < GetMinQueueSize())) { if (m_priority != THREAD_PRIORITY_BELOW_NORMAL && (count < m_MinQueuePackets/3 || size < GetMinQueueSize()/3)) { POSITION pos = m_pOutputs.GetHeadPosition(); while (pos) { m_pOutputs.GetNext(pos)->SetThreadPriority(THREAD_PRIORITY_BELOW_NORMAL); } m_priority = THREAD_PRIORITY_BELOW_NORMAL; } return true; } totalcount += count; totalsize += size; } if (m_priority != THREAD_PRIORITY_NORMAL && (totalcount > MaxQueuePackets*2/3 || totalsize > GetMaxQueueSize()*2/3)) { POSITION pos = m_pOutputs.GetHeadPosition(); while (pos) { m_pOutputs.GetNext(pos)->SetThreadPriority(THREAD_PRIORITY_NORMAL); } m_priority = THREAD_PRIORITY_NORMAL; } if (totalcount < m_MaxQueuePackets && totalsize < GetMaxQueueSize()) { return true; } return false; }