|
|
@ -146,25 +146,22 @@ static void __make_dtmf(struct codec_handler *handler) {
|
|
|
|
handler->ssrc_hash = create_ssrc_hash_full(__ssrc_handler_new, handler);
|
|
|
|
handler->ssrc_hash = create_ssrc_hash_full(__ssrc_handler_new, handler);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void __make_transcoder(struct codec_handler *handler, struct rtp_payload_type *source,
|
|
|
|
static void __make_transcoder(struct codec_handler *handler, struct rtp_payload_type *dest)
|
|
|
|
struct rtp_payload_type *dest)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
assert(source->codec_def != NULL);
|
|
|
|
assert(handler->source_pt.codec_def != NULL);
|
|
|
|
assert(dest->codec_def != NULL);
|
|
|
|
assert(dest->codec_def != NULL);
|
|
|
|
assert(source->payload_type == handler->source_pt.payload_type);
|
|
|
|
assert(handler->source_pt.payload_type == handler->source_pt.payload_type);
|
|
|
|
|
|
|
|
|
|
|
|
// don't reset handler if it already matches what we want
|
|
|
|
// don't reset handler if it already matches what we want
|
|
|
|
if (!handler->transcoder)
|
|
|
|
if (!handler->transcoder)
|
|
|
|
goto reset;
|
|
|
|
goto reset;
|
|
|
|
if (rtp_payload_type_cmp(source, &handler->source_pt))
|
|
|
|
|
|
|
|
goto reset;
|
|
|
|
|
|
|
|
if (rtp_payload_type_cmp(dest, &handler->dest_pt))
|
|
|
|
if (rtp_payload_type_cmp(dest, &handler->dest_pt))
|
|
|
|
goto reset;
|
|
|
|
goto reset;
|
|
|
|
if (handler->func != handler_func_transcode)
|
|
|
|
if (handler->func != handler_func_transcode)
|
|
|
|
goto reset;
|
|
|
|
goto reset;
|
|
|
|
|
|
|
|
|
|
|
|
ilog(LOG_DEBUG, "Leaving transcode context for " STR_FORMAT " -> " STR_FORMAT " intact",
|
|
|
|
ilog(LOG_DEBUG, "Leaving transcode context for " STR_FORMAT " -> " STR_FORMAT " intact",
|
|
|
|
STR_FMT(&source->encoding_with_params),
|
|
|
|
STR_FMT(&handler->source_pt.encoding_with_params),
|
|
|
|
STR_FMT(&dest->encoding_with_params));
|
|
|
|
STR_FMT(&dest->encoding_with_params));
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -172,7 +169,6 @@ static void __make_transcoder(struct codec_handler *handler, struct rtp_payload_
|
|
|
|
reset:
|
|
|
|
reset:
|
|
|
|
__handler_shutdown(handler);
|
|
|
|
__handler_shutdown(handler);
|
|
|
|
|
|
|
|
|
|
|
|
handler->source_pt = *source;
|
|
|
|
|
|
|
|
handler->dest_pt = *dest;
|
|
|
|
handler->dest_pt = *dest;
|
|
|
|
handler->func = handler_func_transcode;
|
|
|
|
handler->func = handler_func_transcode;
|
|
|
|
handler->transcoder = 1;
|
|
|
|
handler->transcoder = 1;
|
|
|
@ -180,7 +176,7 @@ reset:
|
|
|
|
handler->ssrc_hash = create_ssrc_hash_full(__ssrc_handler_transcode_new, handler);
|
|
|
|
handler->ssrc_hash = create_ssrc_hash_full(__ssrc_handler_transcode_new, handler);
|
|
|
|
|
|
|
|
|
|
|
|
ilog(LOG_DEBUG, "Created transcode context for " STR_FORMAT " -> " STR_FORMAT "",
|
|
|
|
ilog(LOG_DEBUG, "Created transcode context for " STR_FORMAT " -> " STR_FORMAT "",
|
|
|
|
STR_FMT(&source->encoding_with_params),
|
|
|
|
STR_FMT(&handler->source_pt.encoding_with_params),
|
|
|
|
STR_FMT(&dest->encoding_with_params));
|
|
|
|
STR_FMT(&dest->encoding_with_params));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -387,6 +383,7 @@ done:;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// first, make sure we have a codec_handler struct for this
|
|
|
|
// first, make sure we have a codec_handler struct for this
|
|
|
|
|
|
|
|
__ensure_codec_def(pt, receiver);
|
|
|
|
struct codec_handler *handler;
|
|
|
|
struct codec_handler *handler;
|
|
|
|
handler = g_hash_table_lookup(receiver->codec_handlers, &pt->payload_type);
|
|
|
|
handler = g_hash_table_lookup(receiver->codec_handlers, &pt->payload_type);
|
|
|
|
if (!handler) {
|
|
|
|
if (!handler) {
|
|
|
@ -398,8 +395,6 @@ done:;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// check our own support for this codec
|
|
|
|
// check our own support for this codec
|
|
|
|
__ensure_codec_def(pt, receiver);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!pt->codec_def || pt->codec_def->pseudocodec) {
|
|
|
|
if (!pt->codec_def || pt->codec_def->pseudocodec) {
|
|
|
|
// not supported, or not a real audio codec
|
|
|
|
// not supported, or not a real audio codec
|
|
|
|
if (pt->codec_def && pt->codec_def->dtmf)
|
|
|
|
if (pt->codec_def && pt->codec_def->dtmf)
|
|
|
@ -483,7 +478,7 @@ transcode:;
|
|
|
|
dest_pt->bitrate = reverse_pt->bitrate;
|
|
|
|
dest_pt->bitrate = reverse_pt->bitrate;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MEDIA_SET(receiver, TRANSCODE);
|
|
|
|
MEDIA_SET(receiver, TRANSCODE);
|
|
|
|
__make_transcoder(handler, pt, dest_pt);
|
|
|
|
__make_transcoder(handler, dest_pt);
|
|
|
|
|
|
|
|
|
|
|
|
next:
|
|
|
|
next:
|
|
|
|
l = l->next;
|
|
|
|
l = l->next;
|
|
|
|