Use start threshold / avail min properly 41/264741/4 accepted/tizen/unified/20211101.140227 submit/tizen/20211015.121039 submit/tizen/20211028.130933 submit/tizen/20211101.022107
authorSeungbae Shin <seungbae.shin@samsung.com>
Wed, 29 Sep 2021 05:15:44 +0000 (14:15 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Wed, 13 Oct 2021 03:40:24 +0000 (12:40 +0900)
remove unused code and sync with other hal code

[Version] 0.1.17
[Issue Type] Update

Change-Id: Ibfb131d696aefff9a3c03b7aaf7c2b916630c798

packaging/audio-hal-emul.spec
tizen-audio-impl-pcm.c
tizen-audio-internal.h
tizen-audio-routing.c
tizen-audio-volume.c

index ab389e2..4a5c355 100644 (file)
@@ -1,11 +1,11 @@
 Name:       audio-hal-emul
 Summary:    TIZEN Audio HAL for Emulator
-Version:    0.1.16
+Version:    0.1.17
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
 URL:        http://tizen.org
-Source0:    audio-hal-emul-%{version}.tar.gz
+Source0:    %{name}-%{version}.tar.gz
 BuildRequires: pkgconfig(vconf)
 BuildRequires: pkgconfig(iniparser)
 BuildRequires: pkgconfig(dlog)
@@ -46,7 +46,7 @@ cp LICENSE.Apache-2.0 %{buildroot}%{_hal_licensedir}/%{name}
 /sbin/ldconfig
 
 %files
-%manifest audio-hal-emul.manifest
+%manifest %{name}.manifest
 %defattr(-,root,root,-)
 %{_hal_libdir}/libhal-backend-audio.so
 %{_hal_licensedir}/%{name}/*
index b845177..650596f 100644 (file)
@@ -486,11 +486,11 @@ audio_return_e _pcm_get_params(void *pcm_handle, uint32_t direction, void **samp
     int err;
     audio_pcm_sample_spec_s *ss;
     int dir;
-    snd_pcm_uframes_t _period_size, _buffer_size;
+    snd_pcm_uframes_t _period_size = 0 , _buffer_size = 0;
     snd_pcm_format_t _format;
-    unsigned int _rate, _channels;
-    snd_pcm_uframes_t _start_threshold, _stop_threshold, _silence_threshold, _avail_min;
-    unsigned int _periods;
+    unsigned int _rate = 0, _channels = 0;
+    snd_pcm_uframes_t _start_threshold = 0, _stop_threshold = 0, _silence_threshold = 0, _avail_min = 0;
+    unsigned int _periods = 0;
     snd_pcm_hw_params_t *hwparams;
     snd_pcm_sw_params_t *swparams;
 
@@ -532,8 +532,11 @@ audio_return_e _pcm_get_params(void *pcm_handle, uint32_t direction, void **samp
         AUDIO_LOG_ERROR("snd_pcm_sw_params_get_{start_threshold|stop_threshold|silence_threshold|avail_min}() failed : %d", err);
     }
 
-    AUDIO_LOG_DEBUG("_pcm_get_params (handle %p, format %d, rate %u, channels %u, period_size %lu, periods %u, buffer_size %lu)",
+    AUDIO_LOG_DEBUG("_pcm_get_params (handle %p, format %d, rate %u, channels %u, period_size %lu, periods %u, buffer_size %lu,",
                     pcm_handle, _format, _rate, _channels, _period_size, _periods, _buffer_size);
+    AUDIO_LOG_DEBUG("                 start_threshold %lu, stop_threshold %lu, silence_threshold %lu, avail_min %lu)",
+                    _start_threshold, _stop_threshold, _silence_threshold, _avail_min);
+
 #endif
 
     return AUDIO_RET_OK;
@@ -625,12 +628,12 @@ audio_return_e _pcm_set_params(void *pcm_handle, uint32_t direction, void *sampl
         return AUDIO_ERR_PARAMETER;
     }
 
-    if ((err = snd_pcm_sw_params_set_start_threshold(pcm_handle, swparams, period_size / 2)) < 0) {
+    if ((err = snd_pcm_sw_params_set_start_threshold(pcm_handle, swparams, _buffer_size)) < 0) {
         AUDIO_LOG_ERROR("Unable to set start threshold : %d", err);
         return AUDIO_ERR_PARAMETER;
     }
 
-    if ((err = snd_pcm_sw_params_set_avail_min(pcm_handle, swparams, 1024)) < 0) {
+    if ((err = snd_pcm_sw_params_set_avail_min(pcm_handle, swparams, period_size)) < 0) {
         AUDIO_LOG_ERROR("snd_pcm_sw_params_set_avail_min() failed : %d", err);
         return AUDIO_ERR_PARAMETER;
     }
index fc1a4ed..b3ce02d 100644 (file)
@@ -108,10 +108,6 @@ enum audio_device_type {
 #define streq !strcmp
 #define strneq strcmp
 
-#define ALSA_DEFAULT_CARD       "sdp_scard_audio"
-#define ALSA_CARD0              "hw:0"
-#define ALSA_CARD1              "hw:1"
-
 #define MAX_DEVICES             5
 #define MAX_NAME_LEN           32
 
index bd15781..59110ab 100644 (file)
@@ -136,6 +136,8 @@ static audio_return_e __set_devices(audio_hal_s *ah, device_info_s *devices, uin
         return AUDIO_ERR_PARAMETER;
     }
 
+    /* TODO : Set device here */
+
     return audio_ret;
 }
 
@@ -227,6 +229,8 @@ audio_return_e _audio_routing_init(audio_hal_s *ah)
     ah->device.active_in = 0x0;
     ah->device.active_out = 0x0;
 
+    /* TODO : Device init here */
+
     return AUDIO_RET_OK;
 }
 
@@ -234,6 +238,8 @@ audio_return_e _audio_routing_deinit(audio_hal_s *ah)
 {
     AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
 
+    /* TODO : Device deinit here */
+
     return AUDIO_RET_OK;
 }
 
index 151c431..caa4b62 100644 (file)
@@ -35,7 +35,7 @@
 #define VOLUME_VALUE_MAX            (1.0f)
 #define GAIN_VALUE_MAX              (1.0f)
 
-uint32_t g_master_volume_level = 100;
+static uint32_t g_master_volume_level = 100;
 
 static const char *g_volume_vconf[AUDIO_VOLUME_TYPE_MAX] = {
     "file/private/sound/volume/system",         /* AUDIO_VOLUME_TYPE_SYSTEM */