codec tweaks (do a make sure)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4077 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
fcb152104f
commit
db70ef2a37
|
@ -176,7 +176,7 @@ typedef struct switch_directories switch_directories;
|
|||
SWITCH_DECLARE_DATA extern switch_directories SWITCH_GLOBAL_dirs;
|
||||
|
||||
#define SWITCH_THREAD_STACKSIZE 240 * 1024
|
||||
#define SWITCH_RECCOMMENDED_BUFFER_SIZE 2048
|
||||
#define SWITCH_RECCOMMENDED_BUFFER_SIZE 3968
|
||||
#define SWITCH_MAX_CODECS 30
|
||||
#define SWITCH_MAX_STATE_HANDLERS 30
|
||||
#define SWITCH_TRUE 1
|
||||
|
|
|
@ -188,7 +188,6 @@ static switch_status_t switch_g711a_destroy(switch_codec_t *codec)
|
|||
/* Registration */
|
||||
|
||||
|
||||
|
||||
static const switch_codec_implementation_t g711u_8k_60ms_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 0,
|
||||
|
@ -209,7 +208,6 @@ static const switch_codec_implementation_t g711u_8k_60ms_implementation = {
|
|||
/*.destroy */ switch_g711u_destroy
|
||||
};
|
||||
|
||||
#if 0
|
||||
static const switch_codec_implementation_t g711u_8k_30ms_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 0,
|
||||
|
@ -228,32 +226,10 @@ static const switch_codec_implementation_t g711u_8k_30ms_implementation = {
|
|||
/*.encode */ switch_g711u_encode,
|
||||
/*.decode */ switch_g711u_decode,
|
||||
/*.destroy */ switch_g711u_destroy,
|
||||
/*.next */ NULL
|
||||
/*.next*/ &g711u_8k_60ms_implementation
|
||||
};
|
||||
|
||||
static const switch_codec_implementation_t g711u_16k_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 0,
|
||||
/*.iananame */ "PCMU",
|
||||
/*.fmtp */ NULL,
|
||||
/*.samples_per_second */ 16000,
|
||||
/*.bits_per_second */ 128000,
|
||||
/*.microseconds_per_frame */ 20000,
|
||||
/*.samples_per_frame */ 320,
|
||||
/*.bytes_per_frame */ 640,
|
||||
/*.encoded_bytes_per_frame */ 320,
|
||||
/*.number_of_channels */ 1,
|
||||
/*.pref_frames_per_packet */ 1,
|
||||
/*.max_frames_per_packet */ 1,
|
||||
/*.init */ switch_g711u_init,
|
||||
/*.encode */ switch_g711u_encode,
|
||||
/*.decode */ switch_g711u_decode,
|
||||
/*.destroy */ switch_g711u_destroy,
|
||||
/*.next */ &g711u_8k_30ms_implementation
|
||||
};
|
||||
#endif
|
||||
|
||||
static const switch_codec_implementation_t g711u_8k_implementation = {
|
||||
static const switch_codec_implementation_t g711u_8k_20ms_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 0,
|
||||
/*.iananame */ "PCMU",
|
||||
|
@ -271,12 +247,75 @@ static const switch_codec_implementation_t g711u_8k_implementation = {
|
|||
/*.encode */ switch_g711u_encode,
|
||||
/*.decode */ switch_g711u_decode,
|
||||
/*.destroy */ switch_g711u_destroy,
|
||||
///*.next */ &g711u_16k_implementation
|
||||
&g711u_8k_60ms_implementation
|
||||
/*.next*/ &g711u_8k_30ms_implementation
|
||||
};
|
||||
|
||||
static const switch_codec_implementation_t g711u_8k_10ms_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 0,
|
||||
/*.iananame */ "PCMU",
|
||||
/*.fmtp */ NULL,
|
||||
/*.samples_per_second */ 8000,
|
||||
/*.bits_per_second */ 64000,
|
||||
/*.microseconds_per_frame */ 10000,
|
||||
/*.samples_per_frame */ 80,
|
||||
/*.bytes_per_frame */ 160,
|
||||
/*.encoded_bytes_per_frame */ 80,
|
||||
/*.number_of_channels */ 1,
|
||||
/*.pref_frames_per_packet */ 1,
|
||||
/*.max_frames_per_packet */ 1,
|
||||
/*.init */ switch_g711u_init,
|
||||
/*.encode */ switch_g711u_encode,
|
||||
/*.decode */ switch_g711u_decode,
|
||||
/*.destroy */ switch_g711u_destroy,
|
||||
/*.next*/ &g711u_8k_20ms_implementation
|
||||
};
|
||||
|
||||
|
||||
static const switch_codec_implementation_t g711a_8k_implementation = {
|
||||
|
||||
|
||||
static const switch_codec_implementation_t g711a_8k_60ms_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 8,
|
||||
/*.iananame */ "PCMA",
|
||||
/*.fmtp */ NULL,
|
||||
/*.samples_per_second */ 8000,
|
||||
/*.bits_per_second */ 19200,
|
||||
/*.microseconds_per_frame */ 60000,
|
||||
/*.samples_per_frame */ 480,
|
||||
/*.bytes_per_frame */ 960,
|
||||
/*.encoded_bytes_per_frame */ 480,
|
||||
/*.number_of_channels */ 1,
|
||||
/*.pref_frames_per_packet */ 1,
|
||||
/*.max_frames_per_packet */ 1,
|
||||
/*.init */ switch_g711u_init,
|
||||
/*.encode */ switch_g711u_encode,
|
||||
/*.decode */ switch_g711u_decode,
|
||||
/*.destroy */ switch_g711u_destroy,
|
||||
};
|
||||
|
||||
static const switch_codec_implementation_t g711a_8k_30ms_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 8,
|
||||
/*.iananame */ "PCMA",
|
||||
/*.fmtp */ NULL,
|
||||
/*.samples_per_second */ 8000,
|
||||
/*.bits_per_second */ 96000,
|
||||
/*.microseconds_per_frame */ 30000,
|
||||
/*.samples_per_frame */ 240,
|
||||
/*.bytes_per_frame */ 480,
|
||||
/*.encoded_bytes_per_frame */ 240,
|
||||
/*.number_of_channels */ 1,
|
||||
/*.pref_frames_per_packet */ 1,
|
||||
/*.max_frames_per_packet */ 1,
|
||||
/*.init */ switch_g711u_init,
|
||||
/*.encode */ switch_g711u_encode,
|
||||
/*.decode */ switch_g711u_decode,
|
||||
/*.destroy */ switch_g711u_destroy,
|
||||
/*.next*/ &g711a_8k_60ms_implementation
|
||||
};
|
||||
|
||||
static const switch_codec_implementation_t g711a_8k_20ms_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 8,
|
||||
/*.iananame */ "PCMA",
|
||||
|
@ -293,18 +332,41 @@ static const switch_codec_implementation_t g711a_8k_implementation = {
|
|||
/*.init */ switch_g711a_init,
|
||||
/*.encode */ switch_g711a_encode,
|
||||
/*.decode */ switch_g711a_decode,
|
||||
/*.destroy */ switch_g711a_destroy
|
||||
/*.destroy */ switch_g711a_destroy,
|
||||
/*.next*/ &g711a_8k_30ms_implementation
|
||||
};
|
||||
|
||||
static const switch_codec_implementation_t g711a_8k_10ms_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 8,
|
||||
/*.iananame */ "PCMA",
|
||||
/*.fmtp */ NULL,
|
||||
/*.samples_per_second */ 8000,
|
||||
/*.bits_per_second */ 64000,
|
||||
/*.microseconds_per_frame */ 10000,
|
||||
/*.samples_per_frame */ 80,
|
||||
/*.bytes_per_frame */ 160,
|
||||
/*.encoded_bytes_per_frame */ 80,
|
||||
/*.number_of_channels */ 1,
|
||||
/*.pref_frames_per_packet */ 1,
|
||||
/*.max_frames_per_packet */ 1,
|
||||
/*.init */ switch_g711u_init,
|
||||
/*.encode */ switch_g711u_encode,
|
||||
/*.decode */ switch_g711u_decode,
|
||||
/*.destroy */ switch_g711u_destroy,
|
||||
/*.next*/ &g711a_8k_20ms_implementation
|
||||
};
|
||||
|
||||
|
||||
|
||||
static const switch_codec_interface_t g711a_codec_interface = {
|
||||
/*.interface_name */ "g711 alaw",
|
||||
/*.implementations */ &g711a_8k_implementation
|
||||
/*.implementations */ &g711a_8k_10ms_implementation
|
||||
};
|
||||
|
||||
static const switch_codec_interface_t g711u_codec_interface = {
|
||||
/*.interface_name */ "g711 ulaw",
|
||||
/*.implementations */ &g711u_8k_implementation,
|
||||
/*.implementations */ &g711u_8k_10ms_implementation,
|
||||
/*.next */ &g711a_codec_interface
|
||||
};
|
||||
|
||||
|
|
|
@ -89,7 +89,49 @@ static switch_status_t switch_raw_destroy(switch_codec_t *codec)
|
|||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static const switch_codec_implementation_t raw_32k_implementation = {
|
||||
static const switch_codec_implementation_t raw_32k_60ms_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 10,
|
||||
/*.iananame */ "L16",
|
||||
/*.fmtp */ NULL,
|
||||
/*.samples_per_second = */ 32000,
|
||||
/*.bits_per_second = */ 512000,
|
||||
/*.microseconds_per_frame = */ 60000,
|
||||
/*.samples_per_frame = */ 1920,
|
||||
/*.bytes_per_frame = */ 3840,
|
||||
/*.encoded_bytes_per_frame = */ 3840,
|
||||
/*.number_of_channels = */ 1,
|
||||
/*.pref_frames_per_packet = */ 1,
|
||||
/*.max_frames_per_packet = */ 1,
|
||||
/*.init = */ switch_raw_init,
|
||||
/*.encode = */ switch_raw_encode,
|
||||
/*.decode = */ switch_raw_decode,
|
||||
/*.destroy = */ switch_raw_destroy
|
||||
/*.next = */
|
||||
};
|
||||
|
||||
static const switch_codec_implementation_t raw_32k_30ms_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 10,
|
||||
/*.iananame */ "L16",
|
||||
/*.fmtp */ NULL,
|
||||
/*.samples_per_second = */ 32000,
|
||||
/*.bits_per_second = */ 512000,
|
||||
/*.microseconds_per_frame = */ 30000,
|
||||
/*.samples_per_frame = */ 960,
|
||||
/*.bytes_per_frame = */ 1920,
|
||||
/*.encoded_bytes_per_frame = */ 1920,
|
||||
/*.number_of_channels = */ 1,
|
||||
/*.pref_frames_per_packet = */ 1,
|
||||
/*.max_frames_per_packet = */ 1,
|
||||
/*.init = */ switch_raw_init,
|
||||
/*.encode = */ switch_raw_encode,
|
||||
/*.decode = */ switch_raw_decode,
|
||||
/*.destroy = */ switch_raw_destroy,
|
||||
/*.next = */ &raw_32k_60ms_implementation
|
||||
};
|
||||
|
||||
static const switch_codec_implementation_t raw_32k_20ms_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 10,
|
||||
/*.iananame */ "L16",
|
||||
|
@ -106,10 +148,32 @@ static const switch_codec_implementation_t raw_32k_implementation = {
|
|||
/*.init = */ switch_raw_init,
|
||||
/*.encode = */ switch_raw_encode,
|
||||
/*.decode = */ switch_raw_decode,
|
||||
/*.destroy = */ switch_raw_destroy
|
||||
/*.destroy = */ switch_raw_destroy,
|
||||
/*.next = */ &raw_32k_30ms_implementation
|
||||
};
|
||||
|
||||
static const switch_codec_implementation_t raw_22k_implementation = {
|
||||
static const switch_codec_implementation_t raw_32k_10ms_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 10,
|
||||
/*.iananame */ "L16",
|
||||
/*.fmtp */ NULL,
|
||||
/*.samples_per_second = */ 32000,
|
||||
/*.bits_per_second = */ 512000,
|
||||
/*.microseconds_per_frame = */ 10000,
|
||||
/*.samples_per_frame = */ 320,
|
||||
/*.bytes_per_frame = */ 960,
|
||||
/*.encoded_bytes_per_frame = */ 960,
|
||||
/*.number_of_channels = */ 1,
|
||||
/*.pref_frames_per_packet = */ 1,
|
||||
/*.max_frames_per_packet = */ 1,
|
||||
/*.init = */ switch_raw_init,
|
||||
/*.encode = */ switch_raw_encode,
|
||||
/*.decode = */ switch_raw_decode,
|
||||
/*.destroy = */ switch_raw_destroy,
|
||||
/*.next = */ &raw_32k_20ms_implementation
|
||||
};
|
||||
|
||||
static const switch_codec_implementation_t raw_22k_20ms_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 10,
|
||||
/*.iananame */ "L16",
|
||||
|
@ -127,10 +191,73 @@ static const switch_codec_implementation_t raw_22k_implementation = {
|
|||
/*.encode = */ switch_raw_encode,
|
||||
/*.decode = */ switch_raw_decode,
|
||||
/*.destroy = */ switch_raw_destroy,
|
||||
/*.next = */ &raw_32k_implementation
|
||||
/*.next = */ &raw_32k_10ms_implementation
|
||||
};
|
||||
|
||||
static const switch_codec_implementation_t raw_16k_implementation = {
|
||||
static const switch_codec_implementation_t raw_16k_120ms_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 10,
|
||||
/*.iananame */ "L16",
|
||||
/*.fmtp */ NULL,
|
||||
/*.samples_per_second */ 8000,
|
||||
/*.bits_per_second */ 256000,
|
||||
/*.microseconds_per_frame */ 120000,
|
||||
/*.samples_per_frame */ 1920,
|
||||
/*.bytes_per_frame */ 3840,
|
||||
/*.encoded_bytes_per_frame */ 3840,
|
||||
/*.number_of_channels */ 1,
|
||||
/*.pref_frames_per_packet */ 1,
|
||||
/*.max_frames_per_packet */ 1,
|
||||
/*.init */ switch_raw_init,
|
||||
/*.encode */ switch_raw_encode,
|
||||
/*.decode */ switch_raw_decode,
|
||||
/*.destroy */ switch_raw_destroy,
|
||||
/*.next */ &raw_22k_20ms_implementation
|
||||
};
|
||||
|
||||
static const switch_codec_implementation_t raw_16k_60ms_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 10,
|
||||
/*.iananame */ "L16",
|
||||
/*.fmtp */ NULL,
|
||||
/*.samples_per_second */ 16000,
|
||||
/*.bits_per_second */ 256000,
|
||||
/*.microseconds_per_frame */ 60000,
|
||||
/*.samples_per_frame */ 960,
|
||||
/*.bytes_per_frame */ 1920,
|
||||
/*.encoded_bytes_per_frame */ 1920,
|
||||
/*.number_of_channels */ 1,
|
||||
/*.pref_frames_per_packet */ 1,
|
||||
/*.max_frames_per_packet */ 1,
|
||||
/*.init */ switch_raw_init,
|
||||
/*.encode */ switch_raw_encode,
|
||||
/*.decode */ switch_raw_decode,
|
||||
/*.destroy */ switch_raw_destroy,
|
||||
/*.next */ &raw_16k_120ms_implementation
|
||||
};
|
||||
|
||||
static const switch_codec_implementation_t raw_16k_30ms_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 10,
|
||||
/*.iananame */ "L16",
|
||||
/*.fmtp */ NULL,
|
||||
/*.samples_per_second */ 16000,
|
||||
/*.bits_per_second */ 256000,
|
||||
/*.microseconds_per_frame */ 30000,
|
||||
/*.samples_per_frame */ 480,
|
||||
/*.bytes_per_frame */ 960,
|
||||
/*.encoded_bytes_per_frame */ 960,
|
||||
/*.number_of_channels */ 1,
|
||||
/*.pref_frames_per_packet */ 1,
|
||||
/*.max_frames_per_packet */ 1,
|
||||
/*.init */ switch_raw_init,
|
||||
/*.encode */ switch_raw_encode,
|
||||
/*.decode */ switch_raw_decode,
|
||||
/*.destroy */ switch_raw_destroy,
|
||||
/*.next */ &raw_16k_60ms_implementation
|
||||
};
|
||||
|
||||
static const switch_codec_implementation_t raw_16k_20ms_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 10,
|
||||
/*.iananame */ "L16",
|
||||
|
@ -148,17 +275,17 @@ static const switch_codec_implementation_t raw_16k_implementation = {
|
|||
/*.encode = */ switch_raw_encode,
|
||||
/*.decode = */ switch_raw_decode,
|
||||
/*.destroy = */ switch_raw_destroy,
|
||||
/*.next = */ &raw_22k_implementation
|
||||
/*.next = */ &raw_16k_30ms_implementation
|
||||
};
|
||||
|
||||
static const switch_codec_implementation_t raw_8k_implementation = {
|
||||
static const switch_codec_implementation_t raw_16k_10ms_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 10,
|
||||
/*.iananame */ "L16",
|
||||
/*.fmtp */ NULL,
|
||||
/*.samples_per_second = */ 8000,
|
||||
/*.bits_per_second = */ 128000,
|
||||
/*.microseconds_per_frame = */ 20000,
|
||||
/*.samples_per_second = */ 16000,
|
||||
/*.bits_per_second = */ 256000,
|
||||
/*.microseconds_per_frame = */ 10000,
|
||||
/*.samples_per_frame = */ 160,
|
||||
/*.bytes_per_frame = */ 320,
|
||||
/*.encoded_bytes_per_frame = */ 320,
|
||||
|
@ -169,21 +296,22 @@ static const switch_codec_implementation_t raw_8k_implementation = {
|
|||
/*.encode = */ switch_raw_encode,
|
||||
/*.decode = */ switch_raw_decode,
|
||||
/*.destroy = */ switch_raw_destroy,
|
||||
/*.next = */ &raw_16k_implementation
|
||||
/*.next = */ &raw_16k_20ms_implementation
|
||||
};
|
||||
///////////////////////////////
|
||||
|
||||
|
||||
static const switch_codec_implementation_t raw_8k_30ms_implementation = {
|
||||
static const switch_codec_implementation_t raw_8k_120ms_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 10,
|
||||
/*.iananame */ "L16",
|
||||
/*.fmtp */ NULL,
|
||||
/*.samples_per_second */ 8000,
|
||||
/*.bits_per_second */ 128000,
|
||||
/*.microseconds_per_frame */ 30000,
|
||||
/*.samples_per_frame */ 240,
|
||||
/*.bytes_per_frame */ 480,
|
||||
/*.encoded_bytes_per_frame */ 480,
|
||||
/*.bits_per_second */ 512000,
|
||||
/*.microseconds_per_frame */ 120000,
|
||||
/*.samples_per_frame */ 960,
|
||||
/*.bytes_per_frame */ 1920,
|
||||
/*.encoded_bytes_per_frame */ 1920,
|
||||
/*.number_of_channels */ 1,
|
||||
/*.pref_frames_per_packet */ 1,
|
||||
/*.max_frames_per_packet */ 1,
|
||||
|
@ -191,7 +319,7 @@ static const switch_codec_implementation_t raw_8k_30ms_implementation = {
|
|||
/*.encode */ switch_raw_encode,
|
||||
/*.decode */ switch_raw_decode,
|
||||
/*.destroy */ switch_raw_destroy,
|
||||
/*.next */ &raw_8k_implementation
|
||||
/*.next */ &raw_16k_10ms_implementation
|
||||
};
|
||||
|
||||
|
||||
|
@ -213,20 +341,20 @@ static const switch_codec_implementation_t raw_8k_60ms_implementation = {
|
|||
/*.encode */ switch_raw_encode,
|
||||
/*.decode */ switch_raw_decode,
|
||||
/*.destroy */ switch_raw_destroy,
|
||||
/*.next */ &raw_8k_30ms_implementation
|
||||
/*.next */ &raw_8k_120ms_implementation
|
||||
};
|
||||
|
||||
static const switch_codec_implementation_t raw_8k_120ms_implementation = {
|
||||
static const switch_codec_implementation_t raw_8k_30ms_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 10,
|
||||
/*.iananame */ "L16",
|
||||
/*.fmtp */ NULL,
|
||||
/*.samples_per_second */ 8000,
|
||||
/*.bits_per_second */ 512000,
|
||||
/*.microseconds_per_frame */ 120000,
|
||||
/*.samples_per_frame */ 960,
|
||||
/*.bytes_per_frame */ 1920,
|
||||
/*.encoded_bytes_per_frame */ 1920,
|
||||
/*.bits_per_second */ 128000,
|
||||
/*.microseconds_per_frame */ 30000,
|
||||
/*.samples_per_frame */ 240,
|
||||
/*.bytes_per_frame */ 480,
|
||||
/*.encoded_bytes_per_frame */ 480,
|
||||
/*.number_of_channels */ 1,
|
||||
/*.pref_frames_per_packet */ 1,
|
||||
/*.max_frames_per_packet */ 1,
|
||||
|
@ -236,11 +364,54 @@ static const switch_codec_implementation_t raw_8k_120ms_implementation = {
|
|||
/*.destroy */ switch_raw_destroy,
|
||||
/*.next */ &raw_8k_60ms_implementation
|
||||
};
|
||||
static const switch_codec_implementation_t raw_8k_20ms_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 10,
|
||||
/*.iananame */ "L16",
|
||||
/*.fmtp */ NULL,
|
||||
/*.samples_per_second = */ 8000,
|
||||
/*.bits_per_second = */ 128000,
|
||||
/*.microseconds_per_frame = */ 20000,
|
||||
/*.samples_per_frame = */ 160,
|
||||
/*.bytes_per_frame = */ 320,
|
||||
/*.encoded_bytes_per_frame = */ 320,
|
||||
/*.number_of_channels = */ 1,
|
||||
/*.pref_frames_per_packet = */ 1,
|
||||
/*.max_frames_per_packet = */ 1,
|
||||
/*.init = */ switch_raw_init,
|
||||
/*.encode = */ switch_raw_encode,
|
||||
/*.decode = */ switch_raw_decode,
|
||||
/*.destroy = */ switch_raw_destroy,
|
||||
/*.next */ &raw_8k_30ms_implementation
|
||||
};
|
||||
|
||||
|
||||
|
||||
static const switch_codec_implementation_t raw_8k_10ms_implementation = {
|
||||
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
|
||||
/*.ianacode */ 10,
|
||||
/*.iananame */ "L16",
|
||||
/*.fmtp */ NULL,
|
||||
/*.samples_per_second = */ 8000,
|
||||
/*.bits_per_second = */ 128000,
|
||||
/*.microseconds_per_frame = */ 10000,
|
||||
/*.samples_per_frame = */ 80,
|
||||
/*.bytes_per_frame = */ 160,
|
||||
/*.encoded_bytes_per_frame = */ 160,
|
||||
/*.number_of_channels = */ 1,
|
||||
/*.pref_frames_per_packet = */ 1,
|
||||
/*.max_frames_per_packet = */ 1,
|
||||
/*.init = */ switch_raw_init,
|
||||
/*.encode = */ switch_raw_encode,
|
||||
/*.decode = */ switch_raw_decode,
|
||||
/*.destroy = */ switch_raw_destroy,
|
||||
/*.next */ &raw_8k_20ms_implementation
|
||||
};
|
||||
|
||||
|
||||
static const switch_codec_interface_t raw_codec_interface = {
|
||||
/*.interface_name */ "raw signed linear (16 bit)",
|
||||
/*.implementations */ &raw_8k_120ms_implementation
|
||||
/*.implementations */ &raw_8k_10ms_implementation
|
||||
};
|
||||
|
||||
static switch_loadable_module_interface_t raw_module_interface = {
|
||||
|
|
|
@ -782,6 +782,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init(switch_codec_t *codec, ch
|
|||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
/* 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) &&
|
||||
(20 == (iptr->microseconds_per_frame / 1000)) &&
|
||||
(!channels || channels == iptr->number_of_channels)) {
|
||||
implementation = iptr;
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 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) &&
|
||||
(!ms || ms == (iptr->microseconds_per_frame / 1000)) &&
|
||||
|
@ -791,6 +804,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init(switch_codec_t *codec, ch
|
|||
}
|
||||
}
|
||||
|
||||
found:
|
||||
|
||||
if (implementation) {
|
||||
switch_status_t status;
|
||||
codec->codec_interface = codec_interface;
|
||||
|
|
|
@ -758,6 +758,27 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
|
|||
}
|
||||
|
||||
if ((codec_interface = switch_loadable_module_get_codec_interface(name)) != 0 ) {
|
||||
/* If no specific codec interval is requested opt for 20ms above all else because lots of stuff assumes it */
|
||||
if (!interval) {
|
||||
for (imp = codec_interface->implementations; imp; imp = imp->next) {
|
||||
uint8_t match = 1;
|
||||
|
||||
if ((uint32_t)(imp->microseconds_per_frame / 1000) != 20) {
|
||||
match = 0;
|
||||
}
|
||||
|
||||
if (match && rate && (uint32_t)imp->samples_per_second != rate) {
|
||||
match = 0;
|
||||
}
|
||||
|
||||
if (match) {
|
||||
array[i++] = imp;
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Either looking for a specific interval or there was no interval specified and there wasn't one @20ms available*/
|
||||
for (imp = codec_interface->implementations; imp; imp = imp->next) {
|
||||
uint8_t match = 1;
|
||||
|
||||
|
@ -771,8 +792,12 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
|
|||
|
||||
if (match) {
|
||||
array[i++] = imp;
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
|
||||
found:
|
||||
|
||||
if (i > arraylen) {
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue