Adjust timing to update focus status in _focus_state_change_callback() 82/120182/2
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 22 Mar 2017 04:52:56 +0000 (13:52 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 22 Mar 2017 05:01:36 +0000 (14:01 +0900)
In case of acquiring focus, request to update the focus status to change
audio routing path first then invoke user callback.

[Version] 0.3.105
[Profile] Common
[Issue Type] Enhancement

Change-Id: I4335bde53d740253697c9508867fb608891192e7
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/capi-media-sound-manager.spec
src/sound_manager_private.c

index eeddec6edd4cc1e92aa5b7caf31b1a7db19ad61e..1d195765b32aecc68142ccfcde53382e1454f27a 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-sound-manager
 Summary:    Sound Manager library
-Version:    0.3.104
+Version:    0.3.105
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 5b35dd59badbc1b4410f580d6a32ae0dd11d8d3a..bf0b868c2a676e877a81d5807fa946cca8e56bcd 100644 (file)
@@ -575,11 +575,16 @@ void _focus_state_change_callback(int index, mm_sound_focus_type_e focus_type, m
        else if (state == FOCUS_IS_ACQUIRED)
                stream_info->acquired_focus |= focus_type;
 
+       if (state == FOCUS_IS_ACQUIRED)
+               _update_focus_status(stream_info->index, (unsigned int)stream_info->acquired_focus);
+
        LOGI("[FOCUS USER CALLBACK(%p) START]", stream_info->user_cb);
        stream_info->user_cb((sound_stream_info_h)stream_info, focus_type, state, change_reason,
                                                option, extra_info, stream_info->user_data);
        LOGI("[FOCUS USER CALLBACK(%p) END]", stream_info->user_cb);
-       _update_focus_status(stream_info->index, (unsigned int)stream_info->acquired_focus);
+
+       if (state == FOCUS_IS_RELEASED)
+               _update_focus_status(stream_info->index, (unsigned int)stream_info->acquired_focus);
 
 LEAVE:
        LOGI("<< leave");