Ticket #11435: keyframe-buffer.patch

File keyframe-buffer.patch, 1.3 KB (added by jpoet, 11 years ago)

Flush payload buffer whenever a new payload starts

  • mythtv/libs/libmythtv/recorders/dtvrecorder.cpp

    diff --git a/mythtv/libs/libmythtv/recorders/dtvrecorder.cpp b/mythtv/libs/libmythtv/recorders/dtvrecorder.cpp
    index f6842cf..5b76852 100644
    a b bool DTVRecorder::ProcessVideoTSPacket(const TSPacket &tspacket) 
    13581358
    13591359    if (tspacket.HasPayload() && tspacket.PayloadStart())
    13601360    {
     1361        if (_buffer_packets && _first_keyframe >= 0 && !_payload_buffer.empty())
     1362        {
     1363            // Flush the buffer
     1364            if (ringBuffer)
     1365                ringBuffer->Write(&_payload_buffer[0], _payload_buffer.size());
     1366            _payload_buffer.clear();
     1367        }
     1368
    13611369        // buffer packets until we know if this is a keyframe
    13621370        _buffer_packets = true;
    13631371    }
    bool DTVRecorder::ProcessAudioTSPacket(const TSPacket &tspacket) 
    13811389
    13821390    if (tspacket.HasPayload() && tspacket.PayloadStart())
    13831391    {
     1392        if (_buffer_packets && _first_keyframe >= 0 && !_payload_buffer.empty())
     1393        {
     1394            // Flush the buffer
     1395            if (ringBuffer)
     1396                ringBuffer->Write(&_payload_buffer[0], _payload_buffer.size());
     1397            _payload_buffer.clear();
     1398        }
     1399
    13841400        // buffer packets until we know if this is a keyframe
    13851401        _buffer_packets = true;
    13861402    }