Ticket #6003: 131-ForceResync.patch

File 131-ForceResync.patch, 1.8 KB (added by anonymous, 13 years ago)
  • mythtv/libs/libmythtv/mpeg/mpegstreamdata.cpp

    diff -r -u -X diff.exclude release.19345.1212a/mythtv/libs/libmythtv/mpeg/mpegstreamdata.cpp release.19345.1212b/mythtv/libs/libmythtv/mpeg/mpegstreamdata.cpp
     
    932932    {
    933933        if (buffer[pos] != SYNC_BYTE || resync)
    934934        {
    935             int newpos = ResyncStream(buffer, pos, len);
     935            int newpos = ResyncStream(buffer, pos, len, resync);
    936936            if (newpos == -1)
    937937                return len - pos;
    938938            if (newpos == -2)
     
    999999    return true;
    10001000}
    10011001
    1002 int MPEGStreamData::ResyncStream(unsigned char *buffer, int curr_pos, int len)
     1002int MPEGStreamData::ResyncStream(unsigned char *buffer, int curr_pos, int len, bool force)
    10031003{
    10041004    // Search for two sync bytes 188 bytes apart,
    10051005    int pos = curr_pos;
    10061006    int nextpos = pos + TSPacket::SIZE;
     1007    if (force) // The sync bytes might match but the packet processing failed
     1008    {
     1009        pos++;
     1010        nextpos++;
     1011    }
    10071012    if (nextpos >= len)
    10081013        return -1; // not enough bytes; caller should try again
    10091014   
  • mythtv/libs/libmythtv/mpeg/mpegstreamdata.h

    diff -r -u -X diff.exclude release.19345.1212a/mythtv/libs/libmythtv/mpeg/mpegstreamdata.h release.19345.1212b/mythtv/libs/libmythtv/mpeg/mpegstreamdata.h
     
    293293    void ProcessPMT(const ProgramMapTable *pmt);
    294294    void ProcessEncryptedPacket(const TSPacket&);
    295295
    296     static int ResyncStream(unsigned char *buffer, int curr_pos, int len);
     296    static int ResyncStream(unsigned char *buffer, int curr_pos, int len, bool force);
    297297
    298298    void UpdateTimeOffset(uint64_t si_utc_time);
    299299