milan-avb: rework mrp join/begin:

* join/begin mrp protocol for attributes of mvrp and msrp within stream_activate.
 * Creation of the attribute done on stream creation during es_buidler
This commit is contained in:
hackerman-kl 2026-03-15 10:22:48 +01:00 committed by Wim Taymans
parent 0309d598a1
commit 2746898e9a
12 changed files with 199 additions and 121 deletions

View file

@ -81,7 +81,10 @@ struct aecp_aem_lock_state {
struct aecp_aem_avb_interface_state { struct aecp_aem_avb_interface_state {
struct avb_aem_desc_avb_interface desc; struct avb_aem_desc_avb_interface desc;
struct avb_msrp_attribute *domain_attr;
struct avb_msrp_attribute domain_attr;
struct avb_mvrp_attribute vlan_attr;
}; };
@ -130,7 +133,10 @@ struct aecp_aem_stream_input_counters {
struct stream_common { struct stream_common {
struct stream stream; struct stream stream;
struct avb_msrp_attribute *stream_attr;
struct avb_msrp_attribute lstream_attr;
struct avb_msrp_attribute tastream_attr;
struct avb_msrp_attribute tfstream_attr;
}; };
struct aecp_aem_stream_input_state { struct aecp_aem_stream_input_state {
@ -138,6 +144,7 @@ struct aecp_aem_stream_input_state {
struct aecp_aem_stream_input_counters counters; struct aecp_aem_stream_input_counters counters;
struct stream_common common; struct stream_common common;
struct avb_mvrp_attribute mvrp_attr;
}; };
struct stream_input_saved_binding_param { struct stream_input_saved_binding_param {

View file

@ -83,6 +83,7 @@ static struct descriptor *es_buidler_desc_stream_general_prepare(struct server *
pstream_input = desc->ptr; pstream_input = desc->ptr;
stream = &pstream_input->common.stream; stream = &pstream_input->common.stream;
direction = SPA_DIRECTION_INPUT; direction = SPA_DIRECTION_INPUT;
break; break;
case AVB_AEM_DESC_STREAM_OUTPUT: case AVB_AEM_DESC_STREAM_OUTPUT:
struct aecp_aem_stream_output_state *pstream_output; struct aecp_aem_stream_output_state *pstream_output;

View file

@ -16,7 +16,7 @@
static const uint8_t msrp_mac[6] = AVB_MSRP_MAC; static const uint8_t msrp_mac[6] = AVB_MSRP_MAC;
struct attr { struct attr {
struct avb_msrp_attribute attr; struct avb_msrp_attribute *attr;
struct msrp *msrp; struct msrp *msrp;
struct spa_hook listener; struct spa_hook listener;
struct spa_list link; struct spa_list link;
@ -53,8 +53,17 @@ static void debug_msrp_talker(const struct avb_packet_msrp_talker *t)
static void notify_talker(struct msrp *msrp, uint64_t now, struct attr *attr, uint8_t notify) static void notify_talker(struct msrp *msrp, uint64_t now, struct attr *attr, uint8_t notify)
{ {
pw_log_info("> notify talker: %s", avb_mrp_notify_name(notify)); pw_log_info("> notify talker advertise: %s", avb_mrp_notify_name(notify));
debug_msrp_talker(&attr->attr.attr.talker); if (msrp->server->avb_mode == AVB_MODE_MILAN_V12) {
}
}
static void notify_talker_failed(struct msrp *msrp, uint64_t now, struct attr *attr, uint8_t notify)
{
pw_log_info("> notify talker failed: %s", avb_mrp_notify_name(notify));
if (msrp->server->avb_mode == AVB_MODE_MILAN_V12) {
}
} }
static int process_talker(struct msrp *msrp, uint64_t now, uint8_t attr_type, static int process_talker(struct msrp *msrp, uint64_t now, uint8_t attr_type,
@ -63,10 +72,10 @@ static int process_talker(struct msrp *msrp, uint64_t now, uint8_t attr_type,
const struct avb_packet_msrp_talker *t = m; const struct avb_packet_msrp_talker *t = m;
struct attr *a; struct attr *a;
spa_list_for_each(a, &msrp->attributes, link) spa_list_for_each(a, &msrp->attributes, link)
if (a->attr.type == attr_type && if (a->attr->type == attr_type &&
a->attr.attr.talker.stream_id == t->stream_id) { a->attr->attr.talker.stream_id == t->stream_id) {
a->attr.attr.talker = *t; a->attr->attr.talker = *t;
avb_mrp_attribute_rx_event(a->attr.mrp, now, event); avb_mrp_attribute_rx_event(a->attr->mrp, now, event);
} }
return 0; return 0;
} }
@ -88,10 +97,10 @@ static int encode_talker(struct msrp *msrp, struct attr *a, void *m)
AVB_MRP_VECTOR_SET_NUM_VALUES(v, 1); AVB_MRP_VECTOR_SET_NUM_VALUES(v, 1);
t = (struct avb_packet_msrp_talker *)v->first_value; t = (struct avb_packet_msrp_talker *)v->first_value;
*t = a->attr.attr.talker; *t = a->attr->attr.talker;
ev = SPA_PTROFF(t, sizeof(*t), uint8_t); ev = SPA_PTROFF(t, sizeof(*t), uint8_t);
*ev = (a->attr.mrp->pending_send - 1) * 6 * 6; *ev = (a->attr->mrp->pending_send - 1) * 6 * 6;
f = SPA_PTROFF(ev, sizeof(*ev), struct avb_packet_mrp_footer); f = SPA_PTROFF(ev, sizeof(*ev), struct avb_packet_mrp_footer);
f->end_mark = 0; f->end_mark = 0;
@ -118,9 +127,9 @@ static int process_talker_fail(struct msrp *msrp, uint64_t now, uint8_t attr_typ
debug_msrp_talker_fail(t); debug_msrp_talker_fail(t);
spa_list_for_each(a, &msrp->attributes, link) spa_list_for_each(a, &msrp->attributes, link)
if (a->attr.type == attr_type && if (a->attr->type == attr_type &&
a->attr.attr.talker_fail.talker.stream_id == t->talker.stream_id) a->attr->attr.talker_fail.talker.stream_id == t->talker.stream_id)
avb_mrp_attribute_rx_event(a->attr.mrp, now, event); avb_mrp_attribute_rx_event(a->attr->mrp, now, event);
return 0; return 0;
} }
@ -135,7 +144,8 @@ static void debug_msrp_listener(const struct avb_packet_msrp_listener *l, uint8_
static void notify_listener(struct msrp *msrp, uint64_t now, struct attr *attr, uint8_t notify) static void notify_listener(struct msrp *msrp, uint64_t now, struct attr *attr, uint8_t notify)
{ {
pw_log_info("> notify listener: %s", avb_mrp_notify_name(notify)); pw_log_info("> notify listener: %s", avb_mrp_notify_name(notify));
debug_msrp_listener(&attr->attr.attr.listener, attr->attr.param); debug_msrp_listener(&attr->attr->attr.listener, attr->attr->param);
} }
static int process_listener(struct msrp *msrp, uint64_t now, uint8_t attr_type, static int process_listener(struct msrp *msrp, uint64_t now, uint8_t attr_type,
@ -144,9 +154,9 @@ static int process_listener(struct msrp *msrp, uint64_t now, uint8_t attr_type,
const struct avb_packet_msrp_listener *l = m; const struct avb_packet_msrp_listener *l = m;
struct attr *a; struct attr *a;
spa_list_for_each(a, &msrp->attributes, link) spa_list_for_each(a, &msrp->attributes, link)
if (a->attr.type == attr_type && if (a->attr->type == attr_type &&
a->attr.attr.listener.stream_id == l->stream_id) a->attr->attr.listener.stream_id == l->stream_id)
avb_mrp_attribute_rx_event(a->attr.mrp, now, event); avb_mrp_attribute_rx_event(a->attr->mrp, now, event);
return 0; return 0;
} }
static int encode_listener(struct msrp *msrp, struct attr *a, void *m) static int encode_listener(struct msrp *msrp, struct attr *a, void *m)
@ -167,13 +177,13 @@ static int encode_listener(struct msrp *msrp, struct attr *a, void *m)
AVB_MRP_VECTOR_SET_NUM_VALUES(v, 1); AVB_MRP_VECTOR_SET_NUM_VALUES(v, 1);
l = (struct avb_packet_msrp_listener *)v->first_value; l = (struct avb_packet_msrp_listener *)v->first_value;
*l = a->attr.attr.listener; *l = a->attr->attr.listener;
ev = SPA_PTROFF(l, sizeof(*l), uint8_t); ev = SPA_PTROFF(l, sizeof(*l), uint8_t);
*ev = (a->attr.mrp->pending_send - 1) * 6 * 6; *ev = (a->attr->mrp->pending_send - 1) * 6 * 6;
ev = SPA_PTROFF(ev, sizeof(*ev), uint8_t); ev = SPA_PTROFF(ev, sizeof(*ev), uint8_t);
*ev = a->attr.param * 4 * 4 * 4; *ev = a->attr->param * 4 * 4 * 4;
f = SPA_PTROFF(ev, sizeof(*ev), struct avb_packet_mrp_footer); f = SPA_PTROFF(ev, sizeof(*ev), struct avb_packet_mrp_footer);
f->end_mark = 0; f->end_mark = 0;
@ -192,7 +202,7 @@ static void debug_msrp_domain(const struct avb_packet_msrp_domain *d)
static void notify_domain(struct msrp *msrp, uint64_t now, struct attr *attr, uint8_t notify) static void notify_domain(struct msrp *msrp, uint64_t now, struct attr *attr, uint8_t notify)
{ {
pw_log_info("> notify domain: %s", avb_mrp_notify_name(notify)); pw_log_info("> notify domain: %s", avb_mrp_notify_name(notify));
debug_msrp_domain(&attr->attr.attr.domain); debug_msrp_domain(&attr->attr->attr.domain);
} }
static int process_domain(struct msrp *msrp, uint64_t now, uint8_t attr_type, static int process_domain(struct msrp *msrp, uint64_t now, uint8_t attr_type,
@ -200,8 +210,8 @@ static int process_domain(struct msrp *msrp, uint64_t now, uint8_t attr_type,
{ {
struct attr *a; struct attr *a;
spa_list_for_each(a, &msrp->attributes, link) spa_list_for_each(a, &msrp->attributes, link)
if (a->attr.type == attr_type) if (a->attr->type == attr_type)
avb_mrp_attribute_rx_event(a->attr.mrp, now, event); avb_mrp_attribute_rx_event(a->attr->mrp, now, event);
return 0; return 0;
} }
@ -223,10 +233,10 @@ static int encode_domain(struct msrp *msrp, struct attr *a, void *m)
AVB_MRP_VECTOR_SET_NUM_VALUES(v, 1); AVB_MRP_VECTOR_SET_NUM_VALUES(v, 1);
d = (struct avb_packet_msrp_domain *)v->first_value; d = (struct avb_packet_msrp_domain *)v->first_value;
*d = a->attr.attr.domain; *d = a->attr->attr.domain;
ev = SPA_PTROFF(d, sizeof(*d), uint8_t); ev = SPA_PTROFF(d, sizeof(*d), uint8_t);
*ev = (a->attr.mrp->pending_send - 1) * 36; *ev = (a->attr->mrp->pending_send - 1) * 36;
f = SPA_PTROFF(ev, sizeof(*ev), struct avb_packet_mrp_footer); f = SPA_PTROFF(ev, sizeof(*ev), struct avb_packet_mrp_footer);
f->end_mark = 0; f->end_mark = 0;
@ -242,7 +252,7 @@ static const struct {
void (*notify) (struct msrp *msrp, uint64_t now, struct attr *attr, uint8_t notify); void (*notify) (struct msrp *msrp, uint64_t now, struct attr *attr, uint8_t notify);
} dispatch[] = { } dispatch[] = {
[AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE] = { "talker", process_talker, encode_talker, notify_talker, }, [AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE] = { "talker", process_talker, encode_talker, notify_talker, },
[AVB_MSRP_ATTRIBUTE_TYPE_TALKER_FAILED] = { "talker-fail", process_talker_fail, NULL, NULL }, [AVB_MSRP_ATTRIBUTE_TYPE_TALKER_FAILED] = { "talker-fail", process_talker_fail, NULL, notify_talker_failed, },
[AVB_MSRP_ATTRIBUTE_TYPE_LISTENER] = { "listener", process_listener, encode_listener, notify_listener }, [AVB_MSRP_ATTRIBUTE_TYPE_LISTENER] = { "listener", process_listener, encode_listener, notify_listener },
[AVB_MSRP_ATTRIBUTE_TYPE_DOMAIN] = { "domain", process_domain, encode_domain, notify_domain, }, [AVB_MSRP_ATTRIBUTE_TYPE_DOMAIN] = { "domain", process_domain, encode_domain, notify_domain, },
}; };
@ -265,8 +275,8 @@ static int msrp_attr_event(void *data, uint64_t now, uint8_t attribute_type, uin
struct msrp *msrp = data; struct msrp *msrp = data;
struct attr *a; struct attr *a;
spa_list_for_each(a, &msrp->attributes, link) spa_list_for_each(a, &msrp->attributes, link)
if (a->attr.type == attribute_type) if (a->attr->type == attribute_type)
avb_mrp_attribute_update_state(a->attr.mrp, now, event); avb_mrp_attribute_update_state(a->attr->mrp, now, event);
return 0; return 0;
} }
@ -332,8 +342,9 @@ static void msrp_notify(void *data, uint64_t now, uint8_t notify)
{ {
struct attr *a = data; struct attr *a = data;
struct msrp *msrp = a->msrp; struct msrp *msrp = a->msrp;
if (dispatch[a->attr.type].notify)
dispatch[a->attr.type].notify(msrp, now, a, notify); if (dispatch[a->attr->type].notify)
dispatch[a->attr->type].notify(msrp, now, a, notify);
} }
static const struct avb_mrp_attribute_events mrp_attr_events = { static const struct avb_mrp_attribute_events mrp_attr_events = {
@ -341,7 +352,7 @@ static const struct avb_mrp_attribute_events mrp_attr_events = {
.notify = msrp_notify, .notify = msrp_notify,
}; };
struct avb_msrp_attribute *avb_msrp_attribute_new(struct avb_msrp *m, int avb_msrp_attribute_new(struct avb_msrp *m, struct avb_msrp_attribute *msrp_attr,
uint8_t type) uint8_t type)
{ {
struct msrp *msrp = (struct msrp*)m; struct msrp *msrp = (struct msrp*)m;
@ -349,16 +360,21 @@ struct avb_msrp_attribute *avb_msrp_attribute_new(struct avb_msrp *m,
struct attr *a; struct attr *a;
attr = avb_mrp_attribute_new(msrp->server->mrp, sizeof(struct attr)); attr = avb_mrp_attribute_new(msrp->server->mrp, sizeof(struct attr));
if (!attr) {
pw_log_error("MSRP attribute allocation failed");
return -1;
}
a = attr->user_data; a = attr->user_data;
a->msrp = msrp; a->msrp = msrp;
a->attr.mrp = attr; a->attr = msrp_attr;
a->attr.type = type; a->attr->mrp = attr;
a->attr->type = type;
attr->name = "MSRP"; attr->name = "MSRP";
spa_list_append(&msrp->attributes, &a->link); spa_list_append(&msrp->attributes, &a->link);
avb_mrp_attribute_add_listener(attr, &a->listener, &mrp_attr_events, a); avb_mrp_attribute_add_listener(attr, &a->listener, &mrp_attr_events, a);
return &a->attr; return 0;
} }
static void msrp_event(void *data, uint64_t now, uint8_t event) static void msrp_event(void *data, uint64_t now, uint8_t event)
@ -375,15 +391,15 @@ static void msrp_event(void *data, uint64_t now, uint8_t event)
p->version = AVB_MRP_PROTOCOL_VERSION; p->version = AVB_MRP_PROTOCOL_VERSION;
spa_list_for_each(a, &msrp->attributes, link) { spa_list_for_each(a, &msrp->attributes, link) {
if (!a->attr.mrp->pending_send) if (!a->attr->mrp->pending_send)
continue; continue;
if (dispatch[a->attr.type].encode == NULL) if (dispatch[a->attr->type].encode == NULL)
continue; continue;
pw_log_debug("send %s %s", dispatch[a->attr.type].name, pw_log_debug("send %s %s", dispatch[a->attr->type].name,
avb_mrp_send_name(a->attr.mrp->pending_send)); avb_mrp_send_name(a->attr->mrp->pending_send));
len = dispatch[a->attr.type].encode(msrp, a, msg); len = dispatch[a->attr->type].encode(msrp, a, msg);
if (len < 0) if (len < 0)
break; break;
@ -404,6 +420,7 @@ static const struct avb_mrp_events mrp_events = {
.event = msrp_event, .event = msrp_event,
}; };
struct avb_msrp *avb_msrp_register(struct server *server) struct avb_msrp *avb_msrp_register(struct server *server)
{ {
struct msrp *msrp; struct msrp *msrp;

View file

@ -106,7 +106,7 @@ struct avb_msrp_attribute {
struct avb_msrp; struct avb_msrp;
struct avb_msrp_attribute *avb_msrp_attribute_new(struct avb_msrp *msrp, int avb_msrp_attribute_new(struct avb_msrp *m, struct avb_msrp_attribute *attr,
uint8_t type); uint8_t type);
struct avb_msrp *avb_msrp_register(struct server *server); struct avb_msrp *avb_msrp_register(struct server *server);

View file

@ -13,7 +13,7 @@
static const uint8_t mvrp_mac[6] = AVB_MVRP_MAC; static const uint8_t mvrp_mac[6] = AVB_MVRP_MAC;
struct attr { struct attr {
struct avb_mvrp_attribute attr; struct avb_mvrp_attribute *attr;
struct spa_hook listener; struct spa_hook listener;
struct spa_list link; struct spa_list link;
struct mvrp *mvrp; struct mvrp *mvrp;
@ -47,8 +47,8 @@ static int mvrp_attr_event(void *data, uint64_t now, uint8_t attribute_type, uin
struct mvrp *mvrp = data; struct mvrp *mvrp = data;
struct attr *a; struct attr *a;
spa_list_for_each(a, &mvrp->attributes, link) spa_list_for_each(a, &mvrp->attributes, link)
if (a->attr.type == attribute_type) if (a->attr->type == attribute_type)
avb_mrp_attribute_rx_event(a->attr.mrp, now, event); avb_mrp_attribute_rx_event(a->attr->mrp, now, event);
return 0; return 0;
} }
@ -81,10 +81,10 @@ static int encode_vid(struct mvrp *mvrp, struct attr *a, void *m)
AVB_MRP_VECTOR_SET_NUM_VALUES(v, 1); AVB_MRP_VECTOR_SET_NUM_VALUES(v, 1);
d = (struct avb_packet_mvrp_vid *)v->first_value; d = (struct avb_packet_mvrp_vid *)v->first_value;
*d = a->attr.attr.vid; *d = a->attr->attr.vid;
ev = SPA_PTROFF(d, sizeof(*d), uint8_t); ev = SPA_PTROFF(d, sizeof(*d), uint8_t);
*ev = (a->attr.mrp->pending_send - 1) * 36; *ev = (a->attr->mrp->pending_send - 1) * 36;
f = SPA_PTROFF(ev, sizeof(*ev), struct avb_packet_mrp_footer); f = SPA_PTROFF(ev, sizeof(*ev), struct avb_packet_mrp_footer);
f->end_mark = 0; f->end_mark = 0;
@ -95,7 +95,7 @@ static int encode_vid(struct mvrp *mvrp, struct attr *a, void *m)
static void notify_vid(struct mvrp *mvrp, uint64_t now, struct attr *attr, uint8_t notify) static void notify_vid(struct mvrp *mvrp, uint64_t now, struct attr *attr, uint8_t notify)
{ {
pw_log_info("> notify vid: %s", avb_mrp_notify_name(notify)); pw_log_info("> notify vid: %s", avb_mrp_notify_name(notify));
debug_vid(&attr->attr.attr.vid); debug_vid(&attr->attr->attr.vid);
} }
static const struct { static const struct {
@ -171,8 +171,9 @@ static void mvrp_notify(void *data, uint64_t now, uint8_t notify)
{ {
struct attr *a = data; struct attr *a = data;
struct mvrp *mvrp = a->mvrp; struct mvrp *mvrp = a->mvrp;
if (dispatch[a->attr.type].notify)
dispatch[a->attr.type].notify(mvrp, now, a, notify); if (dispatch[a->attr->type].notify)
dispatch[a->attr->type].notify(mvrp, now, a, notify);
} }
static const struct avb_mrp_attribute_events mrp_attr_events = { static const struct avb_mrp_attribute_events mrp_attr_events = {
@ -180,23 +181,28 @@ static const struct avb_mrp_attribute_events mrp_attr_events = {
.notify = mvrp_notify, .notify = mvrp_notify,
}; };
struct avb_mvrp_attribute *avb_mvrp_attribute_new(struct avb_mvrp *m, int avb_mvrp_attribute_new(struct avb_mvrp *m,
uint8_t type) struct avb_mvrp_attribute *mvrp_attr, uint8_t type)
{ {
struct mvrp *mvrp = (struct mvrp*)m; struct mvrp *mvrp = (struct mvrp*)m;
struct avb_mrp_attribute *attr; struct avb_mrp_attribute *attr;
struct attr *a; struct attr *a;
attr = avb_mrp_attribute_new(mvrp->server->mrp, sizeof(struct attr)); attr = avb_mrp_attribute_new(mvrp->server->mrp, sizeof(struct attr));
if (!attr) {
pw_log_error("MVRP attribute allocation failed");
return -1;
}
a = attr->user_data; a = attr->user_data;
a->attr.mrp = attr; a->attr = mvrp_attr;
a->attr.type = type; a->attr->mrp = attr;
a->attr->type = type;
attr->name = "MVRP"; attr->name = "MVRP";
spa_list_append(&mvrp->attributes, &a->link); spa_list_append(&mvrp->attributes, &a->link);
avb_mrp_attribute_add_listener(attr, &a->listener, &mrp_attr_events, a); avb_mrp_attribute_add_listener(attr, &a->listener, &mrp_attr_events, a);
return &a->attr; return 0;
} }
static void mvrp_event(void *data, uint64_t now, uint8_t event) static void mvrp_event(void *data, uint64_t now, uint8_t event)
@ -213,15 +219,15 @@ static void mvrp_event(void *data, uint64_t now, uint8_t event)
p->version = AVB_MRP_PROTOCOL_VERSION; p->version = AVB_MRP_PROTOCOL_VERSION;
spa_list_for_each(a, &mvrp->attributes, link) { spa_list_for_each(a, &mvrp->attributes, link) {
if (!a->attr.mrp->pending_send) if (!a->attr->mrp->pending_send)
continue; continue;
if (dispatch[a->attr.type].encode == NULL) if (dispatch[a->attr->type].encode == NULL)
continue; continue;
pw_log_debug("send %s %s", dispatch[a->attr.type].name, pw_log_debug("send %s %s", dispatch[a->attr->type].name,
avb_mrp_send_name(a->attr.mrp->pending_send)); avb_mrp_send_name(a->attr->mrp->pending_send));
len = dispatch[a->attr.type].encode(mvrp, a, msg); len = dispatch[a->attr->type].encode(mvrp, a, msg);
if (len < 0) if (len < 0)
break; break;

View file

@ -34,8 +34,8 @@ struct avb_mvrp_attribute {
} attr; } attr;
}; };
struct avb_mvrp_attribute *avb_mvrp_attribute_new(struct avb_mvrp *mvrp, int avb_mvrp_attribute_new(struct avb_mvrp *mvrp,
uint8_t type); struct avb_mvrp_attribute *attr, uint8_t type);
struct avb_mvrp *avb_mvrp_register(struct server *server); struct avb_mvrp *avb_mvrp_register(struct server *server);

View file

@ -240,18 +240,13 @@ static const struct pw_stream_events sink_stream_events = {
struct stream *server_create_stream(struct server *server, struct stream *stream, struct stream *server_create_stream(struct server *server, struct stream *stream,
enum spa_direction direction, uint16_t index) enum spa_direction direction, uint16_t index)
{ {
struct stream_common *common = (struct stream_common *)stream;
uint32_t n_params; uint32_t n_params;
const struct spa_pod *params[1]; const struct spa_pod *params[1];
uint8_t buffer[1024]; uint8_t buffer[1024];
struct spa_pod_builder b; struct spa_pod_builder b;
int res; int res;
struct stream_common *common;
struct avb_msrp_attribute *stream_attr;
common = SPA_CONTAINER_OF(stream, struct stream_common, stream);
stream->server = server; stream->server = server;
stream->direction = direction; stream->direction = direction;
stream->prio = AVB_MSRP_PRIORITY_DEFAULT; stream->prio = AVB_MSRP_PRIORITY_DEFAULT;
@ -324,29 +319,38 @@ struct stream *server_create_stream(struct server *server, struct stream *stream
setup_pdu(stream); setup_pdu(stream);
setup_msg(stream); setup_msg(stream);
if (direction == SPA_DIRECTION_INPUT) { res = avb_msrp_attribute_new(server->msrp, &common->lstream_attr,
stream_attr = avb_msrp_attribute_new(server->msrp, AVB_MSRP_ATTRIBUTE_TYPE_LISTENER);
AVB_MSRP_ATTRIBUTE_TYPE_LISTENER); if (res) {
} else { goto error_free;
stream_attr = avb_msrp_attribute_new(server->msrp,
AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE);
stream_attr->attr.talker.vlan_id = htons(stream->vlan_id);
stream_attr->attr.talker.tspec_max_frame_size =
htons(32 + stream->frames_per_pdu * stream->stride);
stream_attr->attr.talker.tspec_max_interval_frames =
htons(AVB_MSRP_TSPEC_MAX_INTERVAL_FRAMES_DEFAULT);
stream_attr->attr.talker.priority = stream->prio;
stream_attr->attr.talker.rank = AVB_MSRP_RANK_DEFAULT;
stream_attr->attr.talker.accumulated_latency = htonl(95);
} }
res = avb_msrp_attribute_new(server->msrp, &common->tastream_attr,
AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE);
if (res) {
goto error_free;
}
common->stream_attr = stream_attr; res = avb_msrp_attribute_new(server->msrp, &common->tfstream_attr,
AVB_MSRP_ATTRIBUTE_TYPE_TALKER_FAILED);
if (res) {
goto error_free;
}
if (stream->direction == SPA_DIRECTION_OUTPUT) {
struct avb_msrp_attribute *ta = &common->tastream_attr;
ta->attr.talker.vlan_id = htons(stream->vlan_id);
ta->attr.talker.tspec_max_frame_size =
htons(32 + stream->frames_per_pdu * stream->stride);
ta->attr.talker.tspec_max_interval_frames =
htons(AVB_MSRP_TSPEC_MAX_INTERVAL_FRAMES_DEFAULT);
ta->attr.talker.priority = stream->prio;
ta->attr.talker.rank = AVB_MSRP_RANK_DEFAULT;
ta->attr.talker.accumulated_latency = htonl(95);
}
spa_list_append(&server->streams, &stream->link); spa_list_append(&server->streams, &stream->link);
@ -355,7 +359,7 @@ error_free_stream:
pw_stream_destroy(stream->stream); pw_stream_destroy(stream->stream);
errno = -res; errno = -res;
error_free: error_free:
free(stream); free(stream->buffer_data);
return NULL; return NULL;
} }
@ -364,7 +368,9 @@ void stream_destroy(struct stream *stream)
struct stream_common *common; struct stream_common *common;
common = SPA_CONTAINER_OF(stream, struct stream_common, stream); common = SPA_CONTAINER_OF(stream, struct stream_common, stream);
avb_mrp_attribute_destroy(common->stream_attr->mrp); avb_mrp_attribute_destroy(common->lstream_attr.mrp);
avb_mrp_attribute_destroy(common->tastream_attr.mrp);
avb_mrp_attribute_destroy(common->tfstream_attr.mrp);
} }
static int setup_socket(struct stream *stream) static int setup_socket(struct stream *stream)
@ -454,23 +460,31 @@ int stream_activate(struct stream *stream, uint16_t index, uint64_t now)
} }
if (stream->direction == SPA_DIRECTION_INPUT) { if (stream->direction == SPA_DIRECTION_INPUT) {
common->stream_attr->attr.listener.stream_id = htobe64(stream->peer_id); struct aecp_aem_stream_input_state *input_stream;
common->stream_attr->param = AVB_MSRP_LISTENER_PARAM_READY; input_stream = SPA_CONTAINER_OF(common, struct aecp_aem_stream_input_state, common);
avb_mrp_attribute_begin(common->stream_attr->mrp, now);
avb_mrp_attribute_join(common->stream_attr->mrp, now, true); common->lstream_attr.attr.listener.stream_id = htobe64(stream->peer_id);
common->lstream_attr.param = AVB_MSRP_LISTENER_PARAM_READY;
avb_mrp_attribute_begin(common->lstream_attr.mrp, now);
avb_mrp_attribute_join(common->lstream_attr.mrp, now, true);
input_stream->mvrp_attr.attr.vid.vlan = htons(stream->vlan_id);
avb_mrp_attribute_begin(input_stream->mvrp_attr.mrp, now);
avb_mrp_attribute_join(input_stream->mvrp_attr.mrp, now, true);
} else { } else {
if ((res = avb_maap_get_address(server->maap, stream->addr, index)) < 0) if ((res = avb_maap_get_address(server->maap, stream->addr, index)) < 0)
return res; return res;
common->stream_attr->attr.talker.stream_id = htobe64(stream->id); common->tastream_attr.attr.talker.stream_id = htobe64(stream->id);
memcpy(common->stream_attr->attr.talker.dest_addr, stream->addr, 6); memcpy(common->tastream_attr.attr.talker.dest_addr, stream->addr, 6);
stream->sock_addr.sll_halen = ETH_ALEN; stream->sock_addr.sll_halen = ETH_ALEN;
memcpy(&stream->sock_addr.sll_addr, stream->addr, ETH_ALEN); memcpy(&stream->sock_addr.sll_addr, stream->addr, ETH_ALEN);
memcpy(h->dest, stream->addr, 6); memcpy(h->dest, stream->addr, 6);
memcpy(h->src, server->mac_addr, 6); memcpy(h->src, server->mac_addr, 6);
avb_mrp_attribute_begin(common->stream_attr->mrp, now); avb_mrp_attribute_begin(common->tastream_attr.mrp, now);
avb_mrp_attribute_join(common->stream_attr->mrp, now, true); avb_mrp_attribute_join(common->tastream_attr.mrp, now, true);
} }
pw_stream_set_active(stream->stream, true); pw_stream_set_active(stream->stream, true);
@ -493,7 +507,9 @@ int stream_deactivate(struct stream *stream, uint64_t now)
avb_mrp_attribute_leave(stream->vlan_attr->mrp, now); avb_mrp_attribute_leave(stream->vlan_attr->mrp, now);
#endif // #endif //
avb_mrp_attribute_leave(common->stream_attr->mrp, now); avb_mrp_attribute_leave(common->lstream_attr.mrp, now);
avb_mrp_attribute_leave(common->tastream_attr.mrp, now);
avb_mrp_attribute_leave(common->tfstream_attr.mrp, now);
return 0; return 0;
} }

View file

@ -115,6 +115,9 @@ if build_avb_virtual
'../modules/module-avb/avb.c', '../modules/module-avb/avb.c',
'../modules/module-avb/adp.c', '../modules/module-avb/adp.c',
'../modules/module-avb/acmp.c', '../modules/module-avb/acmp.c',
'../modules/module-avb/acmp-cmds-resps/acmp-common.c',
'../modules/module-avb/acmp-cmds-resps/acmp-legacy-avb.c',
'../modules/module-avb/acmp-cmds-resps/acmp-milan-v12.c',
'../modules/module-avb/aecp.c', '../modules/module-avb/aecp.c',
'../modules/module-avb/aecp-aem.c', '../modules/module-avb/aecp-aem.c',
'../modules/module-avb/aecp-aem-cmds-resps/cmd-available.c', '../modules/module-avb/aecp-aem-cmds-resps/cmd-available.c',
@ -127,6 +130,7 @@ if build_avb_virtual
'../modules/module-avb/aecp-aem-cmds-resps/cmd-get-set-stream-format.c', '../modules/module-avb/aecp-aem-cmds-resps/cmd-get-set-stream-format.c',
'../modules/module-avb/aecp-aem-cmds-resps/cmd-lock-entity.c', '../modules/module-avb/aecp-aem-cmds-resps/cmd-lock-entity.c',
'../modules/module-avb/aecp-aem-cmds-resps/cmd-get-set-configuration.c', '../modules/module-avb/aecp-aem-cmds-resps/cmd-get-set-configuration.c',
'../modules/module-avb/aecp-aem-cmds-resps/cmd-get-dynamic-info.c',
'../modules/module-avb/aecp-aem-cmds-resps/reply-unsol-helpers.c', '../modules/module-avb/aecp-aem-cmds-resps/reply-unsol-helpers.c',
'../modules/module-avb/es-builder.c', '../modules/module-avb/es-builder.c',
'../modules/module-avb/avdecc.c', '../modules/module-avb/avdecc.c',

View file

@ -112,7 +112,8 @@ static struct server *create_virtual_server(struct data *data)
avb_adp_register(server); avb_adp_register(server);
avb_acmp_register(server); avb_acmp_register(server);
server->domain_attr = avb_msrp_attribute_new(server->msrp, server->domain_attr = calloc(1, sizeof(*server->domain_attr));
avb_msrp_attribute_new(server->msrp, server->domain_attr,
AVB_MSRP_ATTRIBUTE_TYPE_DOMAIN); AVB_MSRP_ATTRIBUTE_TYPE_DOMAIN);
server->domain_attr->attr.domain.sr_class_id = AVB_MSRP_CLASS_ID_DEFAULT; server->domain_attr->attr.domain.sr_class_id = AVB_MSRP_CLASS_ID_DEFAULT;
server->domain_attr->attr.domain.sr_class_priority = AVB_MSRP_PRIORITY_DEFAULT; server->domain_attr->attr.domain.sr_class_priority = AVB_MSRP_PRIORITY_DEFAULT;

View file

@ -170,6 +170,9 @@ if build_avb_virtual
'../src/modules/module-avb/avb.c', '../src/modules/module-avb/avb.c',
'../src/modules/module-avb/adp.c', '../src/modules/module-avb/adp.c',
'../src/modules/module-avb/acmp.c', '../src/modules/module-avb/acmp.c',
'../src/modules/module-avb/acmp-cmds-resps/acmp-common.c',
'../src/modules/module-avb/acmp-cmds-resps/acmp-legacy-avb.c',
'../src/modules/module-avb/acmp-cmds-resps/acmp-milan-v12.c',
'../src/modules/module-avb/aecp.c', '../src/modules/module-avb/aecp.c',
'../src/modules/module-avb/aecp-aem.c', '../src/modules/module-avb/aecp-aem.c',
'../src/modules/module-avb/aecp-aem-cmds-resps/cmd-available.c', '../src/modules/module-avb/aecp-aem-cmds-resps/cmd-available.c',
@ -182,6 +185,7 @@ if build_avb_virtual
'../src/modules/module-avb/aecp-aem-cmds-resps/cmd-get-set-stream-format.c', '../src/modules/module-avb/aecp-aem-cmds-resps/cmd-get-set-stream-format.c',
'../src/modules/module-avb/aecp-aem-cmds-resps/cmd-lock-entity.c', '../src/modules/module-avb/aecp-aem-cmds-resps/cmd-lock-entity.c',
'../src/modules/module-avb/aecp-aem-cmds-resps/cmd-get-set-configuration.c', '../src/modules/module-avb/aecp-aem-cmds-resps/cmd-get-set-configuration.c',
'../src/modules/module-avb/aecp-aem-cmds-resps/cmd-get-dynamic-info.c',
'../src/modules/module-avb/aecp-aem-cmds-resps/reply-unsol-helpers.c', '../src/modules/module-avb/aecp-aem-cmds-resps/reply-unsol-helpers.c',
'../src/modules/module-avb/es-builder.c', '../src/modules/module-avb/es-builder.c',
'../src/modules/module-avb/avdecc.c', '../src/modules/module-avb/avdecc.c',

View file

@ -68,7 +68,8 @@ static inline struct server *avb_test_server_new(struct impl *impl)
avb_adp_register(server); avb_adp_register(server);
avb_acmp_register(server); avb_acmp_register(server);
server->domain_attr = avb_msrp_attribute_new(server->msrp, server->domain_attr = calloc(1, sizeof(*server->domain_attr));
avb_msrp_attribute_new(server->msrp, server->domain_attr,
AVB_MSRP_ATTRIBUTE_TYPE_DOMAIN); AVB_MSRP_ATTRIBUTE_TYPE_DOMAIN);
server->domain_attr->attr.domain.sr_class_id = AVB_MSRP_CLASS_ID_DEFAULT; server->domain_attr->attr.domain.sr_class_id = AVB_MSRP_CLASS_ID_DEFAULT;
server->domain_attr->attr.domain.sr_class_priority = AVB_MSRP_PRIORITY_DEFAULT; server->domain_attr->attr.domain.sr_class_priority = AVB_MSRP_PRIORITY_DEFAULT;
@ -313,7 +314,8 @@ static inline struct server *avb_test_server_new_milan(struct impl *impl)
avb_adp_register(server); avb_adp_register(server);
avb_acmp_register(server); avb_acmp_register(server);
server->domain_attr = avb_msrp_attribute_new(server->msrp, server->domain_attr = calloc(1, sizeof(*server->domain_attr));
avb_msrp_attribute_new(server->msrp, server->domain_attr,
AVB_MSRP_ATTRIBUTE_TYPE_DOMAIN); AVB_MSRP_ATTRIBUTE_TYPE_DOMAIN);
server->domain_attr->attr.domain.sr_class_id = AVB_MSRP_CLASS_ID_DEFAULT; server->domain_attr->attr.domain.sr_class_id = AVB_MSRP_CLASS_ID_DEFAULT;
server->domain_attr->attr.domain.sr_class_priority = AVB_MSRP_PRIORITY_DEFAULT; server->domain_attr->attr.domain.sr_class_priority = AVB_MSRP_PRIORITY_DEFAULT;

View file

@ -217,7 +217,8 @@ PWTEST(avb_mrp_attribute_lifecycle)
pwtest_ptr_notnull(server); pwtest_ptr_notnull(server);
/* Create an MSRP talker attribute */ /* Create an MSRP talker attribute */
attr = avb_msrp_attribute_new(server->msrp, attr = calloc(1, sizeof(*attr));
avb_msrp_attribute_new(server->msrp, attr,
AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE); AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE);
pwtest_ptr_notnull(attr); pwtest_ptr_notnull(attr);
pwtest_ptr_notnull(attr->mrp); pwtest_ptr_notnull(attr->mrp);
@ -271,7 +272,8 @@ PWTEST(avb_milan_server_create)
avb_adp_register(server); avb_adp_register(server);
avb_acmp_register(server); avb_acmp_register(server);
server->domain_attr = avb_msrp_attribute_new(server->msrp, server->domain_attr = calloc(1, sizeof(*server->domain_attr));
avb_msrp_attribute_new(server->msrp, server->domain_attr,
AVB_MSRP_ATTRIBUTE_TYPE_DOMAIN); AVB_MSRP_ATTRIBUTE_TYPE_DOMAIN);
server->domain_attr->attr.domain.sr_class_id = AVB_MSRP_CLASS_ID_DEFAULT; server->domain_attr->attr.domain.sr_class_id = AVB_MSRP_CLASS_ID_DEFAULT;
server->domain_attr->attr.domain.sr_class_priority = AVB_MSRP_PRIORITY_DEFAULT; server->domain_attr->attr.domain.sr_class_priority = AVB_MSRP_PRIORITY_DEFAULT;
@ -323,7 +325,8 @@ PWTEST(avb_mrp_begin_join_new_tx)
pwtest_ptr_notnull(server); pwtest_ptr_notnull(server);
/* Create a talker attribute */ /* Create a talker attribute */
attr = avb_msrp_attribute_new(server->msrp, attr = calloc(1, sizeof(*attr));
avb_msrp_attribute_new(server->msrp, attr,
AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE); AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE);
pwtest_ptr_notnull(attr); pwtest_ptr_notnull(attr);
@ -364,7 +367,8 @@ PWTEST(avb_mrp_join_leave_cycle)
server = avb_test_server_new(impl); server = avb_test_server_new(impl);
pwtest_ptr_notnull(server); pwtest_ptr_notnull(server);
attr = avb_msrp_attribute_new(server->msrp, attr = calloc(1, sizeof(*attr));
avb_msrp_attribute_new(server->msrp, attr,
AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE); AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE);
pwtest_ptr_notnull(attr); pwtest_ptr_notnull(attr);
@ -440,7 +444,8 @@ PWTEST(avb_mrp_rx_new_notification)
/* Register a global MRP listener to track notifications */ /* Register a global MRP listener to track notifications */
avb_mrp_add_listener(server->mrp, &listener, &test_mrp_events, &tracker); avb_mrp_add_listener(server->mrp, &listener, &test_mrp_events, &tracker);
attr = avb_msrp_attribute_new(server->msrp, attr = calloc(1, sizeof(*attr));
avb_msrp_attribute_new(server->msrp, attr,
AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE); AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE);
pwtest_ptr_notnull(attr); pwtest_ptr_notnull(attr);
@ -486,7 +491,8 @@ PWTEST(avb_mrp_registrar_leave_timer)
avb_mrp_add_listener(server->mrp, &listener, &test_mrp_events, &tracker); avb_mrp_add_listener(server->mrp, &listener, &test_mrp_events, &tracker);
attr = avb_msrp_attribute_new(server->msrp, attr = calloc(1, sizeof(*attr));
avb_msrp_attribute_new(server->msrp, attr,
AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE); AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE);
avb_mrp_attribute_begin(attr->mrp, 0); avb_mrp_attribute_begin(attr->mrp, 0);
avb_mrp_attribute_join(attr->mrp, 0, true); avb_mrp_attribute_join(attr->mrp, 0, true);
@ -527,9 +533,11 @@ PWTEST(avb_mrp_multiple_attributes)
server = avb_test_server_new(impl); server = avb_test_server_new(impl);
pwtest_ptr_notnull(server); pwtest_ptr_notnull(server);
attr1 = avb_msrp_attribute_new(server->msrp, attr1 = calloc(1, sizeof(*attr1));
avb_msrp_attribute_new(server->msrp, attr1,
AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE); AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE);
attr2 = avb_msrp_attribute_new(server->msrp, attr2 = calloc(1, sizeof(*attr2));
avb_msrp_attribute_new(server->msrp, attr2,
AVB_MSRP_ATTRIBUTE_TYPE_LISTENER); AVB_MSRP_ATTRIBUTE_TYPE_LISTENER);
pwtest_ptr_notnull(attr1); pwtest_ptr_notnull(attr1);
pwtest_ptr_notnull(attr2); pwtest_ptr_notnull(attr2);
@ -570,22 +578,26 @@ PWTEST(avb_msrp_attribute_types)
pwtest_ptr_notnull(server); pwtest_ptr_notnull(server);
/* Create all four MSRP attribute types */ /* Create all four MSRP attribute types */
talker = avb_msrp_attribute_new(server->msrp, talker = calloc(1, sizeof(*talker));
avb_msrp_attribute_new(server->msrp, talker,
AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE); AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE);
pwtest_ptr_notnull(talker); pwtest_ptr_notnull(talker);
pwtest_int_eq(talker->type, AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE); pwtest_int_eq(talker->type, AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE);
talker_fail = avb_msrp_attribute_new(server->msrp, talker_fail = calloc(1, sizeof(*talker_fail));
avb_msrp_attribute_new(server->msrp, talker_fail,
AVB_MSRP_ATTRIBUTE_TYPE_TALKER_FAILED); AVB_MSRP_ATTRIBUTE_TYPE_TALKER_FAILED);
pwtest_ptr_notnull(talker_fail); pwtest_ptr_notnull(talker_fail);
pwtest_int_eq(talker_fail->type, AVB_MSRP_ATTRIBUTE_TYPE_TALKER_FAILED); pwtest_int_eq(talker_fail->type, AVB_MSRP_ATTRIBUTE_TYPE_TALKER_FAILED);
listener_attr = avb_msrp_attribute_new(server->msrp, listener_attr = calloc(1, sizeof(*listener_attr));
avb_msrp_attribute_new(server->msrp, listener_attr,
AVB_MSRP_ATTRIBUTE_TYPE_LISTENER); AVB_MSRP_ATTRIBUTE_TYPE_LISTENER);
pwtest_ptr_notnull(listener_attr); pwtest_ptr_notnull(listener_attr);
pwtest_int_eq(listener_attr->type, AVB_MSRP_ATTRIBUTE_TYPE_LISTENER); pwtest_int_eq(listener_attr->type, AVB_MSRP_ATTRIBUTE_TYPE_LISTENER);
domain = avb_msrp_attribute_new(server->msrp, domain = calloc(1, sizeof(*domain));
avb_msrp_attribute_new(server->msrp, domain,
AVB_MSRP_ATTRIBUTE_TYPE_DOMAIN); AVB_MSRP_ATTRIBUTE_TYPE_DOMAIN);
pwtest_ptr_notnull(domain); pwtest_ptr_notnull(domain);
pwtest_int_eq(domain->type, AVB_MSRP_ATTRIBUTE_TYPE_DOMAIN); pwtest_int_eq(domain->type, AVB_MSRP_ATTRIBUTE_TYPE_DOMAIN);
@ -638,7 +650,8 @@ PWTEST(avb_msrp_domain_transmit)
/* The test server already has a domain_attr, but create another /* The test server already has a domain_attr, but create another
* to test independent domain attribute behavior */ * to test independent domain attribute behavior */
domain = avb_msrp_attribute_new(server->msrp, domain = calloc(1, sizeof(*domain));
avb_msrp_attribute_new(server->msrp, domain,
AVB_MSRP_ATTRIBUTE_TYPE_DOMAIN); AVB_MSRP_ATTRIBUTE_TYPE_DOMAIN);
domain->attr.domain.sr_class_id = 7; domain->attr.domain.sr_class_id = 7;
domain->attr.domain.sr_class_priority = 2; domain->attr.domain.sr_class_priority = 2;
@ -675,7 +688,8 @@ PWTEST(avb_msrp_talker_transmit)
server = avb_test_server_new(impl); server = avb_test_server_new(impl);
pwtest_ptr_notnull(server); pwtest_ptr_notnull(server);
talker = avb_msrp_attribute_new(server->msrp, talker = calloc(1, sizeof(*talker));
avb_msrp_attribute_new(server->msrp, talker,
AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE); AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE);
pwtest_ptr_notnull(talker); pwtest_ptr_notnull(talker);
@ -1012,7 +1026,8 @@ PWTEST(avb_msrp_talker_failed_notify)
server = avb_test_server_new(impl); server = avb_test_server_new(impl);
pwtest_ptr_notnull(server); pwtest_ptr_notnull(server);
talker_fail = avb_msrp_attribute_new(server->msrp, talker_fail = calloc(1, sizeof(*talker_fail));
avb_msrp_attribute_new(server->msrp, talker_fail,
AVB_MSRP_ATTRIBUTE_TYPE_TALKER_FAILED); AVB_MSRP_ATTRIBUTE_TYPE_TALKER_FAILED);
pwtest_ptr_notnull(talker_fail); pwtest_ptr_notnull(talker_fail);
@ -2584,7 +2599,8 @@ PWTEST(avb_mrp_leave_all_timer)
avb_mrp_add_listener(server->mrp, &listener, &test_mrp_events, &tracker); avb_mrp_add_listener(server->mrp, &listener, &test_mrp_events, &tracker);
/* Create and join an attribute */ /* Create and join an attribute */
attr = avb_msrp_attribute_new(server->msrp, attr = calloc(1, sizeof(*attr));
avb_msrp_attribute_new(server->msrp, attr,
AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE); AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE);
pwtest_ptr_notnull(attr); pwtest_ptr_notnull(attr);
@ -2630,7 +2646,8 @@ PWTEST(avb_mrp_periodic_timer)
server = avb_test_server_new(impl); server = avb_test_server_new(impl);
pwtest_ptr_notnull(server); pwtest_ptr_notnull(server);
attr = avb_msrp_attribute_new(server->msrp, attr = calloc(1, sizeof(*attr));
avb_msrp_attribute_new(server->msrp, attr,
AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE); AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE);
avb_mrp_attribute_begin(attr->mrp, 0); avb_mrp_attribute_begin(attr->mrp, 0);
avb_mrp_attribute_join(attr->mrp, 0, true); avb_mrp_attribute_join(attr->mrp, 0, true);
@ -2674,7 +2691,8 @@ PWTEST(avb_msrp_talker_failed_process)
/* Create a talker-failed attribute that matches the stream_id /* Create a talker-failed attribute that matches the stream_id
* we'll send in the MSRP packet. This ensures process_talker_fail() * we'll send in the MSRP packet. This ensures process_talker_fail()
* finds a matching attribute and calls avb_mrp_attribute_rx_event(). */ * finds a matching attribute and calls avb_mrp_attribute_rx_event(). */
talker_fail = avb_msrp_attribute_new(server->msrp, talker_fail = calloc(1, sizeof(*talker_fail));
avb_msrp_attribute_new(server->msrp, talker_fail,
AVB_MSRP_ATTRIBUTE_TYPE_TALKER_FAILED); AVB_MSRP_ATTRIBUTE_TYPE_TALKER_FAILED);
pwtest_ptr_notnull(talker_fail); pwtest_ptr_notnull(talker_fail);
@ -2780,7 +2798,8 @@ PWTEST(avb_mvrp_attribute_lifecycle)
server = avb_test_server_new(impl); server = avb_test_server_new(impl);
pwtest_ptr_notnull(server); pwtest_ptr_notnull(server);
vid = avb_mvrp_attribute_new(server->mvrp, vid = calloc(1, sizeof(*vid));
avb_mvrp_attribute_new(server->mvrp, vid,
AVB_MVRP_ATTRIBUTE_TYPE_VID); AVB_MVRP_ATTRIBUTE_TYPE_VID);
pwtest_ptr_notnull(vid); pwtest_ptr_notnull(vid);
pwtest_int_eq(vid->type, AVB_MVRP_ATTRIBUTE_TYPE_VID); pwtest_int_eq(vid->type, AVB_MVRP_ATTRIBUTE_TYPE_VID);
@ -2816,7 +2835,8 @@ PWTEST(avb_mvrp_vid_transmit)
server = avb_test_server_new(impl); server = avb_test_server_new(impl);
pwtest_ptr_notnull(server); pwtest_ptr_notnull(server);
vid = avb_mvrp_attribute_new(server->mvrp, vid = calloc(1, sizeof(*vid));
avb_mvrp_attribute_new(server->mvrp, vid,
AVB_MVRP_ATTRIBUTE_TYPE_VID); AVB_MVRP_ATTRIBUTE_TYPE_VID);
pwtest_ptr_notnull(vid); pwtest_ptr_notnull(vid);