Ticket #13416: 20190227_1659_timing_fix.patch

File 20190227_1659_timing_fix.patch, 2.4 KB (added by Peter Bennett, 7 years ago)

Proposed, lightly tested, fix

  • mythtv/libs/libmythtv/decoderbase.h

    diff --git a/mythtv/libs/libmythtv/decoderbase.h b/mythtv/libs/libmythtv/decoderbase.h
    index a736f23dc7a..87eba8ee22c 100644
    a b class DecoderBase  
    204204    virtual void UpdateFramesPlayed(void);
    205205    long long GetFramesRead(void) const { return m_framesRead; }
    206206    long long GetFramesPlayed(void) const { return m_framesPlayed; }
     207    void SetFramesPlayed(long long newValue) {m_framesPlayed = newValue;}
    207208
    208209    virtual QString GetCodecDecoderName(void) const = 0;
    209210    virtual QString GetRawEncodingType(void) { return QString(); }
  • mythtv/libs/libmythtv/mythplayer.cpp

    diff --git a/mythtv/libs/libmythtv/mythplayer.cpp b/mythtv/libs/libmythtv/mythplayer.cpp
    index db421c7225b..7f12f91e427 100644
    a b MythPlayer::MythPlayer(PlayerFlags flags)  
    225225      numdroppedframes(0),
    226226      prior_audiotimecode(0),
    227227      prior_videotimecode(0),
     228      m_timeOffsetBase(0),
    228229      // LiveTVChain stuff
    229230      m_tv(nullptr),                isDummy(false),
    230231      // Counter for buffering messages
    void MythPlayer::AVSync2(VideoFrame *buffer)  
    22312232            maxtcval = 0;
    22322233            maxtcframes = 0;
    22332234            numdroppedframes = 0;
     2235            m_timeOffsetBase = TranslatePositionFrameToMs(framesPlayed, false) - videotimecode;
    22342236        }
    22352237
    22362238        if (videotimecode == 0)
    void MythPlayer::AVSync2(VideoFrame *buffer)  
    22522254        else
    22532255            framedue = unow + frame_interval / 2;
    22542256
     2257        // recalculate framesPlayed to conform to actual time code.
     2258        framesPlayed = TranslatePositionMsToFrame(videotimecode + m_timeOffsetBase, false);
     2259        decoder->SetFramesPlayed(framesPlayed);
     2260
    22552261        lateness = unow - framedue;
    22562262        dropframe = false;
    22572263        if (lateness > 30000)
  • mythtv/libs/libmythtv/mythplayer.h

    diff --git a/mythtv/libs/libmythtv/mythplayer.h b/mythtv/libs/libmythtv/mythplayer.h
    index 4b295af28fe..088da8a04ea 100644
    a b class MTV_PUBLIC MythPlayer  
    858858    int       numdroppedframes; // number of consecutive dropped frames.
    859859    int64_t   prior_audiotimecode;    // time code from prior frame
    860860    int64_t   prior_videotimecode;    // time code from prior frame
     861    int64_t   m_timeOffsetBase;
    861862
    862863    // LiveTV
    863864    TV *m_tv;