提交 bd41690d authored 作者: Anthony Minessale's avatar Anthony Minessale

FS-4067 this should make g722 work

上级 ee0a7f0e
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
* *
*/ */
#include <switch.h> #include <switch.h>
#include <g711.h>
SWITCH_MODULE_LOAD_FUNCTION(mod_esf_load); SWITCH_MODULE_LOAD_FUNCTION(mod_esf_load);
SWITCH_MODULE_DEFINITION(mod_esf, mod_esf_load, NULL, NULL); SWITCH_MODULE_DEFINITION(mod_esf, mod_esf_load, NULL, NULL);
...@@ -168,7 +169,7 @@ SWITCH_STANDARD_APP(bcast_function) ...@@ -168,7 +169,7 @@ SWITCH_STANDARD_APP(bcast_function)
if (ready == SEND_TYPE_RTP) { if (ready == SEND_TYPE_RTP) {
if (read_impl.ianacode != 0) { if (read_impl.ianacode != 0) {
if (switch_core_codec_init(&codec, if (switch_core_codec_init(&codec,
"PCMU", "L16",
NULL, NULL,
8000, 8000,
20, 20,
...@@ -237,7 +238,22 @@ SWITCH_STANDARD_APP(bcast_function) ...@@ -237,7 +238,22 @@ SWITCH_STANDARD_APP(bcast_function)
continue; continue;
} }
if (ready == SEND_TYPE_RTP) { if (ready == SEND_TYPE_RTP) {
short *dbuf;
unsigned char *ebuf;
uint32_t i;
unsigned char encoded_data[4192];
dbuf = read_frame->data;
ebuf = encoded_data;
for (i = 0; i < read_frame->datalen / sizeof(short); i++) {
ebuf[i] = linear_to_ulaw(dbuf[i]);
}
read_frame->data = encoded_data;
read_frame->datalen = read_frame->datalen / 2;
switch_rtp_write_frame(rtp_session, read_frame); switch_rtp_write_frame(rtp_session, read_frame);
read_frame->data = dbuf;
read_frame->datalen = read_frame->datalen * 2;
} else { } else {
bytes = read_frame->packetlen; bytes = read_frame->packetlen;
switch_socket_sendto(socket, audio_addr, 0, read_frame->packet, &bytes); switch_socket_sendto(socket, audio_addr, 0, read_frame->packet, &bytes);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论