Browse Source

TT#75352 add a storage container for codec handlers

The hash table cannot be used for storage any more as entries can be
removed on demand (64e56d7) but can be cached in packet->handler at the
same time.

Possibly fixes #915

Change-Id: Ic74703b1a57294bfd704b6cddcd666d6063f510a
(cherry picked from commit d3992101bd)
changes/98/37498/1
Richard Fuchs 6 years ago
parent
commit
7ebc418a65
2 changed files with 4 additions and 2 deletions
  1. +3
    -2
      daemon/codec.c
  2. +1
    -0
      include/call.h

+ 3
- 2
daemon/codec.c View File

@ -192,8 +192,7 @@ void codec_handlers_update(struct call_media *receiver, struct call_media *sink,
const struct sdp_ng_flags *flags)
{
if (!receiver->codec_handlers)
receiver->codec_handlers = g_hash_table_new_full(g_int_hash, g_int_equal,
NULL, __codec_handler_free);
receiver->codec_handlers = g_hash_table_new(g_int_hash, g_int_equal);
MEDIA_CLEAR(receiver, TRANSCODE);
receiver->rtcp_handler = NULL;
@ -351,6 +350,7 @@ void codec_handlers_update(struct call_media *receiver, struct call_media *sink,
handler = __handler_new(pt);
g_hash_table_insert(receiver->codec_handlers, &handler->source_pt.payload_type,
handler);
g_queue_push_tail(&receiver->codec_handlers_store, handler);
}
// check our own support for this codec
@ -513,6 +513,7 @@ void codec_handlers_free(struct call_media *m) {
g_hash_table_destroy(m->codec_handlers);
m->codec_handlers = NULL;
m->codec_handler_cache = NULL;
g_queue_clear_full(&m->codec_handlers_store, __codec_handler_free);
}


+ 1
- 0
include/call.h View File

@ -339,6 +339,7 @@ struct call_media {
GHashTable *codec_handlers; // int payload type -> struct codec_handler
// XXX combine this with 'codecs_recv' hash table?
GQueue codec_handlers_store; // storage for struct codec_handler
volatile struct codec_handler *codec_handler_cache;
struct rtcp_handler *rtcp_handler;


Loading…
Cancel
Save