Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
101b116d
提交
101b116d
authored
5月 14, 2013
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-5011 try to fill gaps
上级
11f84911
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
81 行增加
和
28 行删除
+81
-28
switch_core.h
src/include/switch_core.h
+1
-1
switch_core_io.c
src/switch_core_io.c
+32
-21
switch_ivr_async.c
src/switch_ivr_async.c
+48
-6
没有找到文件。
src/include/switch_core.h
浏览文件 @
101b116d
...
...
@@ -2477,7 +2477,7 @@ SWITCH_DECLARE(void) switch_close_extra_files(int *keep, int keep_ttl);
SWITCH_DECLARE
(
switch_status_t
)
switch_core_thread_set_cpu_affinity
(
int
cpu
);
SWITCH_DECLARE
(
void
)
switch_os_yield
(
void
);
SWITCH_DECLARE
(
switch_status_t
)
switch_core_get_stacksizes
(
switch_size_t
*
cur
,
switch_size_t
*
max
);
SWITCH_DECLARE
(
void
)
switch_core_gen_encoded_silence
(
unsigned
char
*
data
,
const
switch_codec_implementation_t
*
read_impl
,
switch_size_t
len
);
SWITCH_DECLARE
(
switch_cache_db_handle_type_t
)
switch_core_dbtype
(
void
);
SWITCH_DECLARE
(
void
)
switch_core_sql_exec
(
const
char
*
sql
);
...
...
src/switch_core_io.c
浏览文件 @
101b116d
...
...
@@ -99,6 +99,34 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
return
status
;
}
SWITCH_DECLARE
(
void
)
switch_core_gen_encoded_silence
(
unsigned
char
*
data
,
const
switch_codec_implementation_t
*
read_impl
,
switch_size_t
len
)
{
unsigned
char
g729_filler
[]
=
{
114
,
170
,
250
,
103
,
54
,
211
,
203
,
194
,
94
,
64
,
229
,
127
,
79
,
96
,
207
,
82
,
216
,
110
,
245
,
81
,
114
,
170
,
250
,
103
,
54
,
211
,
203
,
194
,
94
,
64
,
229
,
127
,
79
,
96
,
207
,
82
,
216
,
110
,
245
,
81
,
114
,
170
,
250
,
103
,
54
,
211
,
203
,
194
,
94
,
64
,
229
,
127
,
79
,
96
,
207
,
82
,
216
,
110
,
245
,
81
,
114
,
170
,
250
,
103
,
54
,
211
,
203
,
194
,
94
,
64
,
229
,
127
,
79
,
96
,
207
,
82
,
216
,
110
,
245
,
81
,
114
,
170
,
250
,
103
,
54
,
211
,
203
,
194
,
94
,
64
,
229
,
127
,
79
,
96
,
207
,
82
,
216
,
110
,
245
,
81
,
114
,
170
,
250
,
103
,
54
,
211
,
203
,
194
,
94
,
64
,
229
,
127
,
79
,
96
,
207
,
82
,
216
,
110
,
245
,
81
,
114
,
170
,
250
,
103
,
54
,
211
,
203
,
194
,
94
,
64
,
229
,
127
,
79
,
96
,
207
,
82
,
216
,
110
,
245
,
81
};
if
(
read_impl
->
ianacode
==
18
||
switch_stristr
(
"g729"
,
read_impl
->
iananame
))
{
memcpy
(
data
,
g729_filler
,
len
);
}
else
{
memset
(
data
,
255
,
len
);
}
}
SWITCH_DECLARE
(
switch_status_t
)
switch_core_session_read_frame
(
switch_core_session_t
*
session
,
switch_frame_t
**
frame
,
switch_io_flag_t
flags
,
int
stream_id
)
{
...
...
@@ -334,32 +362,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
if
(
bp
->
callback
)
{
switch_frame_t
tmp_frame
=
{
0
};
unsigned
char
data
[
SWITCH_RECOMMENDED_BUFFER_SIZE
]
=
{
0
};
unsigned
char
g729_filler
[]
=
{
114
,
170
,
250
,
103
,
54
,
211
,
203
,
194
,
94
,
64
,
229
,
127
,
79
,
96
,
207
,
82
,
216
,
110
,
245
,
81
,
114
,
170
,
250
,
103
,
54
,
211
,
203
,
194
,
94
,
64
,
229
,
127
,
79
,
96
,
207
,
82
,
216
,
110
,
245
,
81
,
114
,
170
,
250
,
103
,
54
,
211
,
203
,
194
,
94
,
64
,
229
,
127
,
79
,
96
,
207
,
82
,
216
,
110
,
245
,
81
,
114
,
170
,
250
,
103
,
54
,
211
,
203
,
194
,
94
,
64
,
229
,
127
,
79
,
96
,
207
,
82
,
216
,
110
,
245
,
81
,
114
,
170
,
250
,
103
,
54
,
211
,
203
,
194
,
94
,
64
,
229
,
127
,
79
,
96
,
207
,
82
,
216
,
110
,
245
,
81
,
114
,
170
,
250
,
103
,
54
,
211
,
203
,
194
,
94
,
64
,
229
,
127
,
79
,
96
,
207
,
82
,
216
,
110
,
245
,
81
,
114
,
170
,
250
,
103
,
54
,
211
,
203
,
194
,
94
,
64
,
229
,
127
,
79
,
96
,
207
,
82
,
216
,
110
,
245
,
81
};
tmp_frame
.
codec
=
(
*
frame
)
->
codec
;
tmp_frame
.
datalen
=
(
*
frame
)
->
codec
->
implementation
->
encoded_bytes_per_packet
;
tmp_frame
.
samples
=
(
*
frame
)
->
codec
->
implementation
->
samples_per_packet
;
tmp_frame
.
data
=
data
;
if
((
*
frame
)
->
codec
->
implementation
->
ianacode
==
18
||
switch_stristr
(
"g729"
,
(
*
frame
)
->
codec
->
implementation
->
iananame
))
{
memcpy
(
tmp_frame
.
data
,
g729_filler
,
tmp_frame
.
datalen
);
}
switch_core_gen_encoded_silence
(
data
,
(
*
frame
)
->
codec
->
implementation
,
tmp_frame
.
datalen
);
bp
->
native_read_frame
=
&
tmp_frame
;
ok
=
bp
->
callback
(
bp
,
bp
->
user_data
,
SWITCH_ABC_TYPE_TAP_NATIVE_READ
);
bp
->
native_read_frame
=
NULL
;
...
...
src/switch_ivr_async.c
浏览文件 @
101b116d
...
...
@@ -1090,11 +1090,14 @@ struct record_helper {
switch_file_handle_t
in_fh
;
switch_file_handle_t
out_fh
;
int
native
;
int
rready
;
int
wready
;
uint32_t
packet_len
;
int
min_sec
;
int
rready
;
int
wready
;
switch_time_t
last_read_time
;
switch_time_t
last_write_time
;
switch_bool_t
hangup_on_error
;
switch_codec_implementation_t
read_impl
;
};
static
switch_bool_t
record_callback
(
switch_media_bug_t
*
bug
,
void
*
user_data
,
switch_abc_type_t
type
)
...
...
@@ -1116,29 +1119,68 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
switch_event_fire
(
&
event
);
}
switch_core_session_get_read_impl
(
session
,
&
rh
->
read_impl
);
break
;
case
SWITCH_ABC_TYPE_TAP_NATIVE_READ
:
{
rh
->
rready
=
1
;
if
(
rh
->
rready
&&
rh
->
wready
)
{
switch_time_t
now
=
switch_micro_time_now
();
long
diff
;
nframe
=
switch_core_media_bug_get_native_read_frame
(
bug
);
len
=
nframe
->
datalen
;
if
(
rh
->
last_read_time
&&
rh
->
last_read_time
<
now
)
{
diff
=
((
now
-
rh
->
last_read_time
)
+
3000
)
/
rh
->
read_impl
.
microseconds_per_packet
;
if
(
diff
>
1
)
{
unsigned
char
fill_data
[
SWITCH_RECOMMENDED_BUFFER_SIZE
]
=
{
0
};
switch_core_gen_encoded_silence
(
fill_data
,
&
rh
->
read_impl
,
len
);
while
(
diff
>
1
)
{
switch_size_t
fill_len
=
len
;
switch_core_file_write
(
&
rh
->
in_fh
,
fill_data
,
&
fill_len
);
diff
--
;
}
}
}
switch_core_file_write
(
&
rh
->
in_fh
,
mask
?
null_data
:
nframe
->
data
,
&
len
);
rh
->
last_read_time
=
now
;
}
}
break
;
case
SWITCH_ABC_TYPE_TAP_NATIVE_WRITE
:
{
rh
->
wready
=
1
;
if
(
rh
->
rready
&&
rh
->
wready
)
{
switch_time_t
now
=
switch_micro_time_now
();
long
diff
;
if
(
rh
->
rready
&&
rh
->
wready
)
{
nframe
=
switch_core_media_bug_get_native_write_frame
(
bug
);
len
=
nframe
->
datalen
;
switch_core_file_write
(
&
rh
->
out_fh
,
mask
?
null_data
:
nframe
->
data
,
&
len
);
if
(
rh
->
last_write_time
&&
rh
->
last_write_time
<
now
)
{
diff
=
((
now
-
rh
->
last_write_time
)
+
3000
)
/
rh
->
read_impl
.
microseconds_per_packet
;
if
(
diff
>
1
)
{
unsigned
char
fill_data
[
SWITCH_RECOMMENDED_BUFFER_SIZE
]
=
{
0
};
switch_core_gen_encoded_silence
(
fill_data
,
&
rh
->
read_impl
,
len
);
while
(
diff
>
1
)
{
switch_size_t
fill_len
=
len
;
switch_core_file_write
(
&
rh
->
out_fh
,
fill_data
,
&
fill_len
);
diff
--
;
}
}
}
switch_core_file_write
(
&
rh
->
out_fh
,
mask
?
null_data
:
nframe
->
data
,
&
len
);
rh
->
last_write_time
=
now
;
}
}
break
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论