Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
71b226bf
提交
71b226bf
authored
1月 12, 2006
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@322
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
a7cb1e7e
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
92 行增加
和
50 行删除
+92
-50
mod_g711codec.c
src/mod/codecs/mod_g711codec/mod_g711codec.c
+18
-1
mod_iaxchan.c
src/mod/endpoints/mod_iaxchan/mod_iaxchan.c
+74
-49
没有找到文件。
src/mod/codecs/mod_g711codec/mod_g711codec.c
浏览文件 @
71b226bf
...
@@ -227,6 +227,23 @@ static const switch_codec_implementation g711u_8k_30ms_implementation = {
...
@@ -227,6 +227,23 @@ static const switch_codec_implementation g711u_8k_30ms_implementation = {
/*.next*/
&
g711u_8k_60ms_implementation
/*.next*/
&
g711u_8k_60ms_implementation
};
};
static
const
switch_codec_implementation
g711u_16k_implementation
=
{
/*.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
,
};
static
const
switch_codec_implementation
g711u_8k_implementation
=
{
static
const
switch_codec_implementation
g711u_8k_implementation
=
{
/*.samples_per_second*/
8000
,
/*.samples_per_second*/
8000
,
/*.bits_per_second*/
64000
,
/*.bits_per_second*/
64000
,
...
@@ -241,7 +258,7 @@ static const switch_codec_implementation g711u_8k_implementation = {
...
@@ -241,7 +258,7 @@ static const switch_codec_implementation g711u_8k_implementation = {
/*.encode*/
switch_g711u_encode
,
/*.encode*/
switch_g711u_encode
,
/*.decode*/
switch_g711u_decode
,
/*.decode*/
switch_g711u_decode
,
/*.destroy*/
switch_g711u_destroy
,
/*.destroy*/
switch_g711u_destroy
,
/
//*.next*/ &g711u_8k_30ms
_implementation
/
*.next*/
&
g711u_16k
_implementation
};
};
...
...
src/mod/endpoints/mod_iaxchan/mod_iaxchan.c
浏览文件 @
71b226bf
...
@@ -160,6 +160,40 @@ static unsigned int iana2ast(int iana)
...
@@ -160,6 +160,40 @@ static unsigned int iana2ast(int iana)
return
ast
;
return
ast
;
}
}
static
unsigned
short
iax_build_codec_rates
(
void
)
{
int
x
;
unsigned
short
samples
=
0
;
for
(
x
=
0
;
x
<
globals
.
codec_rates_last
;
x
++
)
{
int
rate
=
atoi
(
globals
.
codec_rates
[
x
]);
switch
(
rate
)
{
case
8
:
samples
|=
IAX_RATE_8KHZ
;
break
;
case
16
:
samples
|=
IAX_RATE_16KHZ
;
break
;
case
22
:
samples
|=
IAX_RATE_22KHZ
;
break
;
case
32
:
samples
|=
IAX_RATE_32KHZ
;
break
;
case
44
:
samples
|=
IAX_RATE_44KHZ
;
break
;
case
48
:
samples
|=
IAX_RATE_48KHZ
;
break
;
default:
switch_console_printf
(
SWITCH_CHANNEL_CONSOLE
,
"I don't know rate %d
\n
"
,
rate
);
break
;
}
}
return
samples
;
}
typedef
enum
{
typedef
enum
{
IAX_SET
=
1
,
IAX_SET
=
1
,
IAX_QUERY
=
2
IAX_QUERY
=
2
...
@@ -174,7 +208,7 @@ static switch_status iax_set_codec(struct private_object *tech_pvt, struct iax_s
...
@@ -174,7 +208,7 @@ static switch_status iax_set_codec(struct private_object *tech_pvt, struct iax_s
switch_codec_interface
*
codecs
[
SWITCH_MAX_CODECS
];
switch_codec_interface
*
codecs
[
SWITCH_MAX_CODECS
];
int
num_codecs
=
0
;
int
num_codecs
=
0
;
unsigned
int
local_cap
=
0
,
mixed_cap
=
0
,
chosen
=
0
,
leading
=
0
;
unsigned
int
local_cap
=
0
,
mixed_cap
=
0
,
chosen
=
0
,
leading
=
0
;
int
x
;
int
x
,
srate
=
8000
;
if
(
globals
.
codec_string
)
{
if
(
globals
.
codec_string
)
{
if
(
!
(
num_codecs
=
switch_loadable_module_get_codecs_sorted
(
switch_core_session_get_pool
(
tech_pvt
->
session
),
if
(
!
(
num_codecs
=
switch_loadable_module_get_codecs_sorted
(
switch_core_session_get_pool
(
tech_pvt
->
session
),
...
@@ -210,38 +244,7 @@ static switch_status iax_set_codec(struct private_object *tech_pvt, struct iax_s
...
@@ -210,38 +244,7 @@ static switch_status iax_set_codec(struct private_object *tech_pvt, struct iax_s
*
format
=
chosen
;
*
format
=
chosen
;
*
cababilities
=
local_cap
;
*
cababilities
=
local_cap
;
if
(
globals
.
codec_rates_last
)
{
if
(
globals
.
codec_rates_last
)
{
int
x
;
*
samprate
=
iax_build_codec_rates
();
unsigned
short
samples
=
0
;
for
(
x
=
0
;
x
<
globals
.
codec_rates_last
;
x
++
)
{
int
rate
=
atoi
(
globals
.
codec_rates
[
x
]);
switch
(
rate
)
{
case
8
:
samples
|=
IAX_RATE_8KHZ
;
break
;
case
16
:
samples
|=
IAX_RATE_16KHZ
;
break
;
case
22
:
samples
|=
IAX_RATE_22KHZ
;
break
;
case
32
:
samples
|=
IAX_RATE_32KHZ
;
break
;
case
44
:
samples
|=
IAX_RATE_44KHZ
;
break
;
case
48
:
samples
|=
IAX_RATE_48KHZ
;
break
;
default:
switch_console_printf
(
SWITCH_CHANNEL_CONSOLE
,
"I don't know rate %d
\n
"
,
rate
);
break
;
}
}
if
(
samples
)
{
*
samprate
=
samples
;
}
}
}
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
else
if
(
switch_test_flag
(
&
globals
,
GFLAG_MY_CODEC_PREFS
)
&&
(
leading
&
mixed_cap
))
{
}
else
if
(
switch_test_flag
(
&
globals
,
GFLAG_MY_CODEC_PREFS
)
&&
(
leading
&
mixed_cap
))
{
...
@@ -306,31 +309,53 @@ static switch_status iax_set_codec(struct private_object *tech_pvt, struct iax_s
...
@@ -306,31 +309,53 @@ static switch_status iax_set_codec(struct private_object *tech_pvt, struct iax_s
channel
=
switch_core_session_get_channel
(
tech_pvt
->
session
);
channel
=
switch_core_session_get_channel
(
tech_pvt
->
session
);
assert
(
channel
!=
NULL
);
assert
(
channel
!=
NULL
);
if
(
*
samprate
)
{
srate
=
8000
;
unsigned
short
samples
=
iax_build_codec_rates
();
unsigned
short
mixed
=
(
*
samprate
&
samples
);
if
(
mixed
&
IAX_RATE_16KHZ
)
{
srate
=
16000
;
}
if
(
mixed
&
IAX_RATE_22KHZ
)
{
srate
=
22000
;
}
if
(
mixed
&
IAX_RATE_32KHZ
)
{
srate
=
32000
;
}
if
(
mixed
&
IAX_RATE_44KHZ
)
{
srate
=
44000
;
}
if
(
mixed
&
IAX_RATE_48KHZ
)
{
srate
=
48000
;
}
}
if
(
!
strcasecmp
(
dname
,
"l16"
))
{
if
(
!
strcasecmp
(
dname
,
"l16"
))
{
switch_set_flag
(
tech_pvt
,
TFLAG_LINEAR
);
switch_set_flag
(
tech_pvt
,
TFLAG_LINEAR
);
}
}
if
(
switch_core_codec_init
(
&
tech_pvt
->
read_codec
,
if
(
switch_core_codec_init
(
&
tech_pvt
->
read_codec
,
dname
,
dname
,
0
,
srate
,
0
,
0
,
1
,
1
,
SWITCH_CODEC_FLAG_ENCODE
|
SWITCH_CODEC_FLAG_DECODE
,
SWITCH_CODEC_FLAG_ENCODE
|
SWITCH_CODEC_FLAG_DECODE
,
NULL
,
NULL
,
switch_core_session_get_pool
(
tech_pvt
->
session
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_core_session_get_pool
(
tech_pvt
->
session
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_console_printf
(
SWITCH_CHANNEL_CONSOLE
,
"Can't load codec?
\n
"
);
switch_console_printf
(
SWITCH_CHANNEL_CONSOLE
,
"Can't load codec?
\n
"
);
return
SWITCH_STATUS_GENERR
;
return
SWITCH_STATUS_GENERR
;
}
else
{
}
else
{
if
(
switch_core_codec_init
(
&
tech_pvt
->
write_codec
,
if
(
switch_core_codec_init
(
&
tech_pvt
->
write_codec
,
dname
,
dname
,
0
,
srate
,
0
,
0
,
1
,
1
,
SWITCH_CODEC_FLAG_ENCODE
|
SWITCH_CODEC_FLAG_DECODE
,
SWITCH_CODEC_FLAG_ENCODE
|
SWITCH_CODEC_FLAG_DECODE
,
NULL
,
NULL
,
switch_core_session_get_pool
(
tech_pvt
->
session
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_core_session_get_pool
(
tech_pvt
->
session
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_console_printf
(
SWITCH_CHANNEL_CONSOLE
,
"Can't load codec?
\n
"
);
switch_console_printf
(
SWITCH_CHANNEL_CONSOLE
,
"Can't load codec?
\n
"
);
switch_core_codec_destroy
(
&
tech_pvt
->
read_codec
);
switch_core_codec_destroy
(
&
tech_pvt
->
read_codec
);
return
SWITCH_STATUS_GENERR
;
return
SWITCH_STATUS_GENERR
;
}
else
{
}
else
{
int
ms
;
int
ms
;
int
rate
;
int
rate
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论