Ticket #12196: mythtv_fix_avf_bitrate.patch

File mythtv_fix_avf_bitrate.patch, 1.2 KB (added by david.madsen@…, 7 years ago)
  • mythtv/libs/libmythtv/avformatdecoder.cpp

    diff --git a/mythtv/libs/libmythtv/avformatdecoder.cpp b/mythtv/libs/libmythtv/avformatdecoder.cpp
    index 8ae0bcd..bd00664 100644
    a b __inline AVRational GetAVTimeBaseQ() 
    9090#define LOC QString("AFD: ")
    9191
    9292#define MAX_AC3_FRAME_SIZE 6144
     93#define MAX_AVF_BIT_RATE 50000000
    9394
    9495static const float eps = 1E-5;
    9596
    int AvFormatDecoder::ScanStreams(bool novideo) 
    25092510    if (ic && ((uint)ic->bit_rate > bitrate))
    25102511        bitrate = (uint)ic->bit_rate;
    25112512
     2513    //If AVF uses PTS to calculate duration (and consequently bitrate)
     2514    //and there are glitches in the recording that reset the PTS near
     2515    //the end of the recording, the bitrate provided in ic->bit_rate
     2516    //will be much much higher than the actual bitrate of the recording.
     2517    //
     2518    //This can cause problems with the RingBuffer because the fill_min
     2519    //value will be set to a value larger than the buffer can hold, which
     2520    //will cause reads to never be allowed.
     2521    if ((uint)ic->bit_rate > MAX_AVF_BIT_RATE)
     2522        bitrate = MAX_AVF_BIT_RATE;
     2523
     2524
    25122525    if (bitrate > 0)
    25132526    {
    25142527        bitrate = (bitrate + 999) / 1000;