TT#76711 split codec_handler_get for different protocols

Change-Id: I67573100108aedb1c8e7fc5920682a7872fd10c2
changes/46/38346/7
Richard Fuchs 6 years ago
parent 2d78c36338
commit de69c5ed1f

@ -766,33 +766,44 @@ next:
}
#endif
// call must be locked in R
struct codec_handler *codec_handler_get(struct call_media *m, int payload_type) {
#ifdef WITH_TRANSCODING
static struct codec_handler *codec_handler_get_rtp(struct call_media *m, int payload_type) {
struct codec_handler *h;
if (payload_type < 0)
goto out;
return NULL;
h = g_atomic_pointer_get(&m->codec_handler_cache);
if (G_LIKELY(G_LIKELY(h) && G_LIKELY(h->source_pt.payload_type == payload_type)))
return h;
if (G_UNLIKELY(!m->codec_handlers))
goto out;
return NULL;
h = g_hash_table_lookup(m->codec_handlers, GINT_TO_POINTER(payload_type));
if (!h)
goto out;
return NULL;
g_atomic_pointer_set(&m->codec_handler_cache, h);
return h;
}
#endif
// call must be locked in R
struct codec_handler *codec_handler_get(struct call_media *m, int payload_type) {
#ifdef WITH_TRANSCODING
struct codec_handler *ret = NULL;
if (!m->protocol)
goto out;
if (m->protocol->rtp)
ret = codec_handler_get_rtp(m, payload_type);
out:
if (ret)
return ret;
if (MEDIA_ISSET(m, TRANSCODE))
return &codec_handler_stub_ssrc;
#endif

@ -61,9 +61,11 @@ static void __start(const char *file, int line) {
ml_A = (struct call_monologue) {0,};
str_init(&ml_A.tag, "tag_A");
media_A->monologue = &ml_A;
media_A->protocol = &transport_protocols[PROTO_RTP_AVP];
ml_B = (struct call_monologue) {0,};
str_init(&ml_B.tag, "tag_B");
media_B->monologue = &ml_B;
media_B->protocol = &transport_protocols[PROTO_RTP_AVP];
g_queue_init(&rtp_types); // parsed from received SDP
flags.codec_strip = g_hash_table_new_full(str_hash, str_equal, str_slice_free, NULL);
flags.codec_mask = g_hash_table_new_full(str_hash, str_equal, str_slice_free, NULL);

Loading…
Cancel
Save