mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-14 08:05:37 +00:00
make exception for g722
This commit is contained in:
parent
3482cd5b80
commit
82c27013d7
@ -658,7 +658,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init_with_bitrate(switch_codec
|
||||
/* If no specific codec interval is requested opt for 20ms above all else because lots of stuff assumes it */
|
||||
if (!ms) {
|
||||
for (iptr = codec_interface->implementations; iptr; iptr = iptr->next) {
|
||||
if ((!rate || rate == iptr->samples_per_second) && (!bitrate || bitrate == (uint32_t)iptr->bits_per_second) &&
|
||||
uint32_t crate = !strcasecmp(codec_name, "g722") ? iptr->samples_per_second : iptr->actual_samples_per_second;
|
||||
if ((!rate || rate == crate) && (!bitrate || bitrate == (uint32_t)iptr->bits_per_second) &&
|
||||
(20 == (iptr->microseconds_per_packet / 1000)) && (!channels || channels == iptr->number_of_channels)) {
|
||||
implementation = iptr;
|
||||
goto found;
|
||||
@ -668,7 +669,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init_with_bitrate(switch_codec
|
||||
|
||||
/* Either looking for a specific interval or there was no interval specified and there wasn't one @20ms available */
|
||||
for (iptr = codec_interface->implementations; iptr; iptr = iptr->next) {
|
||||
if ((!rate || rate == iptr->samples_per_second) && (!bitrate || bitrate == (uint32_t)iptr->bits_per_second) &&
|
||||
uint32_t crate = !strcasecmp(codec_name, "g722") ? iptr->samples_per_second : iptr->actual_samples_per_second;
|
||||
if ((!rate || rate == crate) && (!bitrate || bitrate == (uint32_t)iptr->bits_per_second) &&
|
||||
(!ms || ms == (iptr->microseconds_per_packet / 1000)) && (!channels || channels == iptr->number_of_channels)) {
|
||||
implementation = iptr;
|
||||
break;
|
||||
|
@ -2251,13 +2251,14 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
|
||||
uint32_t default_rate = switch_default_rate(imp->iananame, imp->ianacode);
|
||||
|
||||
if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) {
|
||||
|
||||
uint32_t crate = !strcasecmp(imp->iananame, "g722") ? imp->samples_per_second : imp->actual_samples_per_second;
|
||||
|
||||
if ((!interval && (uint32_t) (imp->microseconds_per_packet / 1000) != default_ptime) ||
|
||||
(interval && (uint32_t) (imp->microseconds_per_packet / 1000) != interval)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (((!rate && (uint32_t) imp->actual_samples_per_second != default_rate) || (rate && (uint32_t) imp->actual_samples_per_second != rate))) {
|
||||
if (((!rate && crate != default_rate) || (rate && (uint32_t) imp->actual_samples_per_second != rate))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -2276,12 +2277,13 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
|
||||
/* Either looking for a specific interval or there was no interval specified and there wasn't one at the default ptime available */
|
||||
for (imp = codec_interface->implementations; imp; imp = imp->next) {
|
||||
if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) {
|
||||
uint32_t crate = !strcasecmp(imp->iananame, "g722") ? imp->samples_per_second : imp->actual_samples_per_second;
|
||||
|
||||
if (interval && (uint32_t) (imp->microseconds_per_packet / 1000) != interval) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rate && (uint32_t) imp->actual_samples_per_second != rate) {
|
||||
if (rate && (uint32_t) crate != rate) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user