Ticket #12196: mythtv_fix_avf_bitrate.2.patch

File mythtv_fix_avf_bitrate.2.patch, 1.1 KB (added by david.madsen@…, 7 years ago)

Cleaned up patch to avoid null pointer

  • mythtv/libs/libmythtv/avformatdecoder.cpp

    diff --git a/mythtv/libs/libmythtv/avformatdecoder.cpp b/mythtv/libs/libmythtv/avformatdecoder.cpp
    index 8ae0bcd..9bfc44a 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 100000000U
    9394
    9495static const float eps = 1E-5;
    9596
    int AvFormatDecoder::ScanStreams(bool novideo) 
    25062507        }
    25072508    }
    25082509
     2510    //If AVF uses PTS to calculate duration (and consequently bitrate)
     2511    //and there are glitches in the recording that reset the PTS near
     2512    //the end of the recording, the bitrate provided in ic->bit_rate
     2513    //will be much much higher than the actual bitrate of the recording.
     2514    //
     2515    //This can cause problems with the RingBuffer because the fill_min
     2516    //value will be set to a value larger than the buffer can hold, which
     2517    //will cause reads to never be allowed.
    25092518    if (ic && ((uint)ic->bit_rate > bitrate))
    2510         bitrate = (uint)ic->bit_rate;
     2519        bitrate = min((uint)ic->bit_rate,MAX_AVF_BIT_RATE);
    25112520
    25122521    if (bitrate > 0)
    25132522    {