Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
f1d5120f
提交
f1d5120f
authored
12月 07, 2011
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-3735
上级
fd9158d0
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
25 行增加
和
6 行删除
+25
-6
mod_rtmp.c
src/mod/endpoints/mod_rtmp/mod_rtmp.c
+2
-1
mod_rtmp.h
src/mod/endpoints/mod_rtmp/mod_rtmp.h
+1
-0
rtmp.c
src/mod/endpoints/mod_rtmp/rtmp.c
+13
-3
rtmp_tcp.c
src/mod/endpoints/mod_rtmp/rtmp_tcp.c
+9
-2
没有找到文件。
src/mod/endpoints/mod_rtmp/mod_rtmp.c
浏览文件 @
f1d5120f
...
@@ -407,6 +407,7 @@ switch_status_t rtmp_read_frame(switch_core_session_t *session, switch_frame_t *
...
@@ -407,6 +407,7 @@ switch_status_t rtmp_read_frame(switch_core_session_t *session, switch_frame_t *
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
cng:
cng:
data
=
(
switch_byte_t
*
)
tech_pvt
->
read_frame
.
data
;
data
=
(
switch_byte_t
*
)
tech_pvt
->
read_frame
.
data
;
data
[
0
]
=
65
;
data
[
0
]
=
65
;
data
[
1
]
=
0
;
data
[
1
]
=
0
;
...
@@ -414,7 +415,7 @@ cng:
...
@@ -414,7 +415,7 @@ cng:
tech_pvt
->
read_frame
.
flags
=
SFF_CNG
;
tech_pvt
->
read_frame
.
flags
=
SFF_CNG
;
tech_pvt
->
read_frame
.
codec
=
&
tech_pvt
->
read_codec
;
tech_pvt
->
read_frame
.
codec
=
&
tech_pvt
->
read_codec
;
switch_core_timer_sync
(
&
tech_pvt
->
timer
);
//
switch_core_timer_sync(&tech_pvt->timer);
*
frame
=
&
tech_pvt
->
read_frame
;
*
frame
=
&
tech_pvt
->
read_frame
;
...
...
src/mod/endpoints/mod_rtmp/mod_rtmp.h
浏览文件 @
f1d5120f
...
@@ -520,6 +520,7 @@ struct rtmp_private {
...
@@ -520,6 +520,7 @@ struct rtmp_private {
const
char
*
auth
;
const
char
*
auth
;
uint16_t
maxlen
;
uint16_t
maxlen
;
int
over_size
;
};
};
struct
rtmp_reg
;
struct
rtmp_reg
;
...
...
src/mod/endpoints/mod_rtmp/rtmp.c
浏览文件 @
f1d5120f
...
@@ -105,7 +105,9 @@ void rtmp_handle_control(rtmp_session_t *rsession, int amfnumber)
...
@@ -105,7 +105,9 @@ void rtmp_handle_control(rtmp_session_t *rsession, int amfnumber)
void
rtmp_handle_invoke
(
rtmp_session_t
*
rsession
,
int
amfnumber
)
void
rtmp_handle_invoke
(
rtmp_session_t
*
rsession
,
int
amfnumber
)
{
{
rtmp_state_t
*
state
=
&
rsession
->
amfstate
[
amfnumber
];
rtmp_state_t
*
state
=
&
rsession
->
amfstate
[
amfnumber
];
//amf0_data *dump;
#ifdef RTMP_DEBUG_IO
amf0_data
*
dump
;
#endif
int
i
=
0
;
int
i
=
0
;
buffer_helper_t
helper
=
{
state
->
buf
,
0
,
state
->
origlen
};
buffer_helper_t
helper
=
{
state
->
buf
,
0
,
state
->
origlen
};
int64_t
transaction_id
;
int64_t
transaction_id
;
...
@@ -885,10 +887,18 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession)
...
@@ -885,10 +887,18 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession)
uint16_t
len
=
state
->
origlen
;
uint16_t
len
=
state
->
origlen
;
switch_mutex_lock
(
rsession
->
tech_pvt
->
readbuf_mutex
);
switch_mutex_lock
(
rsession
->
tech_pvt
->
readbuf_mutex
);
if
(
rsession
->
tech_pvt
->
maxlen
&&
switch_buffer_inuse
(
rsession
->
tech_pvt
->
readbuf
)
>
rsession
->
tech_pvt
->
maxlen
*
3
)
{
if
(
rsession
->
tech_pvt
->
maxlen
&&
switch_buffer_inuse
(
rsession
->
tech_pvt
->
readbuf
)
>
rsession
->
tech_pvt
->
maxlen
*
5
)
{
rsession
->
tech_pvt
->
over_size
++
;
}
else
{
rsession
->
tech_pvt
->
over_size
=
0
;
}
if
(
rsession
->
tech_pvt
->
over_size
>
10
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s buffer > %u for 10 consecutive packets... Flushing buffer
\n
"
,
switch_core_session_get_name
(
rsession
->
tech_pvt
->
session
),
rsession
->
tech_pvt
->
maxlen
*
5
);
switch_buffer_zero
(
rsession
->
tech_pvt
->
readbuf
);
switch_buffer_zero
(
rsession
->
tech_pvt
->
readbuf
);
#ifdef RTMP_DEBUG_IO
#ifdef RTMP_DEBUG_IO
fprintf
(
rsession
->
io_debug_in
,
"[chunk_stream=%d type=0x%x ts=%d stream_id=0x%x] FLUSH BUFFER [exceeded %u]
\n
"
,
rsession
->
amfnumber
,
state
->
type
,
(
int
)
state
->
ts
,
state
->
stream_id
,
rsession
->
tech_pvt
->
maxlen
*
3
);
fprintf
(
rsession
->
io_debug_in
,
"[chunk_stream=%d type=0x%x ts=%d stream_id=0x%x] FLUSH BUFFER [exceeded %u]
\n
"
,
rsession
->
amfnumber
,
state
->
type
,
(
int
)
state
->
ts
,
state
->
stream_id
,
rsession
->
tech_pvt
->
maxlen
*
5
);
#endif
#endif
}
}
switch_buffer_write
(
rsession
->
tech_pvt
->
readbuf
,
&
len
,
2
);
switch_buffer_write
(
rsession
->
tech_pvt
->
readbuf
,
&
len
,
2
);
...
...
src/mod/endpoints/mod_rtmp/rtmp_tcp.c
浏览文件 @
f1d5120f
...
@@ -197,10 +197,10 @@ void *SWITCH_THREAD_FUNC rtmp_io_tcp_thread(switch_thread_t *thread, void *obj)
...
@@ -197,10 +197,10 @@ void *SWITCH_THREAD_FUNC rtmp_io_tcp_thread(switch_thread_t *thread, void *obj)
switch_mutex_unlock
(
io
->
mutex
);
switch_mutex_unlock
(
io
->
mutex
);
if
(
status
!=
SWITCH_STATUS_SUCCESS
&&
status
!=
SWITCH_STATUS_TIMEOUT
)
{
if
(
status
!=
SWITCH_STATUS_SUCCESS
&&
status
!=
SWITCH_STATUS_TIMEOUT
)
{
//
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "pollset_poll failed\n");
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"pollset_poll failed
\n
"
);
continue
;
continue
;
}
else
if
(
status
==
SWITCH_STATUS_TIMEOUT
)
{
}
else
if
(
status
==
SWITCH_STATUS_TIMEOUT
)
{
switch_
yield
(
1
);
switch_
cond_next
(
);
}
}
for
(
i
=
0
;
i
<
numfds
;
i
++
)
{
for
(
i
=
0
;
i
<
numfds
;
i
++
)
{
...
@@ -219,6 +219,10 @@ void *SWITCH_THREAD_FUNC rtmp_io_tcp_thread(switch_thread_t *thread, void *obj)
...
@@ -219,6 +219,10 @@ void *SWITCH_THREAD_FUNC rtmp_io_tcp_thread(switch_thread_t *thread, void *obj)
if
(
switch_socket_opt_set
(
newsocket
,
SWITCH_SO_NONBLOCK
,
TRUE
))
{
if
(
switch_socket_opt_set
(
newsocket
,
SWITCH_SO_NONBLOCK
,
TRUE
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Couldn't set socket as non-blocking
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Couldn't set socket as non-blocking
\n
"
);
}
}
if
(
switch_socket_opt_set
(
newsocket
,
SWITCH_SO_TCP_NODELAY
,
1
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Couldn't disable Nagle.
\n
"
);
}
if
(
rtmp_session_request
(
io
->
base
.
profile
,
&
newsession
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
rtmp_session_request
(
io
->
base
.
profile
,
&
newsession
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"RTMP session request failed
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"RTMP session request failed
\n
"
);
...
@@ -314,6 +318,9 @@ switch_status_t rtmp_tcp_init(rtmp_profile_t *profile, const char *bindaddr, rtm
...
@@ -314,6 +318,9 @@ switch_status_t rtmp_tcp_init(rtmp_profile_t *profile, const char *bindaddr, rtm
if
(
switch_socket_opt_set
(
io_tcp
->
listen_socket
,
SWITCH_SO_REUSEADDR
,
1
))
{
if
(
switch_socket_opt_set
(
io_tcp
->
listen_socket
,
SWITCH_SO_REUSEADDR
,
1
))
{
goto
fail
;
goto
fail
;
}
}
if
(
switch_socket_opt_set
(
io_tcp
->
listen_socket
,
SWITCH_SO_TCP_NODELAY
,
1
))
{
goto
fail
;
}
if
(
switch_socket_bind
(
io_tcp
->
listen_socket
,
sa
))
{
if
(
switch_socket_bind
(
io_tcp
->
listen_socket
,
sa
))
{
goto
fail
;
goto
fail
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论