aboutsummaryrefslogtreecommitdiff
path: root/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp')
-rw-r--r--xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp24
1 files changed, 8 insertions, 16 deletions
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
index 528822ddbb..e7ae140bec 100644
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
@@ -153,13 +153,6 @@ void CEngineStats::GetDelay(AEDelayStatus& status, CActiveAEStream *stream)
status.delay +=
static_cast<double>(m_bufferedSamples) * m_sinkFormat.m_streamInfo.GetDuration() / 1000;
- if (!m_pcmOutput && m_sinkNeedIecPack &&
- m_sinkFormat.m_streamInfo.m_type == CAEStreamInfo::STREAM_TYPE_TRUEHD)
- {
- // take into account MAT packer latency (half duration of MAT frame)
- status.delay += m_sinkFormat.m_streamInfo.GetDuration() / 1000 / 2;
- }
-
for (auto &str : m_streamStats)
{
if (str.m_streamId == stream->m_id)
@@ -186,13 +179,6 @@ void CEngineStats::GetSyncInfo(CAESyncInfo& info, CActiveAEStream *stream)
status.delay += static_cast<double>(m_sinkLatency);
- if (!m_pcmOutput && m_sinkNeedIecPack &&
- m_sinkFormat.m_streamInfo.m_type == CAEStreamInfo::STREAM_TYPE_TRUEHD)
- {
- // take into account MAT packer latency (half duration of MAT frame)
- status.delay += m_sinkFormat.m_streamInfo.GetDuration() / 1000 / 2;
- }
-
for (auto &str : m_streamStats)
{
if (str.m_streamId == stream->m_id)
@@ -1969,10 +1955,10 @@ bool CActiveAE::RunStages()
// TrueHD is very jumpy, meaning the frames don't come in equidistantly. They are only smoothed
// at the end when the IEC packing happens. Therefore adjust earlier.
- const bool ignoreWL =
+ const bool isTrueHDPassthrough =
(m_mode == MODE_RAW && m_sinkFormat.m_streamInfo.m_type == CAEStreamInfo::STREAM_TYPE_TRUEHD);
- if ((m_stats.GetWaterLevel() < (MAX_WATER_LEVEL + 0.0001f) || ignoreWL) &&
+ if ((m_stats.GetWaterLevel() < (MAX_WATER_LEVEL + 0.0001f) || isTrueHDPassthrough) &&
(m_mode != MODE_TRANSCODE || (m_encoderBuffers && !m_encoderBuffers->m_freeSamples.empty())))
{
// calculate sync error
@@ -1994,6 +1980,12 @@ bool CActiveAE::RunStages()
double playingPts = pts - delay;
double maxError = ((*it)->m_syncState == CAESyncInfo::SYNC_INSYNC) ? 1000 : 5000;
double error = playingPts - (*it)->m_pClock->GetClock();
+
+ // underestimate error for TrueHD passthrough
+ // oscillations should be less than frametime 40ms to avoid unnecessary a/v sync corrections
+ if (isTrueHDPassthrough)
+ error *= 0.45;
+
if (error > maxError)
{
CLog::Log(LOGWARNING, "ActiveAE - large audio sync error: {:f}", error);