aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbmc/cores/DataCacheCore.cpp14
-rw-r--r--xbmc/cores/DataCacheCore.h14
-rw-r--r--xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp16
-rw-r--r--xbmc/cores/VideoPlayer/Process/ProcessInfo.h8
-rw-r--r--xbmc/cores/VideoPlayer/VideoPlayer.cpp5
-rw-r--r--xbmc/cores/VideoPlayer/VideoPlayer.h1
-rw-r--r--xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp16
-rw-r--r--xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h1
-rw-r--r--xbmc/guilib/GraphicContext.cpp4
9 files changed, 73 insertions, 6 deletions
diff --git a/xbmc/cores/DataCacheCore.cpp b/xbmc/cores/DataCacheCore.cpp
index 43a24f1da6..fe0609d0b0 100644
--- a/xbmc/cores/DataCacheCore.cpp
+++ b/xbmc/cores/DataCacheCore.cpp
@@ -206,3 +206,17 @@ int CDataCacheCore::GetAudioBitsPerSampe()
return m_playerAudioInfo.bitsPerSample;
}
+
+void CDataCacheCore::SetRenderClockSync(bool enable)
+{
+ CSingleLock lock(m_renderSection);
+
+ m_renderInfo.m_isClockSync = enable;
+}
+
+bool CDataCacheCore::IsRenderClockSync()
+{
+ CSingleLock lock(m_renderSection);
+
+ return m_renderInfo.m_isClockSync;
+}
diff --git a/xbmc/cores/DataCacheCore.h b/xbmc/cores/DataCacheCore.h
index 646f512f23..2a26e5834d 100644
--- a/xbmc/cores/DataCacheCore.h
+++ b/xbmc/cores/DataCacheCore.h
@@ -58,7 +58,11 @@ public:
int GetAudioSampleRate();
void SetAudioBitsPerSample(int bitsPerSample);
int GetAudioBitsPerSampe();
-
+
+ // render info
+ void SetRenderClockSync(bool enabled);
+ bool IsRenderClockSync();
+
protected:
std::atomic_bool m_hasAVInfoChanges;
@@ -83,4 +87,10 @@ protected:
int sampleRate;
int bitsPerSample;
} m_playerAudioInfo;
-}; \ No newline at end of file
+
+ CCriticalSection m_renderSection;
+ struct SRenderInfo
+ {
+ bool m_isClockSync;
+ } m_renderInfo;
+};
diff --git a/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp b/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp
index 9af9e83398..58dbf9f2eb 100644
--- a/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp
+++ b/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp
@@ -259,3 +259,19 @@ int CProcessInfo::GetAudioBitsPerSampe()
return m_audioBitsPerSample;
}
+
+void CProcessInfo::SetRenderClockSync(bool enabled)
+{
+ CSingleLock lock(m_renderSection);
+
+ m_isClockSync = enabled;
+
+ CServiceBroker::GetDataCacheCore().SetRenderClockSync(enabled);
+}
+
+bool CProcessInfo::IsRenderClockSync()
+{
+ CSingleLock lock(m_renderSection);
+
+ return m_isClockSync;
+}
diff --git a/xbmc/cores/VideoPlayer/Process/ProcessInfo.h b/xbmc/cores/VideoPlayer/Process/ProcessInfo.h
index 0ec9a2c778..6fd80f56e0 100644
--- a/xbmc/cores/VideoPlayer/Process/ProcessInfo.h
+++ b/xbmc/cores/VideoPlayer/Process/ProcessInfo.h
@@ -58,6 +58,10 @@ public:
void SetAudioBitsPerSample(int bitsPerSample);
int GetAudioBitsPerSampe();
+ // render info
+ void SetRenderClockSync(bool enabled);
+ bool IsRenderClockSync();
+
protected:
CProcessInfo();
@@ -78,4 +82,8 @@ protected:
int m_audioSampleRate;
int m_audioBitsPerSample;
CCriticalSection m_audioCodecSection;
+
+ // render info
+ CCriticalSection m_renderSection;
+ bool m_isClockSync;
};
diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp
index 03bef64077..eaa049b4fa 100644
--- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp
+++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp
@@ -5102,6 +5102,11 @@ void CVideoPlayer::GetDebugInfo(std::string &audio, std::string &video, std::str
GetGeneralInfo(general);
}
+void CVideoPlayer::UpdateClockSync(bool enabled)
+{
+ m_processInfo->SetRenderClockSync(enabled);
+}
+
// IDispResource interface
void CVideoPlayer::OnLostDisplay()
{
diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.h b/xbmc/cores/VideoPlayer/VideoPlayer.h
index f688520cc4..4849f018d5 100644
--- a/xbmc/cores/VideoPlayer/VideoPlayer.h
+++ b/xbmc/cores/VideoPlayer/VideoPlayer.h
@@ -360,6 +360,7 @@ protected:
virtual void Process();
virtual void VideoParamsChange() override;
virtual void GetDebugInfo(std::string &audio, std::string &video, std::string &general) override;
+ virtual void UpdateClockSync(bool enabled) override;
void CreatePlayers();
void DestroyPlayers();
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp
index 558a1f3df9..35e50e6734 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp
@@ -1398,10 +1398,18 @@ void CRenderManager::CheckEnableClockSync()
if (m_fps != 0)
{
- if (g_graphicsContext.GetFPS() >= m_fps)
- diff = fmod(g_graphicsContext.GetFPS(), m_fps);
+ float fps = m_fps;
+ double refreshrate, clockspeed;
+ int missedvblanks;
+ if (m_dvdClock.GetClockInfo(missedvblanks, clockspeed, refreshrate))
+ {
+ fps *= clockspeed;
+ }
+
+ if (g_graphicsContext.GetFPS() >= fps)
+ diff = fmod(g_graphicsContext.GetFPS(), fps);
else
- diff = m_fps - g_graphicsContext.GetFPS();
+ diff = fps - g_graphicsContext.GetFPS();
}
if (diff < 0.01)
@@ -1413,4 +1421,6 @@ void CRenderManager::CheckEnableClockSync()
m_clockSync.m_enabled = false;
m_dvdClock.SetSpeedAdjust(0);
}
+
+ m_playerPort->UpdateClockSync(m_clockSync.m_enabled);
}
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h
index 209046dfbe..27f04fa470 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h
@@ -57,6 +57,7 @@ class IRenderMsg
protected:
virtual void VideoParamsChange() = 0;
virtual void GetDebugInfo(std::string &audio, std::string &video, std::string &general) = 0;
+ virtual void UpdateClockSync(bool enabled) = 0;
};
class CRenderManager
diff --git a/xbmc/guilib/GraphicContext.cpp b/xbmc/guilib/GraphicContext.cpp
index 9caa43113f..e9d8e18445 100644
--- a/xbmc/guilib/GraphicContext.cpp
+++ b/xbmc/guilib/GraphicContext.cpp
@@ -21,6 +21,7 @@
#include "system.h"
#include "GraphicContext.h"
#include "Application.h"
+#include "cores/DataCacheCore.h"
#include "messaging/ApplicationMessenger.h"
#include "settings/AdvancedSettings.h"
#include "settings/DisplaySettings.h"
@@ -30,6 +31,7 @@
#include "TextureManager.h"
#include "input/InputManager.h"
#include "GUIWindowManager.h"
+#include "ServiceBroker.h"
using namespace KODI::MESSAGING;
@@ -977,7 +979,7 @@ void CGraphicContext::SetMediaDir(const std::string &strMediaDir)
void CGraphicContext::Flip(bool rendered, bool videoLayer)
{
- if (IsFullScreenVideo())
+ if (IsFullScreenVideo() && CServiceBroker::GetDataCacheCore().IsRenderClockSync())
g_Windowing.FinishPipeline();
g_Windowing.PresentRender(rendered, videoLayer);