mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-01 06:46:47 -04:00
milan-avb: stream: initialisation of the msrp/mrp stream components
This commit is contained in:
parent
5b06b5457a
commit
45a94f58bd
1 changed files with 28 additions and 27 deletions
|
|
@ -321,35 +321,33 @@ struct stream *server_create_stream(struct server *server, struct stream *stream
|
||||||
|
|
||||||
res = avb_msrp_attribute_new(server->msrp, &common->lstream_attr,
|
res = avb_msrp_attribute_new(server->msrp, &common->lstream_attr,
|
||||||
AVB_MSRP_ATTRIBUTE_TYPE_LISTENER);
|
AVB_MSRP_ATTRIBUTE_TYPE_LISTENER);
|
||||||
if (res) {
|
if (res)
|
||||||
goto error_free;
|
goto error_free;
|
||||||
}
|
|
||||||
|
|
||||||
res = avb_msrp_attribute_new(server->msrp, &common->tastream_attr,
|
|
||||||
AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE);
|
|
||||||
if (res) {
|
|
||||||
goto error_free;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = avb_msrp_attribute_new(server->msrp, &common->tfstream_attr,
|
res = avb_msrp_attribute_new(server->msrp, &common->tfstream_attr,
|
||||||
AVB_MSRP_ATTRIBUTE_TYPE_TALKER_FAILED);
|
AVB_MSRP_ATTRIBUTE_TYPE_TALKER_FAILED);
|
||||||
if (res) {
|
if (res) {
|
||||||
|
avb_mrp_attribute_destroy(common->lstream_attr.mrp);
|
||||||
goto error_free;
|
goto error_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream->direction == SPA_DIRECTION_OUTPUT) {
|
if (direction == SPA_DIRECTION_OUTPUT) {
|
||||||
struct avb_msrp_attribute *ta = &common->tastream_attr;
|
res = avb_msrp_attribute_new(server->msrp, &common->tastream_attr,
|
||||||
|
AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE);
|
||||||
|
if (res) {
|
||||||
|
avb_mrp_attribute_destroy(common->lstream_attr.mrp);
|
||||||
|
avb_mrp_attribute_destroy(common->tfstream_attr.mrp);
|
||||||
|
goto error_free;
|
||||||
|
}
|
||||||
|
|
||||||
ta->attr.talker.vlan_id = htons(stream->vlan_id);
|
common->tastream_attr.attr.talker.vlan_id = htons(stream->vlan_id);
|
||||||
ta->attr.talker.tspec_max_frame_size =
|
common->tastream_attr.attr.talker.tspec_max_frame_size =
|
||||||
htons(32 + stream->frames_per_pdu * stream->stride);
|
htons(32 + stream->frames_per_pdu * stream->stride);
|
||||||
|
common->tastream_attr.attr.talker.tspec_max_interval_frames =
|
||||||
ta->attr.talker.tspec_max_interval_frames =
|
|
||||||
htons(AVB_MSRP_TSPEC_MAX_INTERVAL_FRAMES_DEFAULT);
|
htons(AVB_MSRP_TSPEC_MAX_INTERVAL_FRAMES_DEFAULT);
|
||||||
|
common->tastream_attr.attr.talker.priority = stream->prio;
|
||||||
ta->attr.talker.priority = stream->prio;
|
common->tastream_attr.attr.talker.rank = AVB_MSRP_RANK_DEFAULT;
|
||||||
ta->attr.talker.rank = AVB_MSRP_RANK_DEFAULT;
|
common->tastream_attr.attr.talker.accumulated_latency = htonl(95);
|
||||||
ta->attr.talker.accumulated_latency = htonl(95);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
spa_list_append(&server->streams, &stream->link);
|
spa_list_append(&server->streams, &stream->link);
|
||||||
|
|
@ -365,12 +363,15 @@ error_free:
|
||||||
|
|
||||||
void stream_destroy(struct stream *stream)
|
void stream_destroy(struct stream *stream)
|
||||||
{
|
{
|
||||||
struct stream_common *common;
|
struct stream_common *common = SPA_CONTAINER_OF(stream, struct stream_common, stream);
|
||||||
common = SPA_CONTAINER_OF(stream, struct stream_common, stream);
|
|
||||||
|
|
||||||
|
if (stream->direction == SPA_DIRECTION_INPUT) {
|
||||||
avb_mrp_attribute_destroy(common->lstream_attr.mrp);
|
avb_mrp_attribute_destroy(common->lstream_attr.mrp);
|
||||||
|
avb_mrp_attribute_destroy(common->tfstream_attr.mrp);
|
||||||
|
} else {
|
||||||
avb_mrp_attribute_destroy(common->tastream_attr.mrp);
|
avb_mrp_attribute_destroy(common->tastream_attr.mrp);
|
||||||
avb_mrp_attribute_destroy(common->tfstream_attr.mrp);
|
avb_mrp_attribute_destroy(common->tfstream_attr.mrp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int setup_socket(struct stream *stream)
|
static int setup_socket(struct stream *stream)
|
||||||
|
|
@ -471,7 +472,6 @@ int stream_activate(struct stream *stream, uint16_t index, uint64_t now)
|
||||||
input_stream->mvrp_attr.attr.vid.vlan = htons(stream->vlan_id);
|
input_stream->mvrp_attr.attr.vid.vlan = htons(stream->vlan_id);
|
||||||
avb_mrp_attribute_begin(input_stream->mvrp_attr.mrp, now);
|
avb_mrp_attribute_begin(input_stream->mvrp_attr.mrp, now);
|
||||||
avb_mrp_attribute_join(input_stream->mvrp_attr.mrp, now, true);
|
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;
|
||||||
|
|
@ -507,9 +507,10 @@ 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 //
|
||||||
|
|
||||||
|
if (stream->direction == SPA_DIRECTION_INPUT)
|
||||||
avb_mrp_attribute_leave(common->lstream_attr.mrp, now);
|
avb_mrp_attribute_leave(common->lstream_attr.mrp, now);
|
||||||
|
else
|
||||||
avb_mrp_attribute_leave(common->tastream_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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue