alsa-sink/source: Rename a variable for supported sample rates in userdata 81/182581/3
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 5 Jun 2018 08:45:51 +0000 (17:45 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Mon, 9 Jul 2018 01:24:12 +0000 (10:24 +0900)
It is changed from 'rates' to 'supported_rates'.

[Version] 11.1-42
[Issue Type] Refactoring

Change-Id: Ic47e7a5635587c91a9f4e5f66ba35d9389b551ee
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/pulseaudio.spec
src/modules/alsa/alsa-sink.c
src/modules/alsa/alsa-source.c

index 6a5b800..25ef74d 100644 (file)
@@ -3,7 +3,7 @@
 Name:             pulseaudio
 Summary:          Improved Linux sound server
 Version:          11.1
-Release:          41
+Release:          42
 Group:            Multimedia/Audio
 License:          LGPL-2.1
 URL:              http://pulseaudio.org
index 45b460d..561dae6 100644 (file)
@@ -110,10 +110,12 @@ struct userdata {
 
     pa_cvolume hardware_volume;
 
-#ifdef __TIZEN__
+#ifndef __TIZEN__
+    unsigned int *rates;
+#else
     pa_sample_format_t *supported_formats;
+    unsigned int *supported_rates;
 #endif
-    unsigned int *rates;
 
     size_t
         frame_size,
@@ -1580,14 +1582,22 @@ static bool sink_set_formats(pa_sink *s, pa_idxset *formats) {
      * framework, but this must be changed if we do. */
 
     /* Count how many sample rates we support */
+#ifdef __TIZEN__
+    for (idx = 0, n = 0; u->supported_rates[idx]; idx++)
+#else
     for (idx = 0, n = 0; u->rates[idx]; idx++)
+#endif
         n++;
 
     /* First insert non-PCM formats since we prefer those. */
     PA_IDXSET_FOREACH(f, formats, idx) {
         if (!pa_format_info_is_pcm(f)) {
             g = pa_format_info_copy(f);
+#ifdef __TIZEN__
+            pa_format_info_set_prop_int_array(g, PA_PROP_FORMAT_RATE, (int *) u->supported_rates, n);
+#else
             pa_format_info_set_prop_int_array(g, PA_PROP_FORMAT_RATE, (int *) u->rates, n);
+#endif
             pa_idxset_put(u->formats, g, NULL);
         }
     }
@@ -1613,8 +1623,13 @@ static int sink_reconfigure_cb(pa_sink *s, pa_sample_spec *spec, bool passthroug
 
     pa_assert(u);
 
+#ifdef __TIZEN__
+    for (i = 0; u->supported_rates[i]; i++) {
+        if (u->supported_rates[i] == spec->rate) {
+#else
     for (i = 0; u->rates[i]; i++) {
         if (u->rates[i] == spec->rate) {
+#endif
             supported = true;
             break;
         }
@@ -2296,9 +2311,12 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
         goto fail;
     }
 
-#endif
+    u->supported_rates = pa_alsa_get_supported_rates(u->pcm_handle, ss.rate);
+    if (!u->supported_rates) {
+#else
     u->rates = pa_alsa_get_supported_rates(u->pcm_handle, ss.rate);
     if (!u->rates) {
+#endif
         pa_log_error("Failed to find any supported sample rates.");
         goto fail;
     }
@@ -2403,7 +2421,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
     u->sink->reconfigure = sink_reconfigure_cb;
     u->sink->userdata = u;
 #ifdef __TIZEN__
-    u->sink->supported_sample_rates = u->rates;
+    u->sink->supported_sample_rates = u->supported_rates;
 #endif
 
     pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
@@ -2584,9 +2602,12 @@ static void userdata_free(struct userdata *u) {
     if (u->supported_formats)
         pa_xfree(u->supported_formats);
 
-#endif
+    if (u->supported_rates)
+        pa_xfree(u->supported_rates);
+#else
     if (u->rates)
         pa_xfree(u->rates);
+#endif
 
     reserve_done(u);
     monitor_done(u);
index 443c8a9..2970185 100644 (file)
@@ -98,10 +98,12 @@ struct userdata {
 
     pa_cvolume hardware_volume;
 
-#ifdef __TIZEN__
+#ifndef __TIZEN__
+    unsigned int *rates;
+#else
     pa_sample_format_t *supported_formats;
+    unsigned int *supported_rates;
 #endif
-    unsigned int *rates;
 
     size_t
         frame_size,
@@ -1410,8 +1412,13 @@ static int source_reconfigure_cb(pa_source *s, pa_sample_spec *spec, bool passth
 
     pa_assert(u);
 
+#ifdef __TIZEN__
+    for (i = 0; u->supported_rates[i]; i++) {
+        if (u->supported_rates[i] == spec->rate) {
+#else
     for (i = 0; u->rates[i]; i++) {
         if (u->rates[i] == spec->rate) {
+#endif
             supported = true;
             break;
         }
@@ -1973,9 +1980,12 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
         goto fail;
     }
 
-#endif
+    u->supported_rates = pa_alsa_get_supported_rates(u->pcm_handle, ss.rate);
+    if (!u->supported_rates) {
+#else
     u->rates = pa_alsa_get_supported_rates(u->pcm_handle, ss.rate);
     if (!u->rates) {
+#endif
         pa_log_error("Failed to find any supported sample rates.");
         goto fail;
     }
@@ -2212,9 +2222,12 @@ static void userdata_free(struct userdata *u) {
     if (u->supported_formats)
         pa_xfree(u->supported_formats);
 
-#endif
+    if (u->supported_rates)
+        pa_xfree(u->supported_rates);
+#else
     if (u->rates)
         pa_xfree(u->rates);
+#endif
 
     reserve_done(u);
     monitor_done(u);