Ticket #2147: 2147_fix.diff

File 2147_fix.diff, 2.8 KB (added by Janne <janne-mythtv@…>, 13 years ago)
  • libs/libmythtv/mpeg/mpegstreamdata.cpp

    old new void MPEGStreamData::DeletePartialPES(ui 
    199199PSIPTable* MPEGStreamData::AssemblePSIP(const TSPacket* tspacket,
    200200                                        bool &moreTablePackets)
    201201{
     202    bool broken = true;
    202203    moreTablePackets = true;
    203204
    204205    PESPacket* partial = GetPartialPES(tspacket->PID());
    205     if (partial && partial->AddTSPacket(tspacket))
     206    if (partial && partial->AddTSPacket(tspacket, broken) && !broken)
    206207    {
    207208        // check if it's safe to read pespacket's Length()
    208209        if ((partial->PSIOffset() + 1 + 3) > partial->TSSizeInBuffer())
    PSIPTable* MPEGStreamData::AssemblePSIP( 
    270271        return psip;
    271272    }
    272273    else if (partial)
    273     {   
     274    {
     275        if (broken)
     276            DeletePartialPES(tspacket->PID());
     277
    274278        moreTablePackets = false;
    275279        return 0; // partial packet is not yet complete.
    276280    }
  • libs/libmythtv/mpeg/pespacket.cpp

    old new extern "C" { 
    1818using namespace std;
    1919
    2020// return true if complete or broken
    21 bool PESPacket::AddTSPacket(const TSPacket* packet)
     21bool PESPacket::AddTSPacket(const TSPacket* packet, bool &broken)
    2222{
     23    broken = true;
    2324    if (!tsheader()->PayloadStart())
    2425    {
    bool PESPacket::AddTSPacket(const TSPack 
    7878        return true;
    7979    }
    8080
     81    // packet is correct or incomplete
     82    broken = false;
    8183    // check if it's safe to call Length
    8284    if ((_psiOffset + 1 + 3) <=  _pesdataSize)
    8385    {
  • libs/libmythtv/mpeg/pespacket.h

    old new class PESPacket 
    138138    bool IsClone() const { return bool(_allocSize); }
    139139
    140140    // return true if complete or broken
    141     bool AddTSPacket(const TSPacket* tspacket);
     141    bool AddTSPacket(const TSPacket* tspacket, bool &broken);
    142142
    143143    bool IsGood() const { return !_badPacket; }
    144144
    class PESPacket 
    252252  private:
    253253    uint _psiOffset;    ///< AFCOffset + StartOfFieldPointer
    254254    uint _ccLast;       ///< Continuity counter of last inserted TS Packet
    255     uint _pesdataSize;  ///< Number of bytes containing PES data
     255    uint _pesdataSize;  ///< Number of data bytes (TS header + PES data)
    256256    uint _allocSize;    ///< Total number of bytes we allocated
    257257    bool _badPacket;    ///< true if a CRC is not good yet
    258258};