Browse Source

MT#55283 move kernelize_state into scope

That gives us the benefit of not needing the manual cleanup.

Change-Id: Ia5681d0bcb60c887a4174adddd5076eb324105bf
pull/1998/head
Richard Fuchs 4 months ago
parent
commit
7cf0b86240
1 changed files with 6 additions and 13 deletions
  1. +6
    -13
      daemon/media_socket.c

+ 6
- 13
daemon/media_socket.c View File

@ -1550,7 +1550,7 @@ typedef struct {
static void kernelize_state_clear(kernelize_state *s) {
rtp_stats_arr_destroy_ptr(&s->payload_types);
t_queue_clear_full(&s->outputs,
(void (*)(struct rtpengine_destination_info *)) g_free); // should always be empty
(void (*)(struct rtpengine_destination_info *)) g_free);
}
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(kernelize_state, kernelize_state_clear)
@ -1862,10 +1862,11 @@ static bool kernelize_one_sink_handler(kernelize_state *s,
static void kernelize(struct packet_stream *stream) {
call_t *call = stream->call;
struct call_media *media = stream->media;
g_auto(kernelize_state) s = {0};
while (true) {
g_auto(kernelize_state) s = {0};
LOCK(&stream->lock);
// set flag, return if set already
@ -1898,14 +1899,14 @@ static void kernelize(struct packet_stream *stream) {
continue;
bool ok = kernelize_one_sink_handler(&s, stream, sh);
if (!ok)
goto restart;
continue; // retry
}
// RTP egress mirrors
for (__auto_type l = stream->rtp_mirrors.head; l; l = l->next) {
struct sink_handler *sh = l->data;
bool ok = kernelize_one_sink_handler(&s, stream, sh);
if (!ok)
goto restart;
continue; // retry
}
// RTP -> RTCP sinks
// record number of RTP destinations up to now
@ -1916,7 +1917,7 @@ static void kernelize(struct packet_stream *stream) {
struct sink_handler *sh = l->data;
bool ok = kernelize_one_sink_handler(&s, stream, sh);
if (!ok)
goto restart;
continue; // retry
}
// mark the start of RTCP outputs
s.reti.num_rtcp_destinations = s.reti.num_destinations - num_rtp_dests;
@ -1948,14 +1949,6 @@ no_kernel:
PS_SET(stream, NO_KERNEL_SUPPORT);
return;
restart: // handle detected deadlock
rtp_stats_arr_destroy_ptr(&s.payload_types);
while ((redi = t_queue_pop_head(&s.outputs)))
g_free(redi);
// try again, releases stream->lock
}
}


Loading…
Cancel
Save