[mythtv-commits] Ticket #12196: Invalid bitrate from AVFormat can stall reads from the RingBuffer
MythTV
noreply at mythtv.org
Thu Jul 3 05:59:45 UTC 2014
#12196: Invalid bitrate from AVFormat can stall reads from the RingBuffer
--------------------------------------+-------------------------
Reporter: david.madsen@… | Owner:
Type: Bug Report - General | Status: new
Priority: minor | Milestone: unknown
Component: MythTV - General | Version: Unspecified
Severity: medium | Keywords:
Ticket locked: 0 |
--------------------------------------+-------------------------
I've had trouble recently with some recordings that can't be played back
in the frontend or commflagged.
The bitrate returned from AVFormat is incorrect because of a glitch near
the end of the recording which reset the PTS near the end. This cause
AVFormat to have an entirely invalid bitrate, which was then propagated to
the RingBuffer via the following code:
AVFormatDecoder::ScanStreams() in libmythtv/avformatdecoder.cpp
{{{
if (ic && ((uint)ic->bit_rate > bitrate))
bitrate = (uint)ic->bit_rate;
if (bitrate > 0)
{
bitrate = (bitrate + 999) / 1000;
if (ringBuffer)
ringBuffer->UpdateRawBitrate(bitrate);
}
}}}
This ended up setting the fill_min in the RingBuffer larger than the full
size of the buffer, and consequently blocking reads from the RingBuffer
since this condition never becomes true:
{{{
if ((0 == read_return) || (numfailures > 5) ||
(readsallowed != (used >= fill_min || ateof ||
setswitchtonext || commserror)))
{
}}}
I've attached a patch where I just capped the bitrate returned from
AVFormat to exclude the erroneous values, though I'm not sure that's the
best way to fix the problem. Maybe a safeguard in the RingBuffer itself
on the value of fill_min would be a better method.
--
Ticket URL: <https://code.mythtv.org/trac/ticket/12196>
MythTV <http://www.mythtv.org>
MythTV Media Center
More information about the mythtv-commits
mailing list