Name: pulseaudio-modules-tizen
Summary: Pulseaudio modules for Tizen
-Version: 5.0.172
+Version: 5.0.173
Release: 0
Group: Multimedia/Audio
License: LGPL-2.1+
next_p++;
}
- strncpy(removed_param, next_p, DEVICE_PARAM_STRING_MAX);
+ pa_strlcpy(removed_param, next_p, DEVICE_PARAM_STRING_MAX);
if (device_string_p > params_p) {
prev_len = device_string_p - params_p;
if (params) {
pa_strbuf_printf(args_buf, "%s", params);
}
- strncpy(args, pa_strbuf_tostring_free(args_buf), DEVICE_PARAM_STRING_MAX);
+ pa_strlcpy(args, pa_strbuf_tostring_free(args_buf), DEVICE_PARAM_STRING_MAX);
} else {
return params;
}
if ((device_o = json_object_array_get_idx(device_array_o, device_type_idx)) && json_object_is_type(device_o, json_type_object)) {
json_object *device_prop_o;
const char *type = NULL;
- type_info = pa_xmalloc0(sizeof(struct device_type_info));
- if (json_object_object_get_ex(device_o, DEVICE_TYPE_PROP_DEVICE_TYPE, &device_prop_o) && json_object_is_type(device_prop_o, json_type_string)) {
- type = json_object_get_string(device_prop_o);
- pa_log_info("[ Device - %s ]", type);
- type_info->type = type;
- } else {
+ if (!json_object_object_get_ex(device_o, DEVICE_TYPE_PROP_DEVICE_TYPE, &device_prop_o) && json_object_is_type(device_prop_o, json_type_string)) {
pa_log_error("Get device type failed");
goto fail;
}
+ type = json_object_get_string(device_prop_o);
+ pa_log_info("[ Device - %s ]", type);
+
+ type_info = pa_xmalloc0(sizeof(struct device_type_info));
+ type_info->type = type;
if (json_object_object_get_ex(device_o, DEVICE_TYPE_PROP_PLAYBACK_DEVICES, &device_prop_o) && json_object_is_type(device_prop_o, json_type_object)) {
pa_log_info("Playback Devices");
pa_log_info("Send EOS signal for stream_idx(%d)", stream_idx);
- pa_assert_se(signal_msg = dbus_message_new_signal(SOUND_PLAYER_OBJECT_PATH, SOUND_PLAYER_INTERFACE, SOUND_PLAYER_SIGNAL_EOS));
+ pa_assert_se((signal_msg = dbus_message_new_signal(SOUND_PLAYER_OBJECT_PATH, SOUND_PLAYER_INTERFACE, SOUND_PLAYER_SIGNAL_EOS)));
pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_INT32, &stream_idx, DBUS_TYPE_INVALID));
pa_assert_se(dbus_connection_send(pa_dbus_connection_get(u->dbus_conn), signal_msg, NULL));
dbus_message_unref(signal_msg);
}
/* for non-blocking read */
- fcntl(u->fd, F_SETFL, O_NONBLOCK);
+ if (fcntl(u->fd, F_SETFL, O_NONBLOCK) == -1)
+ pa_log_warn("Setting non-block flag failed. errno=[%d][%s]", errno, pa_cstrerror(errno));
/* change access mode so group can use keytone pipe */
if (fchmod(u->fd, 0666) == -1)
struct userdata *u;
pa_sink_assert_ref(s);
- pa_assert_se(u = s->userdata);
+ pa_assert_se((u = s->userdata));
u->block_usec = pa_sink_get_requested_latency_within_thread(s);
struct userdata *u;
pa_assert(m);
- pa_assert_se(u = m->userdata);
+ pa_assert_se((u = m->userdata));
return pa_sink_linked_by(u->sink);
}
static int unsuspend(struct userdata *u) {
pa_sample_spec sample_spec;
int32_t ret;
+ size_t frame_size;
+
pa_assert(u);
pa_assert(!u->pcm_handle);
pa_log_info("Trying resume...");
+
sample_spec = u->source->sample_spec;
+ frame_size = pa_frame_size(&sample_spec);
+ if (frame_size == 0) {
+ pa_log_error("Unexpected frame size zero!");
+ goto fail;
+ }
+
ret = pa_hal_interface_pcm_open(u->hal_interface,
(void **)&u->pcm_handle,
DIRECTION_IN,
&sample_spec,
- u->frag_size / pa_frame_size(&sample_spec),
+ u->frag_size / frame_size,
u->nfrags);
if (ret) {
pa_log_error("Error opening PCM device %x", ret);
size_t nbytes;
pa_source_assert_ref(s);
- pa_assert_se(u = s->userdata);
+ pa_assert_se((u = s->userdata));
u->block_usec = pa_source_get_requested_latency_within_thread(s);
while (u->timestamp < now + u->block_usec) {
pa_memchunk chunk;
frame_size = pa_frame_size(&u->source->sample_spec);
+ if (frame_size == 0) {
+ pa_log_error("Unexpected frame size zero!");
+ break;
+ }
pa_hal_interface_pcm_available(u->hal_interface, u->pcm_handle, &avail);
if (avail == 0) {
struct userdata *u;
pa_assert(m);
- pa_assert_se(u = m->userdata);
+ pa_assert_se((u = m->userdata));
return pa_source_linked_by(u->source);
}
pa_assert(msg);
pa_assert(userdata);
- pa_assert_se(r = dbus_message_new_method_return(msg));
+ pa_assert_se((r = dbus_message_new_method_return(msg)));
pa_assert_se(dbus_message_append_args(r, DBUS_TYPE_STRING, &xml, DBUS_TYPE_INVALID));
if (r) {
pa_log_debug("direction[%s], type[%s], level[%d]", direction, volume_type, volume_level);
- pa_assert_se(signal_msg = dbus_message_new_signal(STREAM_MANAGER_OBJECT_PATH, STREAM_MANAGER_INTERFACE, STREAM_MANAGER_SIGNAL_NAME_VOLUME_CHANGED));
+ pa_assert_se((signal_msg = dbus_message_new_signal(STREAM_MANAGER_OBJECT_PATH, STREAM_MANAGER_INTERFACE, STREAM_MANAGER_SIGNAL_NAME_VOLUME_CHANGED)));
dbus_message_iter_init_append(signal_msg, &msg_iter);
dbus_message_iter_append_basic(&msg_iter, DBUS_TYPE_STRING, &direction);
pa_log_debug("name[%s], value[%d]", name, value);
- pa_assert_se(signal_msg = dbus_message_new_signal(STREAM_MANAGER_OBJECT_PATH, STREAM_MANAGER_INTERFACE, STREAM_MANAGER_SIGNAL_NAME_COMMAND));
+ pa_assert_se((signal_msg = dbus_message_new_signal(STREAM_MANAGER_OBJECT_PATH, STREAM_MANAGER_INTERFACE, STREAM_MANAGER_SIGNAL_NAME_COMMAND)));
dbus_message_iter_init_append(signal_msg, &msg_iter);
dbus_message_iter_append_basic(&msg_iter, DBUS_TYPE_STRING, &name);
pa_assert(m);
s = pa_idxset_get_by_index(stream_type == STREAM_SINK_INPUT ? m->core->sink_inputs : m->core->source_outputs, idx);
+ if (s == NULL) {
+ pa_log_error("failed to get stream...[%d]", idx);
+ return -1;
+ }
+
if (!(volume_type_str = pa_proplist_gets(GET_STREAM_PROPLIST(s, stream_type), PA_PROP_MEDIA_TIZEN_VOLUME_TYPE))) {
pa_log_debug("idx[%u] doesn't have volume type", idx);
return -1;
pa_log_debug("===========[END stream-map dump]===========");
}
+static void stream_info_free(stream_info *s) {
+ pa_assert(s);
+
+ if (s->idx_avail_in_devices)
+ pa_idxset_free(s->idx_avail_in_devices, NULL);
+ if (s->idx_avail_out_devices)
+ pa_idxset_free(s->idx_avail_out_devices, NULL);
+ if (s->idx_avail_frameworks)
+ pa_idxset_free(s->idx_avail_frameworks, NULL);
+
+ pa_xfree(s);
+}
+
static int init_stream_map(pa_stream_manager *m) {
volume_info *v;
stream_info *s;
json_object *out_device_o;
json_object *in_device_o;
json_object *framework_o;
- void *state = NULL;
pa_assert(m);
}
/* Latencies */
- m->latency_infos = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ m->latency_infos = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, pa_xfree);
if (json_object_object_get_ex(o, STREAM_MAP_LATENCIES, &array_o) && json_object_is_type(array_o, json_type_array)) {
array_length = json_object_array_length(array_o);
for (i = 0; i < array_length; i++) {
}
/* Volumes */
- m->volume_infos = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ m->volume_infos = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, pa_xfree);
if (json_object_object_get_ex(o, STREAM_MAP_VOLUMES, &array_o) && json_object_is_type(array_o, json_type_array)) {
array_length = json_object_array_length(array_o);
for (i = 0; i < array_length; i++) {
}
/* Streams */
- m->stream_infos = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ m->stream_infos = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t)stream_info_free);
if (json_object_object_get_ex(o, STREAM_MAP_STREAMS, &array_o) && json_object_is_type(array_o, json_type_array)) {
array_length = json_object_array_length(array_o);
for (i = 0; i < array_length; i++) {
return 0;
fail:
pa_log_error("failed to initialize stream-map");
- if (m->stream_infos) {
- PA_HASHMAP_FOREACH(s, m->stream_infos, state) {
- if (s->idx_avail_in_devices)
- pa_idxset_free(s->idx_avail_in_devices, NULL);
- if (s->idx_avail_out_devices)
- pa_idxset_free(s->idx_avail_out_devices, NULL);
- if (s->idx_avail_frameworks)
- pa_idxset_free(s->idx_avail_frameworks, NULL);
- pa_xfree(s);
- }
+
+ if (m->stream_infos)
pa_hashmap_free(m->stream_infos);
- }
- if (m->volume_infos) {
- PA_HASHMAP_FOREACH(v, m->volume_infos, state) {
- pa_xfree(v);
- }
+ if (m->volume_infos)
pa_hashmap_free(m->volume_infos);
- }
- if (m->latency_infos) {
- PA_HASHMAP_FOREACH(l, m->latency_infos, state) {
- pa_xfree(l);
- }
+ if (m->latency_infos)
pa_hashmap_free(m->latency_infos);
- }
+
return -1;
}
static void deinit_stream_map(pa_stream_manager *m) {
- stream_info *s = NULL;
- volume_info *v = NULL;
- latency_info *l = NULL;
- void *state = NULL;
-
pa_assert(m);
- if (m->stream_infos) {
- PA_HASHMAP_FOREACH(s, m->stream_infos, state) {
- if (s->idx_avail_in_devices)
- pa_idxset_free(s->idx_avail_in_devices, NULL);
- if (s->idx_avail_out_devices)
- pa_idxset_free(s->idx_avail_out_devices, NULL);
- if (s->idx_avail_frameworks)
- pa_idxset_free(s->idx_avail_frameworks, NULL);
- pa_xfree(s);
- }
+ if (m->stream_infos)
pa_hashmap_free(m->stream_infos);
- }
- if (m->volume_infos) {
- PA_HASHMAP_FOREACH(v, m->volume_infos, state) {
- pa_xfree(v);
- }
+ if (m->volume_infos)
pa_hashmap_free(m->volume_infos);
- }
- if (m->latency_infos) {
- PA_HASHMAP_FOREACH(l, m->latency_infos, state) {
- pa_xfree(l);
- }
+ if (m->latency_infos)
pa_hashmap_free(m->latency_infos);
- }
}
static bool check_name_to_skip(pa_stream_manager *m, process_command_type_t command, void *stream, stream_type_t type, bool is_new_data) {
}
const char* device_direction_to_string(dm_device_direction_t direction) {
- if (direction <= DM_DEVICE_DIRECTION_NONE || direction > DM_DEVICE_DIRECTION_BOTH) {
+ if (direction > DM_DEVICE_DIRECTION_BOTH) {
return NULL;
}