Allocate memory based on configuration parameter; 58/150558/6
authoraravind.gara <aravind.gara@samsung.com>
Mon, 18 Sep 2017 02:47:43 +0000 (11:47 +0900)
committeraravind.gara <aravind.gara@samsung.com>
Tue, 19 Sep 2017 05:43:02 +0000 (14:43 +0900)
Avoid consumption of more memory, by reducing the memory allocation.

[Version] 1.17.3
[Issue Type] Enhancement.

Change-Id: Ie223528543e04a77720637b5ea2209be709a1c73
Signed-off-by: aravind.gara <aravind.gara@samsung.com>
Alc/ALc.c
alsoftrc.sample
packaging/openal-soft.spec

index 619b023..14641d2 100644 (file)
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -3153,7 +3153,15 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin
         VECTOR_INIT(ALContext->ActiveAuxSlots);
 
         ALContext->VoiceCount = 0;
+#ifdef __TIZEN__
+        /* Max voices value read from configuration file.
+         * Below Fix is to reduce memory allocation.
+         */
+        ConfigValueUInt(device->DeviceName, NULL, "voices", &ALContext->MaxVoices);
+        if(ALContext->MaxVoices == 0) ALContext->MaxVoices = 256;
+#else
         ALContext->MaxVoices = 256;
+#endif
         ALContext->Voices = al_calloc(16, ALContext->MaxVoices * sizeof(ALContext->Voices[0]));
     }
     if(!ALContext || !ALContext->Voices)
@@ -3368,7 +3376,6 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
 
     device->ClockBase = 0;
     device->SamplesDone = 0;
-
     device->MaxNoOfSources = 256;
     device->AuxiliaryEffectSlotMax = 4;
     device->NumAuxSends = MAX_SENDS;
index 2516624..1d189a8 100644 (file)
 #  systems with apps that try to play more sounds than the CPU can handle.
 #sources = 256
 
+## voices:
+#  The default value is 256. In this case Memory will be allocated for 256
+#  voices, which is not practical.
+#  Reduced to 32 from 256. Memory will be allocated for 32 voices.
+#  If more voices need to be played this value will be doubled.
+voices = 32
+
 ## slots:
 #  Sets the maximum number of Auxiliary Effect Slots an app can create. A slot
 #  can use a non-negligible amount of CPU time if an effect is set on it even
index 0513191..fa9dc23 100644 (file)
@@ -1,5 +1,5 @@
 Name:           openal-soft
-Version:        1.17.2
+Version:        1.17.3
 Release:        12
 License:        LGPL-2.0+
 Summary:        A cross-platform 3D audio API