debug_fenter();
+ if (index < 0 || index >= FOCUS_HANDLE_MAX) {
+ debug_error("Invalid focus handle index [%d]", index);
+ return;
+ }
+
if (is_for_watching) {
filename = g_strdup_printf("/tmp/FOCUS.%d.%d.wch", g_focus_sound_handle[index].focus_tid, g_focus_sound_handle[index].handle);
} else {
debug_fenter();
+ if (index < 0 || index >= FOCUS_HANDLE_MAX) {
+ debug_error("Invalid focus handle index [%d]", index);
+ return;
+ }
+
if (g_focus_sound_handle[index].focus_fd < 0) {
debug_error("Close fail : index(%d)", index);
} else {
debug_fenter();
- h = &g_focus_sound_handle[index];
- if (h == NULL) {
- debug_error("g_focus_sound_handle[%d] is NULL", index);
+ if (index < 0 || index >= FOCUS_HANDLE_MAX) {
+ debug_error("Invalid focus handle index [%d]", index);
return false;
}
+ h = &g_focus_sound_handle[index];
+
if (h->focus_src && h->g_poll_fd) {
debug_log("g_source_remove_poll : fd(%d), event(0x%x)",
h->g_poll_fd->fd, h->g_poll_fd->events);
static void _focus_add_callback(int index, bool is_for_watching)
{
debug_fenter();
+
+ if (index < 0 || index >= FOCUS_HANDLE_MAX) {
+ debug_error("Invalid focus handle index [%d]", index);
+ return;
+ }
+
if (!is_for_watching) {
if (!_focus_add_sound_callback(index, g_focus_sound_handle[index].focus_fd,
(gushort)POLLIN | POLLPRI, _focus_callback_handler))
handle->handle, handle->mode, handle->policy, handle->volume_type, handle->gain_type,
handle->rate, handle->channels, ss->format, handle->stream_idx, handle->s, handle->source_type, handle_inout);
+ if (proplist)
+ pa_proplist_free(proplist);
+
return handle->handle;
fail:
static void handle_method_play_file_start(GDBusMethodInvocation* invocation)
{
gchar* filename = NULL;
- char *stream_type = NULL;
+ gchar *stream_type = NULL;
gint32 ret = MM_ERROR_NONE, slotid = 0;
gint32 tone = 0, repeat = 0, volume = 0, vol_config = 0, priority = 0;
gint32 session_type = 0, session_option = 0, pid = 0, handle_route =0, stream_index = 0;
ret = _MMSoundMgrIpcPlayFile(filename, tone, repeat, volume, vol_config, priority,
session_type, session_option, _get_sender_pid(invocation), handle_route, enable_session, &slotid, stream_type, stream_index);
+
send_reply:
if (ret == MM_ERROR_NONE) {
_method_call_return_value(invocation, g_variant_new("(i)", slotid));
_method_call_return_error(invocation, ret);
}
+ g_free(filename);
+ g_free(stream_type);
+
debug_fleave();
}
static void handle_method_play_file_start_with_stream_info(GDBusMethodInvocation* invocation)
{
gchar* filename = NULL;
- char *stream_type = NULL;
+ gchar *stream_type = NULL;
gint32 ret = MM_ERROR_NONE, slotid = 0;
gint32 repeat = 0, volume = 0, priority = 0, pid = 0, handle_route =0, stream_index = 0;
GVariant *params = NULL;
_method_call_return_error(invocation, ret);
}
+ g_free(filename);
+ g_free(stream_type);
+
debug_fleave();
}
{
int ret = MM_ERROR_NONE, slotid = 0;
int tone = 0, repeat = 0, volume = 0, vol_config = 0, session_type = 0, session_option = 0, pid = 0, stream_index = 0;
- char* stream_type = NULL;
+ gchar* stream_type = NULL;
gboolean enable_session = 0;
GVariant *params = NULL;
_method_call_return_error(invocation, ret);
}
+ g_free(stream_type);
debug_fleave();
}