diff -ur mythtv/libs/libmythtv/mythplayer.cpp mythtv/libs/libmythtv/mythplayer.cpp
|
|
|
|
| 620 | 620 | .arg(videosync->getRefreshInterval()) |
| 621 | 621 | .arg(ri)); |
| 622 | 622 | videosync->setRefreshInterval(ri); |
| | 623 | ApplyVideoPipelineFrameDelay(ri); |
| 623 | 624 | } |
| 624 | 625 | } |
| 625 | 626 | |
| … |
… |
|
| 1786 | 1787 | refreshrate); |
| 1787 | 1788 | } |
| 1788 | 1789 | |
| | 1790 | void MythPlayer::ApplyVideoPipelineFrameDelay(int refreshrate) |
| | 1791 | { |
| | 1792 | // apply VideoSyncDelayFrames if applicable |
| | 1793 | double output_rate = 1000000.0 / refreshrate; |
| | 1794 | LOG(VB_PLAYBACK, LOG_INFO, LOC + |
| | 1795 | QString("Using output refresh rate of %1 for pipelined video audio synchronization") |
| | 1796 | .arg(output_rate)); |
| | 1797 | |
| | 1798 | tc_wrap_frameoffset[TC_AUDIO] = ((1000.0 / output_rate) |
| | 1799 | * gCoreContext->GetNumSetting("VideoSyncDelayFrames", 0)); |
| | 1800 | LOG(VB_PLAYBACK, LOG_INFO, LOC + |
| | 1801 | QString("Calculated delay: %1ms") |
| | 1802 | .arg(tc_wrap_frameoffset[TC_AUDIO])); |
| | 1803 | |
| | 1804 | this->AdjustAudioTimecodeOffset( |
| | 1805 | 0, gCoreContext->GetNumSetting("AudioSyncOffset", 0) |
| | 1806 | + tc_wrap_frameoffset[TC_AUDIO]); |
| | 1807 | } |
| | 1808 | |
| 1789 | 1809 | void MythPlayer::ResetAVSync(void) |
| 1790 | 1810 | { |
| 1791 | 1811 | avsync_avg = 0; |
| … |
… |
|
| 1837 | 1857 | |
| 1838 | 1858 | SetFrameInterval(m_scan, 1.0 / (video_frame_rate * play_speed)); |
| 1839 | 1859 | |
| | 1860 | ApplyVideoPipelineFrameDelay(refreshrate); |
| | 1861 | |
| 1840 | 1862 | // try to get preferential scheduling, but ignore if we fail to. |
| 1841 | 1863 | myth_nice(-19); |
| 1842 | 1864 | } |
diff -ur mythtv/libs/libmythtv/mythplayer.h mythtv/libs/libmythtv/mythplayer.h
|
|
|
|
| 549 | 549 | // Time Code adjustment stuff |
| 550 | 550 | int64_t AdjustAudioTimecodeOffset(int64_t v, int newsync = -9999); |
| 551 | 551 | int64_t GetAudioTimecodeOffset(void) const |
| 552 | | { return tc_wrap[TC_AUDIO]; } |
| | 552 | { return tc_wrap[TC_AUDIO] - tc_wrap_frameoffset[TC_AUDIO]; } |
| 553 | 553 | |
| 554 | 554 | // Playback (output) zoom automation |
| 555 | 555 | DetectLetterbox *detect_letter_box; |
| … |
… |
|
| 613 | 613 | void WrapTimecode(int64_t &timecode, TCTypes tc_type); |
| 614 | 614 | void InitAVSync(void); |
| 615 | 615 | virtual void AVSync(VideoFrame *buffer, bool limit_delay = false); |
| | 616 | void ApplyVideoPipelineFrameDelay(int refreshrate); |
| 616 | 617 | void ResetAVSync(void); |
| 617 | 618 | int64_t AVSyncGetAudiotime(void); |
| 618 | 619 | void SetFrameInterval(FrameScanType scan, double speed); |
| … |
… |
|
| 838 | 839 | int prevtc; ///< 32 bit timecode if last VideoFrame shown |
| 839 | 840 | int prevrp; ///< repeat_pict of last frame |
| 840 | 841 | int64_t tc_wrap[TCTYPESMAX]; |
| | 842 | int64_t tc_wrap_frameoffset[TCTYPESMAX]; |
| 841 | 843 | int64_t tc_lastval[TCTYPESMAX]; |
| 842 | 844 | int64_t savedAudioTimecodeOffset; |
| 843 | 845 | |