diff options
author | kasper93 <kasper93@gmail.com> | 2013-12-22 04:32:33 +0400 |
---|---|---|
committer | kasper93 <kasper93@gmail.com> | 2014-06-08 16:15:04 +0400 |
commit | 2f6cba6cc9b4cd171b54cebe4a22c176afdec3cd (patch) | |
tree | 5b711025deee2604e7e9154e396ac4d764c2eff1 /src/filters | |
parent | bc630c180907d094601058a35dcce2318bd53ce2 (diff) |
MainFrm: Cosmetics for stats.
- Always show bitrate statistic in avg/cur style for consistency.
Diffstat (limited to 'src/filters')
-rw-r--r-- | src/filters/parser/BaseSplitter/BaseSplitter.cpp | 42 | ||||
-rw-r--r-- | src/filters/parser/BaseSplitter/BaseSplitter.h | 25 |
2 files changed, 31 insertions, 36 deletions
diff --git a/src/filters/parser/BaseSplitter/BaseSplitter.cpp b/src/filters/parser/BaseSplitter/BaseSplitter.cpp index 358a99a42..9a09a375c 100644 --- a/src/filters/parser/BaseSplitter/BaseSplitter.cpp +++ b/src/filters/parser/BaseSplitter/BaseSplitter.cpp @@ -1,6 +1,6 @@ /*
* (C) 2003-2006 Gabest
- * (C) 2006-2013 see Authors.txt
+ * (C) 2006-2014 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -202,8 +202,6 @@ CBaseSplitterOutputPin::CBaseSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWS {
m_mts.Copy(mts);
m_nBuffers = std::max(nBuffers, 1);
- ZeroMemory(&m_brs, sizeof(m_brs));
- m_brs.rtLastDeliverTime = Packet::INVALID_TIME;
}
CBaseSplitterOutputPin::CBaseSplitterOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr, int nBuffers, int QueueMaxPackets)
@@ -216,8 +214,6 @@ CBaseSplitterOutputPin::CBaseSplitterOutputPin(LPCWSTR pName, CBaseFilter* pFilt , m_rtStart(0)
{
m_nBuffers = std::max(nBuffers, 1);
- ZeroMemory(&m_brs, sizeof(m_brs));
- m_brs.rtLastDeliverTime = Packet::INVALID_TIME;
}
CBaseSplitterOutputPin::~CBaseSplitterOutputPin()
@@ -364,7 +360,7 @@ HRESULT CBaseSplitterOutputPin::DeliverEndFlush() HRESULT CBaseSplitterOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
- m_brs.rtLastDeliverTime = Packet::INVALID_TIME;
+ m_BitRate.rtLastDeliverTime = Packet::INVALID_TIME;
if (m_fFlushing) {
return S_FALSE;
}
@@ -521,32 +517,32 @@ HRESULT CBaseSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p) return S_OK;
}
- m_brs.nBytesSinceLastDeliverTime += nBytes;
+ m_BitRate.nBytesSinceLastDeliverTime += nBytes;
if (p->rtStart != Packet::INVALID_TIME) {
- if (m_brs.rtLastDeliverTime == Packet::INVALID_TIME) {
- m_brs.rtLastDeliverTime = p->rtStart;
- m_brs.nBytesSinceLastDeliverTime = 0;
+ if (m_BitRate.rtLastDeliverTime == Packet::INVALID_TIME) {
+ m_BitRate.rtLastDeliverTime = p->rtStart;
+ m_BitRate.nBytesSinceLastDeliverTime = 0;
}
- if (m_brs.rtLastDeliverTime + 10000000 < p->rtStart) {
- REFERENCE_TIME rtDiff = p->rtStart - m_brs.rtLastDeliverTime;
+ if (m_BitRate.rtLastDeliverTime + 10000000 < p->rtStart) {
+ REFERENCE_TIME rtDiff = p->rtStart - m_BitRate.rtLastDeliverTime;
- double secs, bits;
+ double dSecs, dBits;
- secs = (double)rtDiff / 10000000;
- bits = 8.0 * m_brs.nBytesSinceLastDeliverTime;
- m_brs.nCurrentBitRate = (DWORD)(bits / secs);
+ dSecs = rtDiff / 10000000.0;
+ dBits = 8.0 * m_BitRate.nBytesSinceLastDeliverTime;
+ m_BitRate.nCurrentBitRate = (DWORD)(dBits / dSecs);
- m_brs.rtTotalTimeDelivered += rtDiff;
- m_brs.nTotalBytesDelivered += m_brs.nBytesSinceLastDeliverTime;
+ m_BitRate.rtTotalTimeDelivered += rtDiff;
+ m_BitRate.nTotalBytesDelivered += m_BitRate.nBytesSinceLastDeliverTime;
- secs = (double)m_brs.rtTotalTimeDelivered / 10000000;
- bits = 8.0 * m_brs.nTotalBytesDelivered;
- m_brs.nAverageBitRate = (DWORD)(bits / secs);
+ dSecs = m_BitRate.rtTotalTimeDelivered / 10000000.0;
+ dBits = 8.0 * m_BitRate.nTotalBytesDelivered;
+ m_BitRate.nAverageBitRate = (DWORD)(dBits / dSecs);
- m_brs.rtLastDeliverTime = p->rtStart;
- m_brs.nBytesSinceLastDeliverTime = 0;
+ m_BitRate.rtLastDeliverTime = p->rtStart;
+ m_BitRate.nBytesSinceLastDeliverTime = 0;
/*
TRACE(_T("[%d] c: %d kbps, a: %d kbps\n"),
p->TrackNumber,
diff --git a/src/filters/parser/BaseSplitter/BaseSplitter.h b/src/filters/parser/BaseSplitter/BaseSplitter.h index 5f01343e1..55eaba8da 100644 --- a/src/filters/parser/BaseSplitter/BaseSplitter.h +++ b/src/filters/parser/BaseSplitter/BaseSplitter.h @@ -1,6 +1,6 @@ /*
* (C) 2003-2006 Gabest
- * (C) 2006-2013 see Authors.txt
+ * (C) 2006-2014 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -134,16 +134,15 @@ private: HRESULT GetDeliveryBuffer(IMediaSample** ppSample, REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime, DWORD dwFlags);
HRESULT Deliver(IMediaSample* pSample);
- // bitrate stats
-
- struct {
- UINT64 nTotalBytesDelivered;
- REFERENCE_TIME rtTotalTimeDelivered;
- UINT64 nBytesSinceLastDeliverTime;
- REFERENCE_TIME rtLastDeliverTime;
- DWORD nCurrentBitRate;
- DWORD nAverageBitRate;
- } m_brs;
+ // IBitRateInfo
+ struct BitRateInfo {
+ UINT64 nTotalBytesDelivered = 0;
+ REFERENCE_TIME rtTotalTimeDelivered = 0;
+ UINT64 nBytesSinceLastDeliverTime = 0;
+ REFERENCE_TIME rtLastDeliverTime = Packet::INVALID_TIME;
+ DWORD nCurrentBitRate = 0;
+ DWORD nAverageBitRate = 0;
+ } m_BitRate;
int m_QueueMaxPackets;
@@ -231,8 +230,8 @@ public: // IBitRateInfo
- STDMETHODIMP_(DWORD) GetCurrentBitRate() { return m_brs.nCurrentBitRate; }
- STDMETHODIMP_(DWORD) GetAverageBitRate() { return m_brs.nAverageBitRate; }
+ STDMETHODIMP_(DWORD) GetCurrentBitRate() { return m_BitRate.nCurrentBitRate; }
+ STDMETHODIMP_(DWORD) GetAverageBitRate() { return m_BitRate.nAverageBitRate; }
};
class CBaseSplitterFilter
|