From 9215c9382714e04c5dfae40aaad2f0dfef259dfc Mon Sep 17 00:00:00 2001 From: Giacomo Vacca Date: Mon, 8 Sep 2014 14:26:58 +0000 Subject: [PATCH] FS-6785 - pass and use sample rate in switch_core_session_get_payload_code() --- src/include/switch_core_media.h | 1 + src/switch_core_media.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/include/switch_core_media.h b/src/include/switch_core_media.h index 1dfc4688c9..59e1b02b34 100644 --- a/src/include/switch_core_media.h +++ b/src/include/switch_core_media.h @@ -255,6 +255,7 @@ SWITCH_DECLARE(void) switch_core_session_clear_crypto(switch_core_session_t *ses SWITCH_DECLARE(switch_status_t) switch_core_session_get_payload_code(switch_core_session_t *session, switch_media_type_t type, const char *iananame, + uint32_t rate, switch_payload_t *ptP, switch_payload_t *recv_ptP, char **fmtpP); diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 505f024c3e..e09b8108c9 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -516,6 +516,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_process_t38_passthru(switch_co SWITCH_DECLARE(switch_status_t) switch_core_session_get_payload_code(switch_core_session_t *session, switch_media_type_t type, const char *iananame, + uint32_t rate, switch_payload_t *ptP, switch_payload_t *recv_ptP, char **fmtpP) @@ -540,7 +541,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_payload_code(switch_core if (!pmap->allocated) continue; - if (!strcasecmp(pmap->iananame, iananame)) { + if (!strcasecmp(pmap->iananame, iananame) && (!rate || (rate == pmap->rate))) { pt = pmap->pt; recv_pt = pmap->recv_pt; fmtp = pmap->rm_fmtp; @@ -6229,7 +6230,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess if (orig_session && switch_core_session_get_payload_code(orig_session, imp->codec_type == SWITCH_CODEC_TYPE_AUDIO ? SWITCH_MEDIA_TYPE_AUDIO : SWITCH_MEDIA_TYPE_VIDEO, - imp->iananame, &orig_pt, NULL, &orig_fmtp) == SWITCH_STATUS_SUCCESS) { + imp->iananame, imp->samples_per_second, &orig_pt, NULL, &orig_fmtp) == SWITCH_STATUS_SUCCESS) { smh->ianacodes[i] = orig_pt; if (orig_fmtp) {