diff --git a/daemon/codec.c b/daemon/codec.c index 0c21ab253..a274ec44c 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -1669,7 +1669,7 @@ static void codec_add_raw_packet_common(struct media_packet *mp, unsigned int cl if (!p->rtp) p->rtp = mp->rtp; } - g_queue_push_tail(&mp->packets_out, p); + t_queue_push_tail(&mp->packets_out, p); } void codec_add_raw_packet(struct media_packet *mp, unsigned int clockrate) { struct codec_packet *p = g_slice_alloc0(sizeof(*p)); @@ -2061,7 +2061,7 @@ send: (long unsigned) p->ttq_entry.when.tv_sec, (long unsigned) p->ttq_entry.when.tv_usec); - g_queue_push_tail(&mp->packets_out, p); + t_queue_push_tail(&mp->packets_out, p); } // returns new reference diff --git a/daemon/media_socket.c b/daemon/media_socket.c index 5377db6aa..212fd9713 100644 --- a/daemon/media_socket.c +++ b/daemon/media_socket.c @@ -2340,7 +2340,7 @@ int media_packet_encrypt(rewrite_func encrypt_func, struct packet_stream *out, s mutex_lock(&out->out_lock); - for (GList *l = mp->packets_out.head; l; l = l->next) { + for (__auto_type l = mp->packets_out.head; l; l = l->next) { struct codec_packet *p = l->data; if (mp->call->recording && rtpe_config.rec_egress) { str_init_dup_str(&p->plain, &p->s); @@ -2617,7 +2617,7 @@ static int do_rtcp_output(struct packet_handler_ctx *phc) { // only frees the output queue if no `sink` is given int media_socket_dequeue(struct media_packet *mp, struct packet_stream *sink) { struct codec_packet *p; - while ((p = g_queue_pop_head(&mp->packets_out))) { + while ((p = t_queue_pop_head(&mp->packets_out))) { if (sink && sink->send_timer) send_timer_push(sink->send_timer, p); else @@ -2628,7 +2628,7 @@ int media_socket_dequeue(struct media_packet *mp, struct packet_stream *sink) { void media_packet_copy(struct media_packet *dst, const struct media_packet *src) { *dst = *src; - g_queue_init(&dst->packets_out); + t_queue_init(&dst->packets_out); if (dst->sfd) obj_hold(dst->sfd); if (dst->ssrc_in) @@ -2654,8 +2654,8 @@ void media_packet_release(struct media_packet *mp) { } -static int media_packet_queue_dup(GQueue *q) { - for (GList *l = q->head; l; l = l->next) { +static int media_packet_queue_dup(codec_packet_q *q) { + for (__auto_type l = q->head; l; l = l->next) { struct codec_packet *p = l->data; if (p->free_func) // nothing to do, already private continue; @@ -2956,7 +2956,7 @@ static int stream_packet(struct packet_handler_ctx *phc) { { struct packet_handler_ctx mirror_phc = *phc; mirror_phc.mp.ssrc_out = NULL; - g_queue_init(&mirror_phc.mp.packets_out); + t_queue_init(&mirror_phc.mp.packets_out); struct sink_handler *mirror_sh = mirror_link->data; struct packet_stream *mirror_sink = mirror_sh->sink; @@ -2965,9 +2965,9 @@ static int stream_packet(struct packet_handler_ctx *phc) { media_packet_rtp_out(&mirror_phc, mirror_sh); media_packet_set_encrypt(&mirror_phc, mirror_sh); - for (GList *pack = phc->mp.packets_out.head; pack; pack = pack->next) { + for (__auto_type pack = phc->mp.packets_out.head; pack; pack = pack->next) { struct codec_packet *p = pack->data; - g_queue_push_tail(&mirror_phc.mp.packets_out, codec_packet_dup(p)); + t_queue_push_tail(&mirror_phc.mp.packets_out, codec_packet_dup(p)); } ret = __media_packet_encrypt(&mirror_phc, mirror_sh); @@ -3000,7 +3000,7 @@ next_mirror: goto err_next; if (ret == 1) { - for (GList *l = phc->mp.packets_out.head; l; l = l->next) { + for (__auto_type l = phc->mp.packets_out.head; l; l = l->next) { struct codec_packet *p = l->data; __re_address_translate_ep(&p->kernel_send_info.local, &phc->mp.stream->selected_sfd->socket.local); diff --git a/include/media_socket.h b/include/media_socket.h index d3f0ed2fb..673d8a915 100644 --- a/include/media_socket.h +++ b/include/media_socket.h @@ -13,6 +13,7 @@ #include "socket.h" #include "xt_RTPENGINE.h" #include "containers.h" +#include "types.h" @@ -281,7 +282,7 @@ struct media_packet { struct ssrc_ctx *ssrc_in, *ssrc_out; // SSRC contexts from in_srtp and out_srtp str payload; - GQueue packets_out; + codec_packet_q packets_out; int ptime; // returned from decoding }; diff --git a/include/types.h b/include/types.h index 5b3e7530b..eb44e7866 100644 --- a/include/types.h +++ b/include/types.h @@ -25,4 +25,7 @@ struct codec_handler; TYPED_GHASHTABLE_PROTO(codec_handlers_ht, struct codec_handler, struct codec_handler) TYPED_GQUEUE(codec_handlers, struct codec_handler) +struct codec_packet; +TYPED_GQUEUE(codec_packet, struct codec_packet) + #endif diff --git a/t/test-transcode.c b/t/test-transcode.c index 2701ba860..eaa567ad5 100644 --- a/t/test-transcode.c +++ b/t/test-transcode.c @@ -301,7 +301,7 @@ static void __packet_seq_ts(const char *file, int line, struct call_media *media printf("no packet\n"); abort(); } - struct codec_packet *cp = g_queue_pop_head(&mp.packets_out); + struct codec_packet *cp = t_queue_pop_head(&mp.packets_out); str cp_s = cp->s; rtp = (void *) cp_s.s; if (rtp->m_pt != (unsigned char) pt_out) {