Fix to release internal focus of voip session when getting back to another session... 50/125150/3
authorSangchul Lee <sc11.lee@samsung.com>
Fri, 14 Apr 2017 02:49:40 +0000 (11:49 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Fri, 14 Apr 2017 09:27:24 +0000 (18:27 +0900)
focus state watch callback will be called if the voip session is changed to another session

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

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

index 979f58b..dbe5cd9 100644 (file)
@@ -128,6 +128,8 @@ if (pthread_mutex_unlock(x_mutex)) { \
 #define DIRECTION_OUT_STR         "out"
 #define SOUND_TYPE_MASTER_STR     "master"
 
+#define EXT_INFO_VOIP_SESSION     "for voip session"
+
 typedef enum _sound_stream_direction {
        SOUND_STREAM_DIRECTION_OUTPUT = 1,
        SOUND_STREAM_DIRECTION_INPUT
index 062dfe9..d3d5116 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-sound-manager
 Summary:    Sound Manager library
-Version:    0.3.110
+Version:    0.3.111
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 8f5ebde..872453a 100644 (file)
@@ -675,37 +675,44 @@ int sound_manager_set_session_type(sound_session_type_e type)
                        ((new_session == SOUND_SESSION_TYPE_MEDIA) && (cur_session == MM_SESSION_TYPE_MEDIA_RECORD))) {
                        LOGI("already set type=%d, ret=0x%x", type, ret);
                        goto LEAVE;
-               } else {
-                       ret = mm_session_finish();
-                       if (ret != MM_ERROR_NONE)
-                               goto LEAVE;
+               }
+
+               ret = mm_session_finish();
+               if (ret != MM_ERROR_NONE)
+                       goto LEAVE;
 
-                       g_session_interrupt_cb_table.is_registered = 0;
-                       if (cur_session == MM_SESSION_TYPE_VOIP) {
-                               /* De-initialize regarding VoIP session */
-                               g_cached_session_mode = -1;
-                               g_cached_voip_device_id = -1;
-                               g_cached_voip_device_id2 = -1;
-                               if (g_voip_vstream_h) {
-                                       _stop_progress_virtual_stream(g_voip_vstream_h);
-                                       g_voip_vstream_h = NULL;
-                               }
-                               if (g_voip_ringtone_vstream_h) {
-                                       _stop_progress_virtual_stream(g_voip_ringtone_vstream_h);
-                                       g_voip_ringtone_vstream_h = NULL;
-                               }
-                               if (g_voip_stream_info) {
-                                       ret = _destroy_pa_connection_and_unregister_focus(g_voip_stream_info);
-                                       SM_SAFE_FREE(g_voip_stream_info);
-                                       if (ret != MM_ERROR_NONE)
-                                               goto LEAVE;
-                               }
-                               if (g_voip_ringtone_stream_info) {
-                                       ret = _destroy_pa_connection_and_unregister_focus(g_voip_ringtone_stream_info);
-                                       SM_SAFE_FREE(g_voip_ringtone_stream_info);
-                                       if (ret != MM_ERROR_NONE)
-                                               goto LEAVE;
-                               }
+               g_session_interrupt_cb_table.is_registered = 0;
+               if (cur_session == MM_SESSION_TYPE_VOIP) {
+                       /* De-initialize regarding VoIP session */
+                       g_cached_session_mode = -1;
+                       g_cached_voip_device_id = -1;
+                       g_cached_voip_device_id2 = -1;
+                       if (g_voip_vstream_h) {
+                               _stop_progress_virtual_stream(g_voip_vstream_h);
+                               g_voip_vstream_h = NULL;
+                       }
+                       if (g_voip_ringtone_vstream_h) {
+                               _stop_progress_virtual_stream(g_voip_ringtone_vstream_h);
+                               g_voip_ringtone_vstream_h = NULL;
+                       }
+                       if (g_voip_ringtone_stream_info) {
+                               if ((ret = mm_sound_release_focus(g_voip_ringtone_stream_info->index, g_voip_ringtone_stream_info->acquired_focus, EXT_INFO_VOIP_SESSION)))
+                                       LOGE("failed to release focus for ringtone-voip stream info, ret(0x%x)", ret);
+                       } else if (g_voip_stream_info) {
+                               if ((ret = mm_sound_release_focus(g_voip_stream_info->index, g_voip_stream_info->acquired_focus, EXT_INFO_VOIP_SESSION)))
+                                       LOGE("failed to release focus for voip stream info, ret(0x%x)", ret);
+                       }
+                       if (g_voip_stream_info) {
+                               ret = _destroy_pa_connection_and_unregister_focus(g_voip_stream_info);
+                               SM_SAFE_FREE(g_voip_stream_info);
+                               if (ret != MM_ERROR_NONE)
+                                       goto LEAVE;
+                       }
+                       if (g_voip_ringtone_stream_info) {
+                               ret = _destroy_pa_connection_and_unregister_focus(g_voip_ringtone_stream_info);
+                               SM_SAFE_FREE(g_voip_ringtone_stream_info);
+                               if (ret != MM_ERROR_NONE)
+                                       goto LEAVE;
                        }
                }
        }
index a35ba58..ce8139e 100644 (file)
@@ -33,7 +33,6 @@
 #define PA_STREAM_MANAGER_METHOD_NAME_UPDATE_FOCUS_STATUS       "UpdateFocusStatus"
 #define VCONF_PATH_PREFIX_VOLUME                                "file/private/sound/volume/"
 #define VCONF_PATH_MAX                                          64
-#define EXT_INFO_VOIP_SESSION                                   "for voip session"
 
 #define CHECK_AND_SET_DEVICE(x_dst_device1, x_dst_device2, x_src_device) \
 do { \