diff --git a/spa/plugins/alsa/alsa-seq.c b/spa/plugins/alsa/alsa-seq.c index ec669045f..f5065999e 100644 --- a/spa/plugins/alsa/alsa-seq.c +++ b/spa/plugins/alsa/alsa-seq.c @@ -679,7 +679,7 @@ static int update_time(struct seq_state *state, uint64_t nsec, bool follower) { snd_seq_queue_status_t *status; const snd_seq_real_time_t* queue_time; - uint64_t queue_real; + uint64_t queue_real, position; double err, corr; 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->duration = clock->duration; state->threshold = state->duration; + position = clock->position; + } else { + position = 0; } /* 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) { state->queue_base = nsec - queue_real; - state->clock_base = state->position->clock.position; + state->clock_base = position; } 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; 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); - if (state->following) { + if (state->following && state->position) { update_time(state, state->position->clock.nsec, true); res |= process_read(state); } diff --git a/src/examples/media-session/policy-ep.c b/src/examples/media-session/policy-ep.c index dbb9bd782..76d4f3948 100644 --- a/src/examples/media-session/policy-ep.c +++ b/src/examples/media-session/policy-ep.c @@ -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 (strcmp(obj->type, PW_TYPE_INTERFACE_Endpoint) == 0) { - peer = sm_object_get_data(obj, SESSION_KEY); - goto do_link; + if ((peer = sm_object_get_data(obj, SESSION_KEY)) != NULL) + goto do_link; } else if (strcmp(obj->type, PW_TYPE_INTERFACE_Node) == 0) { node = (struct sm_node*)obj; diff --git a/src/examples/media-session/stream-endpoint.c b/src/examples/media-session/stream-endpoint.c index 1196d473f..7d9147dcd 100644 --- a/src/examples/media-session/stream-endpoint.c +++ b/src/examples/media-session/stream-endpoint.c @@ -490,7 +490,8 @@ static void object_update(void *data) node->obj->obj.avail & SM_OBJECT_CHANGE_MASK_PROPERTIES) 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); } diff --git a/src/gst/gstpipewiredeviceprovider.c b/src/gst/gstpipewiredeviceprovider.c index a4a6b50a2..e0b8d8550 100644 --- a/src/gst/gstpipewiredeviceprovider.c +++ b/src/gst/gstpipewiredeviceprovider.c @@ -239,11 +239,10 @@ new_node (GstPipeWireDeviceProvider *self, struct node_data *data) gst_structure_set (props, item->key, G_TYPE_STRING, item->value, NULL); klass = spa_dict_lookup (info->props, PW_KEY_MEDIA_CLASS); + name = spa_dict_lookup (info->props, PW_KEY_NODE_DESCRIPTION); } if (klass == NULL) klass = "unknown/unknown"; - - name = spa_dict_lookup (info->props, PW_KEY_NODE_DESCRIPTION); if (name == NULL) name = "unknown"; diff --git a/src/modules/module-protocol-native/v0/protocol-native.c b/src/modules/module-protocol-native/v0/protocol-native.c index 6d560e10c..76b8f450d 100644 --- a/src/modules/module-protocol-native/v0/protocol-native.c +++ b/src/modules/module-protocol-native/v0/protocol-native.c @@ -806,17 +806,19 @@ static void registry_marshal_global(void *object, uint32_t id, uint32_t permissi n_items = props ? props->n_items : 0; parent_id = 0; - if (strcmp(type, PW_TYPE_INTERFACE_Port) == 0) { - if ((str = spa_dict_lookup(props, "node.id")) != NULL) - parent_id = atoi(str); - } else if (strcmp(type, PW_TYPE_INTERFACE_Node) == 0) { - if ((str = spa_dict_lookup(props, "device.id")) != NULL) - parent_id = atoi(str); - } else if (strcmp(type, PW_TYPE_INTERFACE_Client) == 0 || - strcmp(type, PW_TYPE_INTERFACE_Device) == 0 || - strcmp(type, PW_TYPE_INTERFACE_Factory) == 0) { - if ((str = spa_dict_lookup(props, "module.id")) != NULL) - parent_id = atoi(str); + if (props) { + if (strcmp(type, PW_TYPE_INTERFACE_Port) == 0) { + if ((str = spa_dict_lookup(props, "node.id")) != NULL) + parent_id = atoi(str); + } else if (strcmp(type, PW_TYPE_INTERFACE_Node) == 0) { + if ((str = spa_dict_lookup(props, "device.id")) != NULL) + parent_id = atoi(str); + } else if (strcmp(type, PW_TYPE_INTERFACE_Client) == 0 || + strcmp(type, PW_TYPE_INTERFACE_Device) == 0 || + strcmp(type, PW_TYPE_INTERFACE_Factory) == 0) { + if ((str = spa_dict_lookup(props, "module.id")) != NULL) + parent_id = atoi(str); + } } version = 0;