stream-manager: Add conditions to skip streams that are not running and not linked 67/119267/1
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 16 Mar 2017 07:01:58 +0000 (16:01 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Thu, 16 Mar 2017 07:24:43 +0000 (16:24 +0900)
Add conditions in update_the_highest_priority_stream() to skip streams not running
and not linked. Unsetting PA_PROP_MEDIA_ROLE_PRIORITY from a stream that can cause
unwanted behavior is also removed.

[Version] 5.0.140
[Profile] Common
[Issue Type] Bug fix

Change-Id: I2eecac7d4ea358705dd4be0273b2ba7128c354ae
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/pulseaudio-modules-tizen.spec
src/stream-manager-priv.h
src/stream-manager.c

index 58bd75b..e6b9fe2 100644 (file)
@@ -1,6 +1,6 @@
 Name:             pulseaudio-modules-tizen
 Summary:          Pulseaudio modules for Tizen
-Version:          5.0.139
+Version:          5.0.140
 Release:          0
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
index 6712b18..00ac180 100644 (file)
@@ -63,6 +63,9 @@ typedef enum _stream_direction {
 #define GET_FOCUS_STATUS(focus, type) \
       (type == STREAM_SINK_INPUT ? (focus & STREAM_FOCUS_ACQUIRED_PLAYBACK) : (focus & STREAM_FOCUS_ACQUIRED_CAPTURE))
 
+#define CHECK_STREAM_UNLINKED(stream, type) \
+      (type == STREAM_SINK_INPUT ? ((pa_sink_input*)stream)->unlinked : ((pa_source_output*)stream)->unlinked)
+
 #define CHECK_STREAM_RUNNING(stream, type) \
       (type == STREAM_SINK_INPUT ? ((pa_sink_input*)stream)->state == PA_SINK_INPUT_RUNNING : ((pa_source_output*)stream)->state == PA_SOURCE_OUTPUT_RUNNING)
 
index 15fa8d5..d1407c1 100644 (file)
@@ -2460,6 +2460,8 @@ static bool update_the_highest_priority_stream(pa_stream_manager *m, process_com
             PA_IDXSET_FOREACH(i, streams, idx) {
                 if (command == PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_ENDED && i == mine)
                     continue;
+                if (!CHECK_STREAM_RUNNING(i, type) || CHECK_STREAM_UNLINKED(i, type))
+                    continue;
                 if (!(_role = pa_proplist_gets(GET_STREAM_PROPLIST(i, type), PA_PROP_MEDIA_ROLE))) {
                     pa_log_error("failed to pa_proplist_gets() for role");
                     continue;
@@ -3158,7 +3160,6 @@ static process_stream_result_t process_stream(pa_stream_manager *m, void *stream
                 goto finish;
             }
 
-            pa_proplist_unset(GET_STREAM_PROPLIST(stream, type), PA_PROP_MEDIA_ROLE_PRIORITY);
             ret = update_the_highest_priority_stream(m, command, stream, type, role, is_new_data, &need_update);
             if (ret == false) {
                 pa_log_error("could not update the highest priority stream");