Ticket #7759: t7759_repeat_pict_v1_part1.diff

File t7759_repeat_pict_v1_part1.diff, 4.3 KB (added by tralph11@…, 11 years ago)

Part 1 only includes repeat_pict changes

  • libs/libmythtv/NuppelVideoPlayer.h

     
    804804    bool       decode_extra_audio;
    805805    float      m_stored_audio_stretchfactor;
    806806    bool       audio_paused;
     807    int        repeat_delay;
    807808
    808809    // Audio warping stuff
    809810    bool       usevideotimebase;
     
    815816 
    816817    // Time Code stuff
    817818    int        prevtc;        ///< 32 bit timecode if last VideoFrame shown
     819    int        prevrp;        ///< repeat_pict of last frame
    818820    int        tc_avcheck_framecounter;
    819821    long long  tc_wrap[TCTYPESMAX];
    820822    long long  tc_lastval[TCTYPESMAX];
  • libs/libmythtv/NuppelVideoPlayer.cpp

     
    253253      lastsync(false),              m_playing_slower(false),
    254254      m_stored_audio_stretchfactor(1.0),
    255255      audio_paused(false),
     256      repeat_delay(0),
    256257      // Audio warping stuff
    257258      usevideotimebase(false),
    258259      warpfactor(1.0f),             warpfactor_avg(1.0f),
    259260      warplbuff(NULL),              warprbuff(NULL),
    260261      warpbuffsize(0),
    261262      // Time Code stuff
    262       prevtc(0),
     263      prevtc(0),                    prevrp(0),
    263264      tc_avcheck_framecounter(0),   tc_diff_estimate(0),
    264265      savedAudioTimecodeOffset(0),
    265266      // LiveTVChain stuff
     
    23882389
    23892390    avsync_adjustment = 0;
    23902391
     2392    repeat_delay = 0;
     2393
    23912394    if (usevideotimebase)
    23922395    {
    23932396        warpfactor_avg = gContext->GetNumSetting("WarpFactor", 0);
     
    25052508
    25062509        VERBOSE(VB_PLAYBACK|VB_TIMESTAMP, QString("AVSync waitforframe %1 %2")
    25072510                .arg(avsync_adjustment).arg(m_double_framerate));
    2508         videosync->WaitForFrame(avsync_adjustment);
     2511        videosync->WaitForFrame(avsync_adjustment + repeat_delay);
    25092512        VERBOSE(VB_PLAYBACK|VB_TIMESTAMP, "AVSync show");
    25102513        if (!resetvideo)
    25112514            videoOutput->Show(ps);
     
    25572560                videoOutput->Show(ps);
    25582561            }
    25592562        }
     2563
     2564        repeat_delay = frame_interval * buffer->repeat_pict * 0.5;
     2565
     2566        if (repeat_delay)
     2567            VERBOSE(VB_TIMESTAMP, QString("A/V repeat_pict, adding %1 repeat "
     2568                    "delay").arg(repeat_delay));
    25602569    }
    25612570    else
    25622571    {
     
    26152624
    26162625            // If the timecode is off by a frame (dropped frame) wait to sync
    26172626            if (delta > (int) frame_interval / 1200 &&
    2618                 delta < (int) frame_interval / 1000 * 3)
     2627                delta < (int) frame_interval / 1000 * 3 &&
     2628                prevrp == 0)
    26192629            {
    26202630                //cerr << "+ ";
    26212631                videosync->AdvanceTrigger();
    26222632                if (m_double_framerate)
    26232633                    videosync->AdvanceTrigger();
    26242634            }
     2635            prevrp = buffer->repeat_pict;
    26252636
    26262637            avsync_delay = (buffer->timecode - currentaudiotime) * 1000;//usec
    26272638            // prevents major jitter when pts resets during dvd title
  • libs/libmythtv/vsync.cpp

     
    187187/** \fn VideoSync::CalcDelay()
    188188 *  \brief Calculates the delay to the next frame.
    189189 *
    190  *   Regardless of the timing method, if delay is greater than two full
     190 *   Regardless of the timing method, if delay is greater than four full
    191191 *   frames (could be greater than 20 or greater than 200), we don't want
    192192 *   to freeze while waiting for a huge delay. Instead, contine playing
    193193 *   video at half speed and continue to read new audio and video frames
     
    205205
    206206    //cout << "delay " << ret_val << endl;
    207207
    208     if (ret_val > m_frame_interval * 2)
     208    if (ret_val > m_frame_interval * 4)
    209209    {
    210210        if (m_interlaced)
    211             ret_val = m_frame_interval; // same as / 2 * 2.
     211            ret_val = (m_frame_interval / 2) * 4;
    212212        else
    213             ret_val = m_frame_interval * 2;
     213            ret_val = m_frame_interval * 4;
    214214
    215215        // set nexttrigger to our new target time
    216216        m_nexttrigger.tv_sec = now.tv_sec;