protocol-native: ignore invalid sink/source device name 62/279862/6 accepted/tizen_7.0_unified_hotfix tizen_7.0_hotfix accepted/tizen/7.0/unified/20221110.055750 accepted/tizen/7.0/unified/hotfix/20221116.111308 accepted/tizen/unified/20220919.090118 tizen_7.0_m2_release
authorSeungbae Shin <seungbae.shin@samsung.com>
Thu, 18 Aug 2022 11:38:00 +0000 (20:38 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Thu, 15 Sep 2022 05:42:01 +0000 (14:42 +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] 15.0-10
[Issue Type] Exception

Change-Id: If795b6699af5f058cd0070b4d09cdf2d58726e9a

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

index 206d66d..de5399d 100644 (file)
@@ -4,7 +4,7 @@
 Name:             pulseaudio
 Summary:          Improved Linux sound server
 Version:          15.0
-Release:          9
+Release:          10
 Group:            Multimedia/Audio
 License:          LGPL-2.1
 URL:              http://pulseaudio.org
index 4ce4093..d859791 100644 (file)
@@ -1990,6 +1990,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)); \
@@ -2003,6 +2020,7 @@ if (!(expression)) { \
     goto label; \
 } \
 } while(0);
+#endif /* __TIZEN__ */
 
 static pa_tagstruct *reply_new(uint32_t tag) {
     pa_tagstruct *reply;
@@ -2075,6 +2093,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);
@@ -2192,15 +2215,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
         }
     }
 
@@ -2426,6 +2457,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);
@@ -2554,15 +2590,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
         }
     }