Ticket #6938: smoother_vsync.patch

File smoother_vsync.patch, 2.5 KB (added by Mark Spieth, 11 years ago)
  • mythtv/libs/libmythtv/NuppelVideoPlayer.cpp

    commit 17bb6963d89423fe6c0d591f8cf309b62f299354
    Author: Mark Spieth <mspieth@digivation.com.au>
    Date:   Sat Aug 29 21:52:40 2009 +1000
    
        smoother video sync so tickers scroll smoothly at any speed
    
    diff --git a/mythtv/libs/libmythtv/NuppelVideoPlayer.cpp b/mythtv/libs/libmythtv/NuppelVideoPlayer.cpp
    index dedfe0f..1d0f905 100644
    a b using namespace std; 
    2626#include <QKeyEvent>
    2727#include <QDir>
    2828
     29#define NEW_AVSYNC
     30
    2931// MythTV headers
    3032#include "mythconfig.h"
    3133#include "mythdbcon.h"
    void NuppelVideoPlayer::AVSync(void) 
    24912493            // the vertical sync (e.g. VDPAU)
    24922494            videoOutput->PrepareFrame(buffer, kScan_Intr2ndField);
    24932495            videoOutput->Show(kScan_Intr2ndField);
    2494             VERBOSE(VB_PLAYBACK, LOC + dbg + "skipping A/V wait.");
     2496            VERBOSE(VB_PLAYBACK|VB_TIMESTAMP, LOC + dbg + "skipping A/V wait.");
    24952497        }
    24962498        else
    24972499        {
    24982500            // If we are using software decoding, skip this frame altogether.
     2501            //VERBOSE(VB_PLAYBACK|VB_TIMESTAMP, LOC + dbg + "dropping frame.");
    24992502            VERBOSE(VB_PLAYBACK, LOC + dbg + "dropping frame to catch up.");
    25002503        }
    25012504    }
    void NuppelVideoPlayer::AVSync(void) 
    25052508        if (buffer)
    25062509            videoOutput->PrepareFrame(buffer, ps);
    25072510
     2511        VERBOSE(VB_PLAYBACK|VB_TIMESTAMP, QString("AVSync waitforframe %1 %2").arg(avsync_adjustment).arg(m_double_framerate));
    25082512        videosync->WaitForFrame(avsync_adjustment);
     2513        VERBOSE(VB_PLAYBACK|VB_TIMESTAMP, "AVSync show");
    25092514        if (!resetvideo)
    25102515            videoOutput->Show(ps);
    25112516
    void NuppelVideoPlayer::AVSync(void) 
    25462551
    25472552            // Display the second field
    25482553            videosync->AdvanceTrigger();
     2554#ifdef NEW_AVSYNC
     2555            videosync->WaitForFrame(avsync_adjustment);
     2556#else
    25492557            videosync->WaitForFrame(0);
     2558#endif
    25502559            if (!resetvideo)
    25512560            {
    25522561                videoOutput->Show(ps);
    void NuppelVideoPlayer::AVSync(void) 
    25742583        // If audio is way behind of video, adjust for it...
    25752584        // by cutting the frame rate in half for the length of this frame
    25762585
     2586#ifdef NEW_AVSYNC
     2587        avsync_adjustment = refreshrate;
     2588#else
    25772589        avsync_adjustment = frame_interval;
     2590#endif
    25782591        lastsync = true;
    25792592        VERBOSE(VB_PLAYBACK, LOC +
    25802593                QString("Video is %1 frames ahead of audio,\n"