- struct action action = {
- .type = ACTION_TYPE_MAP_PORT_TO_COMP_IN_STREAM,
- .payload.map_port_to_comp_in_stream = {
- .stream = bt_get(notif_stream),
- .component = bt_get(iterator->upstream_component),
- .port = bt_get(iterator->upstream_port),
- },
- };
-
- add_action(iterator, &action);
- } else {
- if (stream_comp_cur_port != iterator->upstream_port) {
- /*
- * It looks like two different ports of the same
- * component are emitting notifications which
- * have references to the same stream. This is
- * bad: the API guarantees that it can never
- * happen.
- */
- BT_LOGW("Two different ports of the same component are emitting notifications which refer to the same stream: "
- "stream-addr=%p, stream-name=\"%s\", "
- "stream-comp-cur-port-addr=%p, "
- "stream-comp-cur-port-name=%p, "
- "iter-upstream-port-addr=%p, "
- "iter-upstream-port-name=%s",
- notif_stream,
- bt_ctf_stream_get_name(notif_stream),
- stream_comp_cur_port,
- bt_port_get_name(stream_comp_cur_port),
- iterator->upstream_port,
- bt_port_get_name(iterator->upstream_port));
- is_valid = BT_FALSE;
- goto end;
- }
-
- }
-
- stream_state = g_hash_table_lookup(iterator->stream_states,
- notif_stream);
- if (stream_state) {
- BT_LOGV("Stream state already exists: "
- "stream-addr=%p, stream-name=\"%s\", "
- "stream-state-addr=%p",
- notif_stream,
- bt_ctf_stream_get_name(notif_stream), stream_state);
-
- if (stream_state->is_ended) {
- /*
- * There's a new notification which has a
- * reference to a stream which, from this
- * iterator's point of view, is ended ("end of
- * stream" notification was returned). This is
- * bad: the API guarantees that it can never
- * happen.
- */
- BT_LOGW("Stream is already ended: "
- "stream-addr=%p, stream-name=\"%s\"",
- notif_stream,
- bt_ctf_stream_get_name(notif_stream));
- is_valid = BT_FALSE;
- goto end;
- }
-
- switch (notif->type) {
- case BT_NOTIFICATION_TYPE_STREAM_BEGIN:
- /*
- * We already have a stream state, which means
- * we already returned a "stream begin"
- * notification: this is an invalid duplicate.
- */
- BT_LOGW("Duplicate stream beginning notification: "
- "stream-addr=%p, stream-name=\"%s\"",
- notif_stream,
- bt_ctf_stream_get_name(notif_stream));
- is_valid = BT_FALSE;
- goto end;
- case BT_NOTIFICATION_TYPE_PACKET_BEGIN:
- if (notif_packet == stream_state->cur_packet) {
- /* Duplicate "packet begin" notification */
- BT_LOGW("Duplicate stream beginning notification: "
- "stream-addr=%p, stream-name=\"%s\", "
- "packet-addr=%p",
- notif_stream,
- bt_ctf_stream_get_name(notif_stream),
- notif_packet);
- is_valid = BT_FALSE;
- goto end;
- }
- break;
- default:
- break;
- }