diff --git a/README.md b/README.md index 55d3d7866..94e66c3ef 100644 --- a/README.md +++ b/README.md @@ -711,6 +711,10 @@ Optionally included keys are: Corresponds to the *rtpproxy* `a` flag. Advertises an RTP endpoint which uses asymmetric RTP, which disables learning of endpoint addresses (see below). + - `unidirectional` + + When this flag is present, kernelize also one-way rtp media. + - `strict source` Normally, *rtpengine* attempts to learn the correct endpoint address for every stream during diff --git a/daemon/call.c b/daemon/call.c index 252b2c633..a712634f1 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -1553,8 +1553,8 @@ int monologue_offer_answer(struct call_monologue *other_ml, GQueue *streams, if (sp->rtp_endpoint.port) { /* copy parameters advertised by the sender of this message */ bf_copy_same(&other_media->media_flags, &sp->sp_flags, - SHARED_FLAG_RTCP_MUX | SHARED_FLAG_ASYMMETRIC | SHARED_FLAG_ICE - | SHARED_FLAG_TRICKLE_ICE | SHARED_FLAG_ICE_LITE); + SHARED_FLAG_RTCP_MUX | SHARED_FLAG_ASYMMETRIC | SHARED_FLAG_UNIDIRECTIONAL | + SHARED_FLAG_ICE | SHARED_FLAG_TRICKLE_ICE | SHARED_FLAG_ICE_LITE); crypto_params_copy(&other_media->sdes_in.params, &sp->crypto, 1); other_media->sdes_in.tag = sp->sdes_tag; diff --git a/daemon/call.h b/daemon/call.h index 28f5c26e0..79a461650 100644 --- a/daemon/call.h +++ b/daemon/call.h @@ -124,6 +124,7 @@ enum call_stream_state { #define SHARED_FLAG_MEDIA_HANDOVER 0x00000200 #define SHARED_FLAG_TRICKLE_ICE 0x00000400 #define SHARED_FLAG_ICE_LITE 0x00000800 +#define SHARED_FLAG_UNIDIRECTIONAL 0x00001000 /* struct stream_params */ #define SP_FLAG_NO_RTCP 0x00010000 @@ -132,6 +133,7 @@ enum call_stream_state { #define SP_FLAG_SEND SHARED_FLAG_SEND #define SP_FLAG_RECV SHARED_FLAG_RECV #define SP_FLAG_ASYMMETRIC SHARED_FLAG_ASYMMETRIC +#define SP_FLAG_UNIDIRECTIONAL SHARED_FLAG_UNIDIRECTIONAL #define SP_FLAG_SETUP_ACTIVE SHARED_FLAG_SETUP_ACTIVE #define SP_FLAG_SETUP_PASSIVE SHARED_FLAG_SETUP_PASSIVE #define SP_FLAG_ICE SHARED_FLAG_ICE @@ -159,6 +161,7 @@ enum call_stream_state { /* struct call_media */ #define MEDIA_FLAG_INITIALIZED 0x00010000 #define MEDIA_FLAG_ASYMMETRIC SHARED_FLAG_ASYMMETRIC +#define MEDIA_FLAG_UNIDIRECTIONAL SHARED_FLAG_UNIDIRECTIONAL #define MEDIA_FLAG_SEND SHARED_FLAG_SEND #define MEDIA_FLAG_RECV SHARED_FLAG_RECV #define MEDIA_FLAG_RTCP_MUX SHARED_FLAG_RTCP_MUX diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index c7b4fd5ec..224649c13 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -541,6 +541,8 @@ static void call_ng_process_flags(struct sdp_ng_flags *out, bencode_item_t *inpu out->trust_address = 0; else if (!bencode_strcmp(it, "asymmetric")) out->asymmetric = 1; + else if (!bencode_strcmp(it, "unidirectional")) + out->unidirectional = 1; else if (!bencode_strcmp(it, "strict-source")) out->strict_source = 1; else if (!bencode_strcmp(it, "media-handover")) diff --git a/daemon/call_interfaces.h b/daemon/call_interfaces.h index 23ee7bea8..214861ec0 100644 --- a/daemon/call_interfaces.h +++ b/daemon/call_interfaces.h @@ -31,6 +31,7 @@ struct sdp_ng_flags { sockfamily_t *address_family; int tos; int asymmetric:1, + unidirectional:1, trust_address:1, port_latching:1, replace_origin:1, diff --git a/daemon/media_socket.c b/daemon/media_socket.c index b9e1e7328..4d719171b 100644 --- a/daemon/media_socket.c +++ b/daemon/media_socket.c @@ -1204,6 +1204,11 @@ loop_ok: if (MEDIA_ISSET(media, ASYMMETRIC)) PS_SET(stream, CONFIRMED); + /* confirm sink for unidirectional streams in order to kernelize */ + if (MEDIA_ISSET(media, UNIDIRECTIONAL)) { + PS_SET(sink, CONFIRMED); + } + /* if we have already updated the endpoint in the past ... */ if (PS_ISSET(stream, CONFIRMED)) { /* see if we need to compare the source address with the known endpoint */ diff --git a/daemon/sdp.c b/daemon/sdp.c index 454fac211..4b03276fe 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -1188,6 +1188,7 @@ int sdp_streams(const GQueue *sessions, GQueue *streams, struct sdp_ng_flags *fl memcpy(sp->direction, flags->direction, sizeof(sp->direction)); sp->desired_family = flags->address_family; bf_set_clear(&sp->sp_flags, SP_FLAG_ASYMMETRIC, flags->asymmetric); + bf_set_clear(&sp->sp_flags, SP_FLAG_UNIDIRECTIONAL, flags->unidirectional); bf_set_clear(&sp->sp_flags, SP_FLAG_STRICT_SOURCE, flags->strict_source); bf_set_clear(&sp->sp_flags, SP_FLAG_MEDIA_HANDOVER, flags->media_handover);