diff options
author | Rainer Hochecker <fernetmenta@online.de> | 2015-11-13 06:10:34 -0800 |
---|---|---|
committer | Rainer Hochecker <fernetmenta@online.de> | 2015-11-13 06:10:34 -0800 |
commit | 9c7322e4b51df7eedea3c7f02d69f84e90a522a8 (patch) | |
tree | e0fe113aad5f6fedc4becb187c70d2722a3d0a0f | |
parent | 1ad360a01d743d8e2a980ba779f2f419686fbf98 (diff) | |
parent | 4bd354cbc175d6485e704243a177b2e714943fb1 (diff) |
Merge pull request #8379 from FernetMenta/getdelay
AE: fix GetDelay - only apply time correction to sink delay
-rw-r--r-- | xbmc/cores/AudioEngine/Utils/AEUtil.cpp | 19 | ||||
-rw-r--r-- | xbmc/cores/AudioEngine/Utils/AEUtil.h | 6 |
2 files changed, 14 insertions, 11 deletions
diff --git a/xbmc/cores/AudioEngine/Utils/AEUtil.cpp b/xbmc/cores/AudioEngine/Utils/AEUtil.cpp index 6d6b0e19ca..90f6c44431 100644 --- a/xbmc/cores/AudioEngine/Utils/AEUtil.cpp +++ b/xbmc/cores/AudioEngine/Utils/AEUtil.cpp @@ -38,21 +38,22 @@ unsigned int CAEUtil::m_seed = (unsigned int)(CurrentHostCounter() / 1000.0f); MEMALIGN(16, __m128i CAEUtil::m_sseSeed) = _mm_set_epi32(CAEUtil::m_seed, CAEUtil::m_seed+1, CAEUtil::m_seed, CAEUtil::m_seed+1); #endif -void AEDelayStatus::SetDelay(double d) +void AEDelayStatus::SetDelay(double d) { delay = d; - tick = CurrentHostCounter(); + maxcorrection = d; + tick = CurrentHostCounter(); } double AEDelayStatus::GetDelay() { - double d = delay; - if(tick) - d -= (double)(CurrentHostCounter() - tick) / CurrentHostFrequency(); - if(d < 0) - return 0.0; - else - return d; + double d = 0; + if (tick) + d = (double)(CurrentHostCounter() - tick) / CurrentHostFrequency(); + if (d > maxcorrection) + d = maxcorrection; + + return delay - d; } CAEChannelInfo CAEUtil::GuessChLayout(const unsigned int channels) diff --git a/xbmc/cores/AudioEngine/Utils/AEUtil.h b/xbmc/cores/AudioEngine/Utils/AEUtil.h index edc920ee64..56c0a1f038 100644 --- a/xbmc/cores/AudioEngine/Utils/AEUtil.h +++ b/xbmc/cores/AudioEngine/Utils/AEUtil.h @@ -64,14 +64,16 @@ struct AEDelayStatus { AEDelayStatus() : delay(0.0) + , maxcorrection(0.0) , tick(0) {} void SetDelay(double d); double GetDelay(); - double delay; /*!< delay in sink currently */ - int64_t tick; /*!< timestamp when delay was calculated */ + double delay; // delay in sink currently + double maxcorrection; // time correction must not be greater than sink delay + int64_t tick; // timestamp when delay was calculated }; /** |