Some codes that check validation of arguments are also added.
[Version] 0.10.114
[Profile] Common
[Issue Type] Enhancement
Change-Id: Ie286d59afe7c98bb5f0c7774b19a660dedc4a057
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
debug_fenter();
- if (focus_type == FOCUS_TYPE_BOTH) /* focus_type should be "playback" or "capture" */
- return MM_ERROR_INVALID_ARGUMENT;
- if (!stream_type)
+ if (!stream_type || !option)
return MM_ERROR_INVALID_ARGUMENT;
MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(&g_focus_node_list_mutex, MM_ERROR_SOUND_INTERNAL);
if (!(node = (focus_node_t *)list->data))
continue;
if (!node->is_for_watch && (node->status & focus_type)) {
- debug_msg("found a node : request_focus_type(%d), stream_type(%s)/ext info(%s) of acquired focus\n", focus_type, node->stream_type, node->ext_info);
+ /* In case of FOCUS_TYPE_BOTH, we use index for FOCUS_TYPE_PLAYBACK's forcedly.
+ * It is because this function can not return both index of option, ext_info results
+ * via out-parameter. This case is only used in framework internally for session
+ * backward compatibilty. */
+ int index = (focus_type == FOCUS_TYPE_BOTH) ? FOCUS_TYPE_PLAYBACK - 1 : focus_type - 1;
+
+ debug_msg("found a node : request_focus_type(%d), stream_type(%s)/ext info(%s) of acquired focus\n",
+ focus_type, node->stream_type, node->ext_info[index]);
+
*stream_type = node->stream_type;
- *option = node->option[focus_type-1];
+ *option = node->option[index];
if (ext_info)
- *ext_info = node->ext_info[focus_type-1];
+ *ext_info = node->ext_info[index];
ret = MM_ERROR_NONE;
break;
}
ret = __mm_sound_mgr_focus_ipc_get_acquired_focus_stream_type(focus_type, &stream_type, &option, &ext_info);
send_reply:
- if (ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE)
_method_call_return_value(invocation, g_variant_new("(sis)", stream_type, option, ext_info));
- } else {
+ else
_method_call_return_error(invocation, ret);
- }
debug_fleave();
}
char *stream_type_str = NULL;
char *ext_info_str = NULL;
- if (!stream_type)
+ if (!stream_type || !option)
return MM_ERROR_INVALID_ARGUMENT;
ret = mm_sound_mgr_focus_get_stream_type_of_acquired_focus(focus_type, &stream_type_str, option, &ext_info_str);
int mm_sound_client_get_acquired_focus_stream_type(int focus_type, char **stream_type, int *option, char **ext_info)
{
int ret = MM_ERROR_NONE;
- char *ext_str = NULL;
+ char *stream_type_str = NULL;
+ char *ext_info_str = NULL;
debug_fenter();
- ret = mm_sound_proxy_get_acquired_focus_stream_type(focus_type, stream_type, option, &ext_str);
+ ret = mm_sound_proxy_get_acquired_focus_stream_type(focus_type, &stream_type_str, option, &ext_info_str);
if (ret == MM_ERROR_NONE) {
debug_msg("[Client] Success to get stream type of acquired focus, stream_type(%s), ext_info(%s)\n",
- *stream_type, ext_str);
- *ext_info = strdup(ext_str);
- g_free(ext_str);
+ stream_type_str, ext_info_str);
+ *stream_type = strdup(stream_type_str);
+ *ext_info = strdup(ext_info_str);
+ g_free(stream_type_str);
+ g_free(ext_info_str);
} else {
debug_error("[Client] Error occurred : 0x%x \n",ret);
}
Name: libmm-sound
Summary: MMSound Package contains client lib and sound_server binary
-Version: 0.10.113
+Version: 0.10.114
Release: 0
Group: System/Libraries
License: Apache-2.0