Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Modify AESinkWASAPI.cpp to use buffer sizes in advancedsettings.xml s…

…ubject to minimums

Signed-off-by: Damian Huckle <damianhuckle@hotmail.com>
  • Loading branch information...
commit 8845517cb4b8c54d90225c25dc104a9eb728a231 1 parent b278bcf
@DDDamian DDDamian authored
Showing with 14 additions and 3 deletions.
  1. +14 −3 xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp
View
17 xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp
@@ -30,6 +30,7 @@
#include "../Utils/AEUtil.h"
#include "settings/GUISettings.h"
+#include "settings/AdvancedSettings.h"
#include "utils/StdString.h"
#include "utils/log.h"
#include "threads/SingleLock.h"
@@ -688,9 +689,14 @@ bool CAESinkWASAPI::InitializeShared(AEAudioFormat &format)
REFERENCE_TIME hnsRequestedDuration, hnsPeriodicity;
hr = m_pAudioClient->GetDevicePeriod(NULL, &hnsPeriodicity);
+ /* Get m_audioSinkBufferSizeSharedmsec from advancedsettings.xml */
+ int m_audioSinkBufferSharedmsec;
+ m_audioSinkBufferSharedmsec = g_advancedSettings.m_audioSinkBufferSizeExclusivemsec * 10000;
+
//The default periods of some devices are VERY low (less than 3ms).
- //For audio stability make sure we have at least an 8ms buffer.
- if(hnsPeriodicity < 2000000) hnsPeriodicity = 2000000;
+ //For audio stability make sure we have at least an 50ms buffer.
+ if(hnsPeriodicity < 500000) hnsPeriodicity = 500000;
+ if(hnsPeriodicity < m_audioSinkBufferSharedmsec) hnsPeriodicity = m_audioSinkBufferSharedmsec;
hnsRequestedDuration = hnsPeriodicity; //*MUST* be equal now with event-driven callback event
@@ -871,9 +877,14 @@ bool CAESinkWASAPI::InitializeExclusive(AEAudioFormat &format)
REFERENCE_TIME hnsRequestedDuration, hnsPeriodicity;
hr = m_pAudioClient->GetDevicePeriod(NULL, &hnsPeriodicity);
+ /* Get m_audioSinkBufferSizeExclusivemsec from advancedsettings.xml */
+ int m_audioSinkBufferExclusivemsec;
+ m_audioSinkBufferExclusivemsec = g_advancedSettings.m_audioSinkBufferSizeExclusivemsec * 10000;
+
//The default periods of some devices are VERY low (less than 3ms).
- //For audio stability make sure we have at least an 8ms buffer.
+ //For audio stability make sure we have at least an 50ms buffer.
if(hnsPeriodicity < 500000) hnsPeriodicity = 500000;
+ if(hnsPeriodicity < m_audioSinkBufferExclusivemsec) hnsPeriodicity = m_audioSinkBufferExclusivemsec;
//hnsPeriodicity = (REFERENCE_TIME)((hnsPeriodicity / format.m_frameSize) * format.m_frameSize); //even number of frames
hnsRequestedDuration = hnsPeriodicity;
Please sign in to comment.
Something went wrong with that request. Please try again.