提交 27cb8ebd authored 作者: Mike Jerris's avatar Mike Jerris

Merge pull request #872 in FS/freeswitch from…

Merge pull request #872 in FS/freeswitch from bugfix/FS-9136-freeswitch-sends-b-leg-sdp-different to master

* commit '50d7a80f':
  FS-9136: allow multiple instances of same video codec with different fmtp
...@@ -286,6 +286,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_payload_code(switch_core ...@@ -286,6 +286,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_payload_code(switch_core
switch_media_type_t type, switch_media_type_t type,
const char *iananame, const char *iananame,
uint32_t rate, uint32_t rate,
const char *fmtp_in,
switch_payload_t *ptP, switch_payload_t *ptP,
switch_payload_t *recv_ptP, switch_payload_t *recv_ptP,
char **fmtpP); char **fmtpP);
......
...@@ -117,7 +117,7 @@ SWITCH_DECLARE(switch_endpoint_interface_t *) switch_loadable_module_get_endpoin ...@@ -117,7 +117,7 @@ SWITCH_DECLARE(switch_endpoint_interface_t *) switch_loadable_module_get_endpoin
*/ */
SWITCH_DECLARE(switch_codec_interface_t *) switch_loadable_module_get_codec_interface(const char *name, const char *modname); SWITCH_DECLARE(switch_codec_interface_t *) switch_loadable_module_get_codec_interface(const char *name, const char *modname);
SWITCH_DECLARE(char *) switch_parse_codec_buf(char *buf, uint32_t *interval, uint32_t *rate, uint32_t *bit, uint32_t *channels, char **modname); SWITCH_DECLARE(char *) switch_parse_codec_buf(char *buf, uint32_t *interval, uint32_t *rate, uint32_t *bit, uint32_t *channels, char **modname, char **fmtp);
/*! /*!
\brief Retrieve the dialplan interface by it's registered name \brief Retrieve the dialplan interface by it's registered name
...@@ -272,7 +272,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs(const switch_codec_impleme ...@@ -272,7 +272,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs(const switch_codec_impleme
\return the number of elements added to the array \return the number of elements added to the array
\note this function only considers codecs that are listed in the "prefs" array and ignores the rest. \note this function only considers codecs that are listed in the "prefs" array and ignores the rest.
*/ */
SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_implementation_t **array, int arraylen, char **prefs, int preflen); SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_implementation_t **array, char fmtp_array[SWITCH_MAX_CODECS][MAX_FMTP_LEN], int arraylen, char **prefs, int preflen);
/*! /*!
\brief Execute a registered API command \brief Execute a registered API command
......
...@@ -234,6 +234,8 @@ SWITCH_BEGIN_EXTERN_C ...@@ -234,6 +234,8 @@ SWITCH_BEGIN_EXTERN_C
#define SWITCH_RTCP_AUDIO_INTERVAL_MSEC "5000" #define SWITCH_RTCP_AUDIO_INTERVAL_MSEC "5000"
#define SWITCH_RTCP_VIDEO_INTERVAL_MSEC "2000" #define SWITCH_RTCP_VIDEO_INTERVAL_MSEC "2000"
#define MAX_FMTP_LEN 256
/* Jitter */ /* Jitter */
#define JITTER_VARIANCE_THRESHOLD 400.0 #define JITTER_VARIANCE_THRESHOLD 400.0
/* IPDV */ /* IPDV */
......
...@@ -142,7 +142,7 @@ static switch_status_t tech_init(loopback_private_t *tech_pvt, switch_core_sessi ...@@ -142,7 +142,7 @@ static switch_status_t tech_init(loopback_private_t *tech_pvt, switch_core_sessi
if ((var = switch_channel_get_variable(channel, "loopback_initial_codec"))) { if ((var = switch_channel_get_variable(channel, "loopback_initial_codec"))) {
char *dup = switch_core_session_strdup(session, var); char *dup = switch_core_session_strdup(session, var);
uint32_t bit, channels; uint32_t bit, channels;
iananame = switch_parse_codec_buf(dup, &interval, &rate, &bit, &channels, &codec_modname); iananame = switch_parse_codec_buf(dup, &interval, &rate, &bit, &channels, &codec_modname, NULL);
} }
} }
......
差异被折叠。
...@@ -2340,7 +2340,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs(const switch_codec_impleme ...@@ -2340,7 +2340,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs(const switch_codec_impleme
} }
SWITCH_DECLARE(char *) switch_parse_codec_buf(char *buf, uint32_t *interval, uint32_t *rate, uint32_t *bit, uint32_t *channels, char **modname) SWITCH_DECLARE(char *) switch_parse_codec_buf(char *buf, uint32_t *interval, uint32_t *rate, uint32_t *bit, uint32_t *channels, char **modname, char **fmtp)
{ {
char *cur, *next = NULL, *name, *p; char *cur, *next = NULL, *name, *p;
...@@ -2380,10 +2380,17 @@ SWITCH_DECLARE(char *) switch_parse_codec_buf(char *buf, uint32_t *interval, uin ...@@ -2380,10 +2380,17 @@ SWITCH_DECLARE(char *) switch_parse_codec_buf(char *buf, uint32_t *interval, uin
name = p; name = p;
} }
if ((p = strchr(name, '~'))) {
*p++ = '\0';
if (fmtp) {
*fmtp = p;
}
}
return name; return name;
} }
SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_implementation_t **array, int arraylen, char **prefs, int preflen) SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_implementation_t **array, char fmtp_array[SWITCH_MAX_CODECS][MAX_FMTP_LEN], int arraylen, char **prefs, int preflen)
{ {
int x, i = 0, j = 0; int x, i = 0, j = 0;
switch_codec_interface_t *codec_interface; switch_codec_interface_t *codec_interface;
...@@ -2392,14 +2399,14 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_ ...@@ -2392,14 +2399,14 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
switch_mutex_lock(loadable_modules.mutex); switch_mutex_lock(loadable_modules.mutex);
for (x = 0; x < preflen; x++) { for (x = 0; x < preflen; x++) {
char *name, buf[256], jbuf[256], *modname = NULL; char *name, buf[256], jbuf[256], *modname = NULL, *fmtp = NULL;
uint32_t interval = 0, rate = 0, bit = 0, channels = 1; uint32_t interval = 0, rate = 0, bit = 0, channels = 1;
switch_copy_string(buf, prefs[x], sizeof(buf)); switch_copy_string(buf, prefs[x], sizeof(buf));
name = switch_parse_codec_buf(buf, &interval, &rate, &bit, &channels, &modname); name = switch_parse_codec_buf(buf, &interval, &rate, &bit, &channels, &modname, &fmtp);
for(j = 0; j < x; j++) { for(j = 0; j < x; j++) {
char *jname, *jmodname = NULL; char *jname, *jmodname = NULL, *jfmtp = NULL;
uint32_t jinterval = 0, jrate = 0, jbit = 0, jchannels = 1; uint32_t jinterval = 0, jrate = 0, jbit = 0, jchannels = 1;
uint32_t ointerval = interval, orate = rate, ochannels = channels; uint32_t ointerval = interval, orate = rate, ochannels = channels;
...@@ -2416,7 +2423,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_ ...@@ -2416,7 +2423,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
} }
switch_copy_string(jbuf, prefs[j], sizeof(jbuf)); switch_copy_string(jbuf, prefs[j], sizeof(jbuf));
jname = switch_parse_codec_buf(jbuf, &jinterval, &jrate, &jbit, &jchannels, &jmodname); jname = switch_parse_codec_buf(jbuf, &jinterval, &jrate, &jbit, &jchannels, &jmodname, &jfmtp);
if (jinterval == 0) { if (jinterval == 0) {
jinterval = switch_default_ptime(jname, 0); jinterval = switch_default_ptime(jname, 0);
...@@ -2430,7 +2437,8 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_ ...@@ -2430,7 +2437,8 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
jchannels = 1; jchannels = 1;
} }
if (!strcasecmp(name, jname) && ointerval == jinterval && orate == jrate && ochannels == jchannels) { if (!strcasecmp(name, jname) && ointerval == jinterval && orate == jrate && ochannels == jchannels &&
!strcasecmp(switch_str_nil(fmtp), switch_str_nil(jfmtp))) {
goto next_x; goto next_x;
} }
} }
...@@ -2462,7 +2470,9 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_ ...@@ -2462,7 +2470,9 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
} }
} }
if (!zstr(fmtp)) {
switch_set_string(fmtp_array[i], fmtp);
}
array[i++] = imp; array[i++] = imp;
goto found; goto found;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论