protocol-native: ignore invalid sink/source device name 33/281433/1 accepted/tizen_6.0_unified tizen_6.0 accepted/tizen/6.0/unified/20220921.073035 submit/tizen_6.0/20220919.073117
authorSeungbae Shin <seungbae.shin@samsung.com>
Thu, 18 Aug 2022 11:38:00 +0000 (20:38 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Mon, 19 Sep 2022 03:48:24 +0000 (12:48 +0900)
As Tizen module select the proper sink/source based on the framework policy,
explicit sink/source device request will not be accepted even it is a valid device.

This patch will ignore the requsted device which is even invalid one for keeping the consistency.

+ print error for validity macro

[Version] 13.0.30
[Issue Type] Exception

Change-Id: If795b6699af5f058cd0070b4d09cdf2d58726e9a

packaging/pulseaudio.spec
src/pulsecore/protocol-native.c

index 41e1791..bc7ecee 100644 (file)
@@ -3,7 +3,7 @@
 Name:             pulseaudio
 Summary:          Improved Linux sound server
 Version:          13.0
-Release:          29
+Release:          30
 Group:            Multimedia/Audio
 License:          LGPL-2.1
 URL:              http://pulseaudio.org
index acc74b4..a2c29d3 100644 (file)
@@ -1989,6 +1989,23 @@ static void protocol_error(pa_native_connection *c) {
     native_connection_unlink(c);
 }
 
+#ifdef __TIZEN__
+#define CHECK_VALIDITY(pstream, expression, tag, error) do { \
+if (!(expression)) { \
+    pa_log_error("%s", #expression);\
+    pa_pstream_send_error((pstream), (tag), (error)); \
+    return; \
+} \
+} while(0);
+
+#define CHECK_VALIDITY_GOTO(pstream, expression, tag, error, label) do { \
+if (!(expression)) { \
+    pa_log_error("%s", #expression);\
+    pa_pstream_send_error((pstream), (tag), (error)); \
+    goto label; \
+} \
+} while(0);
+#else /* __TIZEN__ */
 #define CHECK_VALIDITY(pstream, expression, tag, error) do { \
 if (!(expression)) { \
     pa_pstream_send_error((pstream), (tag), (error)); \
@@ -2002,6 +2019,7 @@ if (!(expression)) { \
     goto label; \
 } \
 } while(0);
+#endif /* __TIZEN__ */
 
 static pa_tagstruct *reply_new(uint32_t tag) {
     pa_tagstruct *reply;
@@ -2074,6 +2092,11 @@ static void command_create_playback_stream(pa_pdispatch *pd, uint32_t command, u
         goto finish;
     }
 
+#ifdef __TIZEN__
+    pa_log_info("name:%s, sink_index:%u, sink_name:%s, corked:%u, syncid:%u",
+                name, sink_index, sink_name, corked, syncid);
+#endif
+
     CHECK_VALIDITY_GOTO(c->pstream, c->authorized, tag, PA_ERR_ACCESS, finish);
     CHECK_VALIDITY_GOTO(c->pstream, !sink_name || pa_namereg_is_valid_name_or_wildcard(sink_name, PA_NAMEREG_SINK), tag, PA_ERR_INVALID, finish);
     CHECK_VALIDITY_GOTO(c->pstream, sink_index == PA_INVALID_INDEX || !sink_name, tag, PA_ERR_INVALID, finish);
@@ -2191,15 +2214,23 @@ static void command_create_playback_stream(pa_pdispatch *pd, uint32_t command, u
     if (sink_index != PA_INVALID_INDEX) {
 
         if (!(sink = pa_idxset_get_by_index(c->protocol->core->sinks, sink_index))) {
+#ifdef __TIZEN__
+            pa_log_warn("[NOENTITY] ingoring given sink index %u ...", sink_index);
+#else
             pa_pstream_send_error(c->pstream, tag, PA_ERR_NOENTITY);
             goto finish;
+#endif
         }
 
     } else if (sink_name) {
 
         if (!(sink = pa_namereg_get(c->protocol->core, sink_name, PA_NAMEREG_SINK))) {
+#ifdef __TIZEN__
+            pa_log_warn("[NOENTITY] ingoring given sink name %s ...", sink_name);
+#else
             pa_pstream_send_error(c->pstream, tag, PA_ERR_NOENTITY);
             goto finish;
+#endif
         }
     }
 
@@ -2425,6 +2456,11 @@ static void command_create_record_stream(pa_pdispatch *pd, uint32_t command, uin
         goto finish;
     }
 
+#ifdef __TIZEN__
+    pa_log_info("name:%s, source_index:%u, source_name:%s, corked:%u",
+                name, source_index, source_name, corked);
+#endif
+
     CHECK_VALIDITY_GOTO(c->pstream, c->authorized, tag, PA_ERR_ACCESS, finish);
     CHECK_VALIDITY_GOTO(c->pstream, !source_name || pa_namereg_is_valid_name_or_wildcard(source_name, PA_NAMEREG_SOURCE), tag, PA_ERR_INVALID, finish);
     CHECK_VALIDITY_GOTO(c->pstream, source_index == PA_INVALID_INDEX || !source_name, tag, PA_ERR_INVALID, finish);
@@ -2553,15 +2589,23 @@ static void command_create_record_stream(pa_pdispatch *pd, uint32_t command, uin
     if (source_index != PA_INVALID_INDEX) {
 
         if (!(source = pa_idxset_get_by_index(c->protocol->core->sources, source_index))) {
+#ifdef __TIZEN__
+            pa_log_warn("[NOENTITY] ingoring given source index %u ...", source_index);
+#else
             pa_pstream_send_error(c->pstream, tag, PA_ERR_NOENTITY);
             goto finish;
+#endif
         }
 
     } else if (source_name) {
 
         if (!(source = pa_namereg_get(c->protocol->core, source_name, PA_NAMEREG_SOURCE))) {
+#ifdef __TIZEN__
+            pa_log_warn("[NOENTITY] ingoring given source name %s ...", source_name);
+#else
             pa_pstream_send_error(c->pstream, tag, PA_ERR_NOENTITY);
             goto finish;
+#endif
         }
     }