Opened 10 years ago
Closed 10 years ago
Last modified 10 years ago
#12196 closed Bug Report - General (fixed)
Invalid bitrate from AVFormat can stall reads from the RingBuffer
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | minor | Milestone: | 0.27 |
Component: | MythTV - General | Version: | Unspecified |
Severity: | medium | Keywords: | |
Cc: | Ticket locked: | no |
Description
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.
Attachments (2)
Change History (5)
Changed 10 years ago by
Attachment: | mythtv_fix_avf_bitrate.patch added |
---|
Changed 10 years ago by
Attachment: | mythtv_fix_avf_bitrate.2.patch added |
---|
comment:1 Changed 10 years ago by
Owner: | set to Jean-Yves Avenard <jyavenard@…> |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:3 Changed 10 years ago by
Milestone: | unknown → 0.27 |
---|
Cleaned up patch to avoid null pointer