Browse Source

TT#91151 rapid push to kernel even when sink is unconfirmed

Change-Id: I2dc8638a05ba94f33f980db82ae8c4f8c63301f9
pull/1311/head
Richard Fuchs 5 years ago
parent
commit
ba7a75371c
1 changed files with 21 additions and 7 deletions
  1. +21
    -7
      daemon/media_socket.c

+ 21
- 7
daemon/media_socket.c View File

@ -63,6 +63,7 @@ struct packet_handler_ctx {
// verdicts:
int update; // true if Redis info needs to be updated
int unkernelize; // true if stream ought to be removed from kernel
int unkernelize_subscriptions; // if our peer address changed
int kernelize; // true if stream can be kernelized
int rtcp_discard; // do not forward RTCP
@ -1401,6 +1402,9 @@ static void __stream_update_stats(struct packet_stream *ps, int have_in_lock) {
void __unkernelize(struct packet_stream *p) {
struct re_address rea;
if (!p->selected_sfd)
return;
if (!PS_ISSET(p, KERNELIZED))
return;
if (PS_ISSET(p, NO_KERNEL_SUPPORT))
@ -2003,6 +2007,7 @@ static int media_packet_address_check(struct packet_handler_ctx *phc)
confirm_now:
phc->kernelize = 1;
phc->update = 1;
phc->unkernelize_subscriptions = 1;
ilog(LOG_INFO, "Confirmed peer address as %s%s%s", FMT_M(endpoint_print_buf(use_endpoint_confirm)));
@ -2021,6 +2026,7 @@ update_peerinfo:
if (memcmp(&endpoint, &phc->mp.stream->endpoint, sizeof(endpoint))) {
phc->unkernelize = 1;
phc->update = 1;
phc->unkernelize_subscriptions = 1;
}
}
update_addr:
@ -2033,6 +2039,7 @@ update_addr:
phc->mp.stream->selected_sfd = phc->mp.sfd;
phc->unkernelize = 1;
phc->update = 1;
phc->unkernelize_subscriptions = 1;
}
out:
@ -2066,13 +2073,6 @@ static void media_packet_kernel_check(struct packet_handler_ctx *phc) {
if (MEDIA_ISSET(sh->sink->media, ASYMMETRIC))
PS_SET(sh->sink, CONFIRMED);
if (!PS_ISSET(sh->sink, CONFIRMED)) {
__C_DBG("sink not CONFIRMED for stream %s:%d",
sockaddr_print_buf(&phc->mp.stream->endpoint.address),
phc->mp.stream->endpoint.port);
return;
}
if (!PS_ISSET(sh->sink, FILLED)) {
__C_DBG("sink not FILLED for stream %s:%d", sockaddr_print_buf(&phc->mp.stream->endpoint.address),
phc->mp.stream->endpoint.port);
@ -2398,6 +2398,20 @@ out:
unconfirm_sinks(&phc->mp.stream->rtp_sinks);
unconfirm_sinks(&phc->mp.stream->rtcp_sinks);
}
if (phc->unkernelize_subscriptions) {
// XXX optimise this triple loop?
for (GList *l = phc->mp.media->monologue->subscriptions.head; l; l = l->next) {
struct call_subscription *cs = l->data;
struct call_monologue *sub = cs->monologue;
for (GList *k = sub->medias.head; k; k = k->next) {
struct call_media *sub_media = k->data;
for (GList *m = sub_media->streams.head; m; m = m->next) {
struct packet_stream *sub_ps = m->data;
__unkernelize(sub_ps);
}
}
}
}
if (handler_ret < 0) {
atomic64_inc(&phc->mp.stream->stats.errors);


Loading…
Cancel
Save