Ticket #3542: refresh-only.diff

File refresh-only.diff, 1.1 KB (added by dvbmail@…, 13 years ago)

Patch to fix refresh rate detection.

  • mythtv/libs/libmythtv/videoout_xv.cpp

    diff -u -r -x .svn ./a/mythtv/libs/libmythtv/videoout_xv.cpp ./b/mythtv/libs/libmythtv/videoout_xv.cpp
    ./a ./b  
    278278
    279279int VideoOutputXv::GetRefreshRate(void)
    280280{
     281    double rate;
     282
    281283    if (!XJ_started)
    282284        return -1;
    283285
     
    294296        return -1;
    295297    }
    296298
    297     double rate = (double)((double)(dot_clock * 1000.0) /
    298                            (double)(mode_line.htotal * mode_line.vtotal));
     299    // See if there's valid data to prevent a divide by zero.
     300    if (mode_line.htotal * mode_line.vtotal > 0)
     301        rate = (double)((double)(dot_clock * 1000.0) /
     302                        (double)(mode_line.htotal * mode_line.vtotal));
     303    else
     304        rate = 0;
    299305
    300306    // Assume 60Hz if we can't otherwise determine it.
    301307    if (rate == 0)
     
    308314        rate = 60;
    309315    }
    310316
     317    VERBOSE(VB_PLAYBACK, LOC + QString("Refresh rate set to %1Hz ").arg(rate));
     318
    311319    rate = 1000000.0 / rate;
    312320
    313321    return (int)rate;