mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
avoid following NULL pointers
This commit is contained in:
parent
a898f21c87
commit
a19bab4b16
5 changed files with 25 additions and 20 deletions
|
|
@ -679,7 +679,7 @@ static int update_time(struct seq_state *state, uint64_t nsec, bool follower)
|
||||||
{
|
{
|
||||||
snd_seq_queue_status_t *status;
|
snd_seq_queue_status_t *status;
|
||||||
const snd_seq_real_time_t* queue_time;
|
const snd_seq_real_time_t* queue_time;
|
||||||
uint64_t queue_real;
|
uint64_t queue_real, position;
|
||||||
double err, corr;
|
double err, corr;
|
||||||
uint64_t clock_elapsed, queue_elapsed;
|
uint64_t clock_elapsed, queue_elapsed;
|
||||||
|
|
||||||
|
|
@ -688,6 +688,9 @@ static int update_time(struct seq_state *state, uint64_t nsec, bool follower)
|
||||||
state->rate = clock->rate;
|
state->rate = clock->rate;
|
||||||
state->duration = clock->duration;
|
state->duration = clock->duration;
|
||||||
state->threshold = state->duration;
|
state->threshold = state->duration;
|
||||||
|
position = clock->position;
|
||||||
|
} else {
|
||||||
|
position = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* take queue time */
|
/* take queue time */
|
||||||
|
|
@ -698,12 +701,12 @@ static int update_time(struct seq_state *state, uint64_t nsec, bool follower)
|
||||||
|
|
||||||
if (state->queue_base == 0) {
|
if (state->queue_base == 0) {
|
||||||
state->queue_base = nsec - queue_real;
|
state->queue_base = nsec - queue_real;
|
||||||
state->clock_base = state->position->clock.position;
|
state->clock_base = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
corr = 1.0 - (state->z2 + state->z3);
|
corr = 1.0 - (state->z2 + state->z3);
|
||||||
|
|
||||||
clock_elapsed = state->position->clock.position - state->clock_base;
|
clock_elapsed = position - state->clock_base;
|
||||||
state->queue_time = nsec - state->queue_base;
|
state->queue_time = nsec - state->queue_base;
|
||||||
queue_elapsed = NSEC_TO_CLOCK(state->clock, state->queue_time) / corr;
|
queue_elapsed = NSEC_TO_CLOCK(state->clock, state->queue_time) / corr;
|
||||||
|
|
||||||
|
|
@ -754,7 +757,7 @@ int spa_alsa_seq_process(struct seq_state *state)
|
||||||
|
|
||||||
res = process_recycle(state);
|
res = process_recycle(state);
|
||||||
|
|
||||||
if (state->following) {
|
if (state->following && state->position) {
|
||||||
update_time(state, state->position->clock.nsec, true);
|
update_time(state, state->position->clock.nsec, true);
|
||||||
res |= process_read(state);
|
res |= process_read(state);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -430,8 +430,8 @@ static int rescan_endpoint(struct impl *impl, struct endpoint *ep)
|
||||||
|
|
||||||
if ((obj = sm_media_session_find_object(impl->session, path_id)) != NULL) {
|
if ((obj = sm_media_session_find_object(impl->session, path_id)) != NULL) {
|
||||||
if (strcmp(obj->type, PW_TYPE_INTERFACE_Endpoint) == 0) {
|
if (strcmp(obj->type, PW_TYPE_INTERFACE_Endpoint) == 0) {
|
||||||
peer = sm_object_get_data(obj, SESSION_KEY);
|
if ((peer = sm_object_get_data(obj, SESSION_KEY)) != NULL)
|
||||||
goto do_link;
|
goto do_link;
|
||||||
}
|
}
|
||||||
else if (strcmp(obj->type, PW_TYPE_INTERFACE_Node) == 0) {
|
else if (strcmp(obj->type, PW_TYPE_INTERFACE_Node) == 0) {
|
||||||
node = (struct sm_node*)obj;
|
node = (struct sm_node*)obj;
|
||||||
|
|
|
||||||
|
|
@ -490,7 +490,8 @@ static void object_update(void *data)
|
||||||
node->obj->obj.avail & SM_OBJECT_CHANGE_MASK_PROPERTIES)
|
node->obj->obj.avail & SM_OBJECT_CHANGE_MASK_PROPERTIES)
|
||||||
node->endpoint = create_endpoint(node);
|
node->endpoint = create_endpoint(node);
|
||||||
|
|
||||||
if (node->obj->obj.changed & SM_NODE_CHANGE_MASK_PARAMS)
|
if (node->endpoint &&
|
||||||
|
node->obj->obj.changed & SM_NODE_CHANGE_MASK_PARAMS)
|
||||||
update_params(node->endpoint);
|
update_params(node->endpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -239,11 +239,10 @@ new_node (GstPipeWireDeviceProvider *self, struct node_data *data)
|
||||||
gst_structure_set (props, item->key, G_TYPE_STRING, item->value, NULL);
|
gst_structure_set (props, item->key, G_TYPE_STRING, item->value, NULL);
|
||||||
|
|
||||||
klass = spa_dict_lookup (info->props, PW_KEY_MEDIA_CLASS);
|
klass = spa_dict_lookup (info->props, PW_KEY_MEDIA_CLASS);
|
||||||
|
name = spa_dict_lookup (info->props, PW_KEY_NODE_DESCRIPTION);
|
||||||
}
|
}
|
||||||
if (klass == NULL)
|
if (klass == NULL)
|
||||||
klass = "unknown/unknown";
|
klass = "unknown/unknown";
|
||||||
|
|
||||||
name = spa_dict_lookup (info->props, PW_KEY_NODE_DESCRIPTION);
|
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
name = "unknown";
|
name = "unknown";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -806,17 +806,19 @@ static void registry_marshal_global(void *object, uint32_t id, uint32_t permissi
|
||||||
n_items = props ? props->n_items : 0;
|
n_items = props ? props->n_items : 0;
|
||||||
|
|
||||||
parent_id = 0;
|
parent_id = 0;
|
||||||
if (strcmp(type, PW_TYPE_INTERFACE_Port) == 0) {
|
if (props) {
|
||||||
if ((str = spa_dict_lookup(props, "node.id")) != NULL)
|
if (strcmp(type, PW_TYPE_INTERFACE_Port) == 0) {
|
||||||
parent_id = atoi(str);
|
if ((str = spa_dict_lookup(props, "node.id")) != NULL)
|
||||||
} else if (strcmp(type, PW_TYPE_INTERFACE_Node) == 0) {
|
parent_id = atoi(str);
|
||||||
if ((str = spa_dict_lookup(props, "device.id")) != NULL)
|
} else if (strcmp(type, PW_TYPE_INTERFACE_Node) == 0) {
|
||||||
parent_id = atoi(str);
|
if ((str = spa_dict_lookup(props, "device.id")) != NULL)
|
||||||
} else if (strcmp(type, PW_TYPE_INTERFACE_Client) == 0 ||
|
parent_id = atoi(str);
|
||||||
strcmp(type, PW_TYPE_INTERFACE_Device) == 0 ||
|
} else if (strcmp(type, PW_TYPE_INTERFACE_Client) == 0 ||
|
||||||
strcmp(type, PW_TYPE_INTERFACE_Factory) == 0) {
|
strcmp(type, PW_TYPE_INTERFACE_Device) == 0 ||
|
||||||
if ((str = spa_dict_lookup(props, "module.id")) != NULL)
|
strcmp(type, PW_TYPE_INTERFACE_Factory) == 0) {
|
||||||
parent_id = atoi(str);
|
if ((str = spa_dict_lookup(props, "module.id")) != NULL)
|
||||||
|
parent_id = atoi(str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
version = 0;
|
version = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue