Ticket #9511: 103-livetv_buffer_underrun.patch

File 103-livetv_buffer_underrun.patch, 1.8 KB (added by Jiri Fojtasek <jiri.fojtasek@…>, 8 years ago)

first patch

  • external/FFmpeg/libavformat/mpegts.c

    diff -u -r -p mythtv.102/external/FFmpeg/libavformat/mpegts.c mythtv/external/FFmpeg/libavformat/mpegts.c
    old new static int read_packet(AVFormatContext * 
    20962096
    20972097    for(;;) {
    20982098        len = get_buffer(pb, buf, TS_PACKET_SIZE);
    2099         if (len != TS_PACKET_SIZE)
    2100             return AVERROR(EIO);
     2099        if (len != TS_PACKET_SIZE) {
     2100            if (pb->error == AVERROR(EAGAIN)) {
     2101                /* workarround to solve livetv ringbuffer underrun */
     2102                pb->error = pb->eof_reached = 0;
     2103                return AVERROR(EAGAIN);
     2104            } else
     2105                return AVERROR(EIO);
     2106        }
    21012107        /* check paquet sync byte */
    21022108        if (buf[0] != 0x47) {
    21032109            /* find a new packet start */
  • libs/libmythtv/ringbuffer.cpp

    diff -u -r -p mythtv.102/libs/libmythtv/ringbuffer.cpp mythtv/libs/libmythtv/ringbuffer.cpp
    old new int RingBuffer::ReadPriv(void *buf, int  
    11491148    {
    11501149        // this can happen under a few conditions but the most
    11511150        // notable is an exit from the read ahead thread or
    1152         // the end of the file stream has been reached.
    1153         VERBOSE(VB_FILE, LOC + loc_desc + ": ReadBufAvail() == 0");
     1151        // the end of the file stream has been reached or
     1152        // encoder stream underrun when live tv switching to
     1153        // next program
     1154        VERBOSE(VB_FILE, LOC + loc_desc + ": ReadBufAvail() == 0" +
     1155            QString(" livetvchain=%1")
     1156            .arg(livetvchain ? 1 : 0));
    11541157        rwlock.unlock();
    1155         return count;
     1158        return livetvchain ? -EAGAIN : -EIO;
    11561159    }
    11571160
    11581161    if (peek)