The file in the first post should be compatible.is there a version of the file for the 1.4.0?
I want to test if it fixes the epg idle lock tunner.
thanks.
@DJBlu
Looks like you've made some excellent progress with this issue.
Having said that, personally I don't understand how your changes are solving the problem.
Are you able to explain a little?
My perspective is this...
The deadlock at GetNewSubChannel() (which is calling CMpTs::AddChannel()) is obviously blocking on the m_Lock declared in CMpTs.
We can see who/what is holding the lock by reading/comparing logs very carefully. I've attached such a sample with the epg.log, tv.log and TsWriter.log stitched together. Compare the output of the last successful EPG grab (for "ANTENA 3"):
2013-05-14 16:28:01.322053 [EPG Update thread(21)]: EpgGrabbing: Stop - user epg
2013-05-14 16:28:01.357058 [EPG Update thread(21)]: user:epg remove
2013-05-14 16:28:01.422066 [EPG Update thread(21)]: tvcard:FreeSubChannel: subchannels count 1 subch#0
2013-05-14 16:28:01.486074 [EPG Update thread(21)]: DVB subch:0 Decompose()
14-05-2013 16:28:01.518 del m_pVideoAnalyzer
14-05-2013 16:28:01.522 analyzer: reset
14-05-2013 16:28:01.526 del m_pPmtGrabber
14-05-2013 16:28:01.529 del m_pRecorder
14-05-2013 16:28:01.533 del m_pTimeShifting
14-05-2013 16:28:01.536 del m_pTeletextGrabber
14-05-2013 16:28:01.540 del m_pCaGrabber
14-05-2013 16:28:01.543 del done...
2013-05-14 16:28:01.550087 [EPG Update thread(21)]: FreeSubChannel CA: freeing sub channel : 0
2013-05-14 16:28:01.614090 [EPG Update thread(21)]: tvcard:FreeSubChannel : no subchannels present, pausing graph
2013-05-14 16:28:01.677098 [EPG Update thread(21)]: dvbtopGraph called
2013-05-14 16:28:01.743107 [EPG Update thread(21)]: tvcard:FreeAllSubChannels
2013-05-14 16:28:01.807115 [EPG Update thread(21)]: dvbtopGraph
14-05-2013 16:28:01.838 CMpTsFilter:ause()
14-05-2013 16:28:01.842 CMpTsFilter:top()
2013-05-14 16:28:02.085151 [EPG Update thread(21)]: Pausecard
2013-05-14 16:28:02.150159 [EPG Update thread(21)]: dvbtopGraph called
2013-05-14 16:28:02.215167 [EPG Update thread(21)]: tvcard:FreeAllSubChannels
2013-05-14 16:28:02.279175 [EPG Update thread(21)]: dvbtopGraph filterstate already stopped, returning.
2013-05-14 16:28:15.729892 [DVB EPG timer(13)]: Grab for card:#10 transponder #7/12 channel: Canal Catala Barcelona
2013-05-14 16:28:15.741886 [DVB EPG timer(13)]: EpgCard: grab epg on card: #10 transponder: #6 ch:Canal Catala Barcelona
...with the failure:
2013-05-14 16:29:20.132070 [(18)]: EpgGrabbing: Stop - user epg
2013-05-14 16:29:20.136070 [(18)]: user:epg remove
2013-05-14 16:29:20.169074 [(18)]: tvcard:FreeSubChannel: subchannels count 1 subch#0
2013-05-14 16:29:20.200078 [(18)]: DVB subch:0 Decompose()
14-05-2013 16:29:20.232 del m_pVideoAnalyzer
14-05-2013 16:29:20.236 analyzer: reset
14-05-2013 16:29:20.239 del m_pPmtGrabber
14-05-2013 16:29:20.243 del m_pRecorder
14-05-2013 16:29:20.246 del m_pTimeShifting
14-05-2013 16:29:20.250 del m_pTeletextGrabber
14-05-2013 16:29:20.253 del m_pCaGrabber
14-05-2013 16:29:20.257 del done...
2013-05-14 16:29:20.261086 [(18)]: FreeSubChannel CA: freeing sub channel : 0
2013-05-14 16:29:20.294090 [(18)]: tvcard:FreeSubChannel : no subchannels present, pausing graph
2013-05-14 16:29:20.325094 [(18)]: dvbtopGraph called
2013-05-14 16:29:20.358099 [(18)]: tvcard:FreeAllSubChannels
2013-05-14 16:29:20.389102 [(18)]: dvbtopGraph
14-05-2013 16:29:20.421 CMpTsFilter:ause()
14-05-2013 16:29:20.425 CMpTsFilter:top()
2013-05-14 16:29:45.773335 [DVB EPG timer(4)]: Grab for card:#10 transponder #8/12 channel: Nitro
2013-05-14 16:29:45.786331 [DVB EPG timer(4)]: EpgCard: grab epg on card: #10 transponder: #7 ch:Nitro
Note that thread 18 in the second section is locking in CMpTsFilter:top(). There is no "Pausegraph" entry.
This is telling me that for some reason the filter is refusing to stop.
Here's the corresponding function:
Code:STDMETHODIMP CMpTsFilter::Stop() { CAutoLock cObjectLock(m_pLock); LogDebug("CMpTsFilter::Stop()"); return CBaseFilter::Stop(); }
Quite simple really.
We can tell that m_pLock is the same lock as is used for CMpTs::AddChannel() by examining the constructor of CMpTs, the constructor of CMpTsFilter and the declaration of CBaseFilter in amfilter.h:
m_pFilter = new CMpTsFilter(this, GetOwner(), &m_Lock, phr);CMpTsFilter::CMpTsFilter(CMpTs *pDump,LPUNKNOWN pUnk,CCritSec *pLock,HRESULT *phr) :
CBaseFilter(NAME("TsWriter"), pUnk, pLock, CLSID_MpTsFilter),
m_pWriterFilter(pDump)
{
}CCritSec *m_pLock; // Object we use for locking
CBaseFilter(
__in_opt LPCTSTR pName, // Object description
__inout_opt LPUNKNOWN pUnk, // IUnknown of delegating object
__in CCritSec *pLock, // Object who maintains lock
REFCLSID clsid); // The clsid to be used to serialize this filter
What I don't understand is why CBaseFilter:top() is blocking.
Note that the example above is about as single-threaded as TV Server can get. Sequential tunes, over and over again... then we get this.
mm
I'm not sure, but I think our code here is pretty standard.One question is - do we actually need the locking in Pause(), Stop() etc - is it doing anything useful inside TsWriter ? (or do we need to hold the lock for the whole time in Pause(), Stop() etc ?)