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 58bd75bc59408ea2325614b4c32723ce2f12f5f2..e6b9fe2daaa7777635ab7aeb432e950a657cd579 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 6712b1810644069661f0325ec00cda1ac402db56..00ac180acb21f384f51597c1e532947b4d2b5c26 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 15fa8d56de6dbf6c57fa43eb29dbc24c620fd737..d1407c124a3ce9eb76f37bd418371b19e20e4f12 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");