sink, alsa-sink: Add conditions for selected sample rate 85/180185/2
authorSangchul Lee <sc11.lee@samsung.com>
Mon, 14 May 2018 07:29:19 +0000 (16:29 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Thu, 31 May 2018 07:15:04 +0000 (16:15 +0900)
[Version] 11.1-36
[Issue Type] Feature

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

index 0a79e6a..519c34c 100644 (file)
@@ -3,7 +3,7 @@
 Name:             pulseaudio
 Summary:          Improved Linux sound server
 Version:          11.1
-Release:          35
+Release:          36
 Group:            Multimedia/Audio
 License:          LGPL-2.1
 URL:              http://pulseaudio.org
index 582f106..402b441 100644 (file)
@@ -2391,6 +2391,9 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
         u->sink->set_port = sink_set_port_cb;
     u->sink->reconfigure = sink_reconfigure_cb;
     u->sink->userdata = u;
+#ifdef __TIZEN__
+    u->sink->supported_sample_rates = u->rates;
+#endif
 
     pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
     pa_sink_set_rtpoll(u->sink, u->rtpoll);
index dad0cc8..5d3445b 100644 (file)
@@ -338,6 +338,7 @@ pa_sink* pa_sink_new(
         s->alternate_sample_rate = s->core->alternate_sample_rate;
 #ifdef __TIZEN__
     s->avoid_resampling = data->avoid_resampling;
+    s->selected_sample_rate = s->default_sample_rate;
 #endif
 
     s->inputs = pa_idxset_new(NULL, NULL);
@@ -1554,13 +1555,21 @@ int pa_sink_reconfigure(pa_sink *s, pa_sample_spec *spec, bool passthrough) {
 
     /* We currently only try to reconfigure the sample rate */
 
+#ifdef __TIZEN__
+    if (!s->selected_sample_rate && !avoid_resampling && pa_sample_spec_equal(spec, &s->sample_spec))
+#else
     if (pa_sample_spec_equal(spec, &s->sample_spec))
+#endif
         return 0;
 
     if (!s->reconfigure)
         return -1;
 
+#ifdef __TIZEN__
+    if (!s->selected_sample_rate && PA_UNLIKELY(default_rate == alternate_rate && !passthrough && !avoid_resampling)) {
+#else
     if (PA_UNLIKELY(default_rate == alternate_rate && !passthrough && !avoid_resampling)) {
+#endif
         pa_log_debug("Default and alternate sample rates are the same, so there is no point in switching.");
         return -1;
     }
@@ -1583,6 +1592,10 @@ int pa_sink_reconfigure(pa_sink *s, pa_sample_spec *spec, bool passthrough) {
 
     desired_spec = s->sample_spec;
 
+#ifdef __TIZEN__
+    if (!avoid_resampling && s->selected_sample_rate)
+        default_rate = alternate_rate = s->selected_sample_rate;
+#endif
     if (passthrough) {
         /* We have to try to use the sink input rate */
         desired_spec.rate = spec->rate;
index 2d6c80d..07de5be 100644 (file)
@@ -85,6 +85,8 @@ struct pa_sink {
     uint32_t alternate_sample_rate;
 #ifdef __TIZEN__
     bool avoid_resampling:1;
+    uint32_t *supported_sample_rates;
+    uint32_t selected_sample_rate;
 #endif
 
     pa_idxset *inputs;