Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
9b9000a1
提交
9b9000a1
authored
8月 30, 2006
作者:
Brian West
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@2458
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
2565f310
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
56 行增加
和
9 行删除
+56
-9
mod_g726.c
src/mod/codecs/mod_g726/mod_g726.c
+49
-6
switch_rtp.c
src/switch_rtp.c
+7
-3
没有找到文件。
src/mod/codecs/mod_g726/mod_g726.c
浏览文件 @
9b9000a1
...
@@ -80,6 +80,26 @@ static switch_status_t switch_g726_destroy(switch_codec_t *codec)
...
@@ -80,6 +80,26 @@ static switch_status_t switch_g726_destroy(switch_codec_t *codec)
typedef
int
(
*
encoder_t
)(
int
,
int
,
g726_state
*
);
typedef
int
(
*
encoder_t
)(
int
,
int
,
g726_state
*
);
typedef
int
(
*
decoder_t
)(
int
,
int
,
g726_state
*
);
typedef
int
(
*
decoder_t
)(
int
,
int
,
g726_state
*
);
static
void
print_bits
(
uint8_t
byte
)
{
int
i
;
for
(
i
=
7
;
i
>=
0
;
i
--
)
{
//for (i=0;i<=7;i++) {
if
(
byte
&
(
1
<<
i
))
{
printf
(
"1"
);
}
else
{
printf
(
"0"
);
}
}
}
static
switch_status_t
switch_g726_encode
(
switch_codec_t
*
codec
,
static
switch_status_t
switch_g726_encode
(
switch_codec_t
*
codec
,
switch_codec_t
*
other_codec
,
switch_codec_t
*
other_codec
,
void
*
decoded_data
,
void
*
decoded_data
,
...
@@ -132,15 +152,29 @@ static switch_status_t switch_g726_encode(switch_codec_t *codec,
...
@@ -132,15 +152,29 @@ static switch_status_t switch_g726_encode(switch_codec_t *codec,
for
(
x
=
0
;
x
<
loops
&&
new_len
<
*
encoded_data_len
;
x
++
)
{
for
(
x
=
0
;
x
<
loops
&&
new_len
<
*
encoded_data_len
;
x
++
)
{
int
edata
=
encoder
(
*
ddp
,
AUDIO_ENCODING_LINEAR
,
context
);
int
edata
=
encoder
(
*
ddp
,
AUDIO_ENCODING_LINEAR
,
context
);
int
bits
=
handle
->
bbits
+
handle
->
bits_per_frame
;
handle
->
ecount
++
;
handle
->
ecount
++
;
if
(
!
handle
->
bbits
)
{
if
(
!
handle
->
bbits
)
{
//printf("new byte assign the %d bits\n", handle->bits_per_frame);
*
handle
->
ptr
=
edata
;
*
handle
->
ptr
=
edata
;
}
else
if
((
handle
->
bbits
+
handle
->
bits_per_frame
)
<=
BITS_IN_A_BYTE
)
{
}
else
if
(
bits
<=
BITS_IN_A_BYTE
)
{
printf
(
"WTF %d
\n
"
,
BITS_IN_A_BYTE
-
(
handle
->
bits_per_frame
*
handle
->
ecount
));
int
shift_by
=
((
handle
->
bits_per_frame
*
(
handle
->
ecount
))
-
handle
->
bits_per_frame
);
*
handle
->
ptr
+=
(
edata
<<
(
BITS_IN_A_BYTE
-
(
handle
->
bits_per_frame
*
handle
->
ecount
)));
//printf ("shift by %d and add %d bits\n", shift_by, handle->bits_per_frame);
handle
->
ecount
=
0
;
//*handle->ptr <<= shift_by;
//*handle->ptr |= edata;
if
(
shift_by
);
//printf("edata\n");
//print_bits(edata);
//printf("\n");
*
handle
->
ptr
|=
(
edata
<<
4
);
//printf("handle\n");
//print_bits(*handle->ptr);
//printf("\n");
}
else
{
}
else
{
int
remain
,
next
,
rdata
,
ndata
;
int
remain
,
next
,
rdata
,
ndata
;
...
@@ -155,9 +189,17 @@ static switch_status_t switch_g726_encode(switch_codec_t *codec,
...
@@ -155,9 +189,17 @@ static switch_status_t switch_g726_encode(switch_codec_t *codec,
handle
->
bbits
=
0
;
handle
->
bbits
=
0
;
handle
->
ecount
=
0
;
handle
->
ecount
=
0
;
}
}
handle
->
bits
+=
handle
->
bits_per_frame
;
handle
->
bits
=
bits
;
handle
->
bbits
+=
handle
->
bits_per_frame
;
handle
->
bbits
+=
handle
->
bits_per_frame
;
if
(
0
)
{
for
(
x
=
0
;
x
<
5
;
x
++
)
{
print_bits
(
handle
->
buf
[
x
]);
printf
(
" "
);
}
printf
(
"
\n
"
);
}
if
((
handle
->
bits
%
BITS_IN_A_BYTE
)
==
0
)
{
if
((
handle
->
bits
%
BITS_IN_A_BYTE
)
==
0
)
{
int
bytes
=
handle
->
bits
/
BITS_IN_A_BYTE
,
count
;
int
bytes
=
handle
->
bits
/
BITS_IN_A_BYTE
,
count
;
for
(
count
=
0
;
count
<
bytes
;
count
++
)
{
for
(
count
=
0
;
count
<
bytes
;
count
++
)
{
...
@@ -165,6 +207,7 @@ static switch_status_t switch_g726_encode(switch_codec_t *codec,
...
@@ -165,6 +207,7 @@ static switch_status_t switch_g726_encode(switch_codec_t *codec,
}
}
handle
->
bits
=
handle
->
bbits
=
0
;
handle
->
bits
=
handle
->
bbits
=
0
;
handle
->
ptr
=
handle
->
buf
;
handle
->
ptr
=
handle
->
buf
;
handle
->
ecount
=
0
;
memset
(
handle
->
buf
,
0
,
sizeof
(
handle
->
buf
));
memset
(
handle
->
buf
,
0
,
sizeof
(
handle
->
buf
));
}
}
ddp
++
;
ddp
++
;
...
...
src/switch_rtp.c
浏览文件 @
9b9000a1
...
@@ -317,8 +317,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_local_address(switch_rtp_t *rtp_s
...
@@ -317,8 +317,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_local_address(switch_rtp_t *rtp_s
}
}
if
(
rtp_session
->
sock
)
{
if
(
rtp_session
->
sock
)
{
switch_socket_close
(
rtp_session
->
sock
);
switch_rtp_kill_socket
(
rtp_session
);
rtp_session
->
sock
=
NULL
;
}
}
if
(
switch_socket_create
(
&
rtp_session
->
sock
,
AF_INET
,
SOCK_DGRAM
,
0
,
rtp_session
->
pool
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_socket_create
(
&
rtp_session
->
sock
,
AF_INET
,
SOCK_DGRAM
,
0
,
rtp_session
->
pool
)
!=
SWITCH_STATUS_SUCCESS
)
{
...
@@ -541,8 +540,10 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio
...
@@ -541,8 +540,10 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio
SWITCH_DECLARE
(
void
)
switch_rtp_kill_socket
(
switch_rtp_t
*
rtp_session
)
SWITCH_DECLARE
(
void
)
switch_rtp_kill_socket
(
switch_rtp_t
*
rtp_session
)
{
{
switch_mutex_lock
(
rtp_session
->
flag_mutex
);
apr_socket_shutdown
(
rtp_session
->
sock
,
APR_SHUTDOWN_READWRITE
);
apr_socket_shutdown
(
rtp_session
->
sock
,
APR_SHUTDOWN_READWRITE
);
switch_clear_flag_locked
(
rtp_session
,
SWITCH_RTP_FLAG_IO
);
switch_clear_flag
(
rtp_session
,
SWITCH_RTP_FLAG_IO
);
switch_mutex_unlock
(
rtp_session
->
flag_mutex
);
}
}
SWITCH_DECLARE
(
uint8_t
)
switch_rtp_ready
(
switch_rtp_t
*
rtp_session
)
SWITCH_DECLARE
(
uint8_t
)
switch_rtp_ready
(
switch_rtp_t
*
rtp_session
)
...
@@ -557,8 +558,11 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session)
...
@@ -557,8 +558,11 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session)
return
;
return
;
}
}
switch_mutex_lock
((
*
rtp_session
)
->
flag_mutex
);
switch_rtp_kill_socket
(
*
rtp_session
);
switch_rtp_kill_socket
(
*
rtp_session
);
switch_socket_close
((
*
rtp_session
)
->
sock
);
switch_socket_close
((
*
rtp_session
)
->
sock
);
(
*
rtp_session
)
->
sock
=
NULL
;
switch_mutex_unlock
((
*
rtp_session
)
->
flag_mutex
);
if
(
switch_test_flag
((
*
rtp_session
),
SWITCH_RTP_FLAG_VAD
))
{
if
(
switch_test_flag
((
*
rtp_session
),
SWITCH_RTP_FLAG_VAD
))
{
switch_rtp_disable_vad
(
*
rtp_session
);
switch_rtp_disable_vad
(
*
rtp_session
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论