Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
6f89e253
提交
6f89e253
authored
2月 26, 2013
作者:
William King
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Moving all rtmp specific logging to use the rtmp uuid rather than the session uuid.
上级
fa6d4657
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
46 行增加
和
44 行删除
+46
-44
rtmp.c
src/mod/endpoints/mod_rtmp/rtmp.c
+28
-26
rtmp_sig.c
src/mod/endpoints/mod_rtmp/rtmp_sig.c
+7
-7
rtmp_tcp.c
src/mod/endpoints/mod_rtmp/rtmp_tcp.c
+11
-11
没有找到文件。
src/mod/endpoints/mod_rtmp/rtmp.c
浏览文件 @
6f89e253
...
...
@@ -73,7 +73,7 @@ void rtmp_handle_control(rtmp_session_t *rsession, int amfnumber)
p
+=
sprintf
(
p
,
"%02x "
,
state
->
buf
[
i
]
&
0xFF
);
}
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_DEBUG
,
"Control (%d): %s
\n
"
,
type
,
buf
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_DEBUG
,
"Control (%d): %s
\n
"
,
type
,
buf
);
switch
(
type
)
{
case
RTMP_CTRL_STREAM_BEGIN
:
...
...
@@ -85,7 +85,7 @@ void rtmp_handle_control(rtmp_session_t *rsession, int amfnumber)
state
->
buf
[
2
],
state
->
buf
[
3
],
state
->
buf
[
4
],
state
->
buf
[
5
]
};
rtmp_send_message
(
rsession
,
amfnumber
,
0
,
RTMP_TYPE_USERCTRL
,
0
,
buf
,
sizeof
(
buf
),
0
);
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_DEBUG
,
"Ping request
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_DEBUG
,
"Ping request
\n
"
);
}
break
;
case
RTMP_CTRL_PING_RESPONSE
:
...
...
@@ -93,11 +93,11 @@ void rtmp_handle_control(rtmp_session_t *rsession, int amfnumber)
uint32_t
now
=
((
switch_micro_time_now
()
/
1000
)
&
0xFFFFFFFF
);
uint32_t
sent
=
state
->
buf
[
2
]
<<
24
|
state
->
buf
[
3
]
<<
16
|
state
->
buf
[
4
]
<<
8
|
state
->
buf
[
5
];
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_INFO
,
"Ping reply: %d ms
\n
"
,
(
int
)(
now
-
sent
));
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_INFO
,
"Ping reply: %d ms
\n
"
,
(
int
)(
now
-
sent
));
}
break
;
default:
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_WARNING
,
"[amfnumber=%d] Unhandled control packet (type=0x%x)
\n
"
,
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_WARNING
,
"[amfnumber=%d] Unhandled control packet (type=0x%x)
\n
"
,
amfnumber
,
type
);
}
}
...
...
@@ -161,13 +161,13 @@ void rtmp_handle_invoke(rtmp_session_t *rsession, int amfnumber)
while
(
argc
<
switch_arraylen
(
argv
)
&&
(
argv
[
argc
++
]
=
amf0_data_read
(
my_buffer_read
,
&
helper
)));
if
(
!
(
command
=
amf0_get_string
(
argv
[
i
++
])))
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_WARNING
,
"Bogus INVOKE request
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_WARNING
,
"Bogus INVOKE request
\n
"
);
return
;
}
transaction_id
=
amf0_get_number
(
argv
[
i
++
]);
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_DEBUG
,
"[amfnumber=%d] Got INVOKE for %s
\n
"
,
amfnumber
,
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_DEBUG
,
"[amfnumber=%d] Got INVOKE for %s
\n
"
,
amfnumber
,
command
);
if
((
function
=
(
rtmp_invoke_function_t
)(
intptr_t
)
switch_core_hash_find
(
rtmp_globals
.
invoke_hash
,
command
)))
{
...
...
@@ -561,13 +561,15 @@ switch_status_t rtmp_send_message(rtmp_session_t *rsession, uint8_t amfnumber, u
if
((
rsession
->
send_ack
+
rsession
->
send_ack_window
)
<
rsession
->
send
&&
(
type
==
RTMP_TYPE_VIDEO
||
type
==
RTMP_TYPE_AUDIO
))
{
/* We're sending too fast, drop the frame */
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"DROP %s FRAME [amfnumber=%d type=0x%x stream_id=0x%x] len=%"
SWITCH_SIZE_T_FMT
"
\n
"
,
type
==
RTMP_TYPE_AUDIO
?
"AUDIO"
:
"VIDEO"
,
amfnumber
,
type
,
stream_id
,
len
);
switch_log_printf
(
SWITCH_CHANNEL_UUID_LOG
(
rsession
->
uuid
),
SWITCH_LOG_DEBUG
,
"DROP %s FRAME [amfnumber=%d type=0x%x stream_id=0x%x] len=%"
SWITCH_SIZE_T_FMT
"
\n
"
,
type
==
RTMP_TYPE_AUDIO
?
"AUDIO"
:
"VIDEO"
,
amfnumber
,
type
,
stream_id
,
len
);
return
SWITCH_STATUS_SUCCESS
;
}
if
(
type
!=
RTMP_TYPE_AUDIO
&&
type
!=
RTMP_TYPE_VIDEO
&&
type
!=
RTMP_TYPE_ACK
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"[amfnumber=%d type=0x%x stream_id=0x%x] len=%"
SWITCH_SIZE_T_FMT
"
\n
"
,
amfnumber
,
type
,
stream_id
,
len
);
switch_log_printf
(
SWITCH_CHANNEL_UUID_LOG
(
rsession
->
uuid
),
SWITCH_LOG_DEBUG
,
"[amfnumber=%d type=0x%x stream_id=0x%x] len=%"
SWITCH_SIZE_T_FMT
"
\n
"
,
amfnumber
,
type
,
stream_id
,
len
);
}
#ifdef RTMP_DEBUG_IO
...
...
@@ -681,7 +683,7 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession)
s
=
1537
-
rsession
->
hspos
;
if
(
rsession
->
profile
->
io
->
read
(
rsession
,
rsession
->
hsbuf
+
rsession
->
hspos
,
&
s
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_NOTICE
,
"Disconnected from flash client
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_NOTICE
,
"Disconnected from flash client
\n
"
);
return
SWITCH_STATUS_FALSE
;
}
...
...
@@ -703,7 +705,7 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession)
s
=
1536
;
rsession
->
profile
->
io
->
write
(
rsession
,
rsession
->
hsbuf
,
&
s
);
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_DEBUG
,
"Sent handshake response
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_DEBUG
,
"Sent handshake response
\n
"
);
rsession
->
state
++
;
rsession
->
hspos
=
0
;
...
...
@@ -712,7 +714,7 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession)
/* Receive C2 */
if
(
rsession
->
profile
->
io
->
read
(
rsession
,
rsession
->
hsbuf
+
rsession
->
hspos
,
&
s
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_NOTICE
,
"Disconnected from flash client
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_NOTICE
,
"Disconnected from flash client
\n
"
);
return
SWITCH_STATUS_FALSE
;
}
...
...
@@ -728,7 +730,7 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession)
//s = 1536;
//rsession->profile->io->write(rsession, (char*)buf, &s);
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_DEBUG
,
"Done with handshake
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_DEBUG
,
"Done with handshake
\n
"
);
return
SWITCH_STATUS_SUCCESS
;
...
...
@@ -739,7 +741,7 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession)
// Read the header's first byte
s
=
1
;
if
(
rsession
->
profile
->
io
->
read
(
rsession
,
(
unsigned
char
*
)
buf
,
&
s
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_NOTICE
,
"Disconnected from flash client
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_NOTICE
,
"Disconnected from flash client
\n
"
);
return
SWITCH_STATUS_FALSE
;
}
...
...
@@ -760,12 +762,12 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession)
break
;
default:
rsession
->
hdrsize
=
0
;
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_CRIT
,
"WTF hdrsize 0x%02x %d
\n
"
,
*
buf
,
*
buf
>>
6
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_CRIT
,
"WTF hdrsize 0x%02x %d
\n
"
,
*
buf
,
*
buf
>>
6
);
return
SWITCH_STATUS_FALSE
;
}
rsession
->
amfnumber
=
buf
[
0
]
&
0x3F
;
/* Get rid of the 2 first bits */
if
(
rsession
->
amfnumber
>
64
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"Protocol error
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_ERROR
,
"Protocol error
\n
"
);
return
SWITCH_STATUS_FALSE
;
}
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Header size: %d AMF Number: %d\n", rsession->hdrsize, rsession->amfnumber);
...
...
@@ -794,7 +796,7 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession)
switch_assert
(
s
<
12
&&
s
>
0
);
/** XXX **/
if
(
rsession
->
profile
->
io
->
read
(
rsession
,
readbuf
,
&
s
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_NOTICE
,
"Disconnected from flash client
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_NOTICE
,
"Disconnected from flash client
\n
"
);
return
SWITCH_STATUS_FALSE
;
}
...
...
@@ -857,7 +859,7 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession)
s
=
state
->
remainlen
=
state
->
origlen
;
rsession
->
parse_remain
=
s
;
if
(
!
s
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"Protocol error, forcing big read
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_ERROR
,
"Protocol error, forcing big read
\n
"
);
s
=
sizeof
(
state
->
buf
);
rsession
->
profile
->
io
->
read
(
rsession
,
state
->
buf
,
&
s
);
return
SWITCH_STATUS_FALSE
;
...
...
@@ -866,17 +868,17 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession)
/* Sanity check */
if
((
state
->
buf_pos
+
s
)
>
AMF_MAX_SIZE
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"WTF %"
SWITCH_SIZE_T_FMT
" %"
SWITCH_SIZE_T_FMT
"
\n
"
,
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_ERROR
,
"WTF %"
SWITCH_SIZE_T_FMT
" %"
SWITCH_SIZE_T_FMT
"
\n
"
,
state
->
buf_pos
,
s
);
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"Protocol error: exceeding max AMF packet size
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_ERROR
,
"Protocol error: exceeding max AMF packet size
\n
"
);
return
SWITCH_STATUS_FALSE
;
}
switch_assert
(
s
<=
rsession
->
in_chunksize
);
if
(
rsession
->
profile
->
io
->
read
(
rsession
,
state
->
buf
+
state
->
buf_pos
,
&
s
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_NOTICE
,
"Disconnected from flash client
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_NOTICE
,
"Disconnected from flash client
\n
"
);
return
SWITCH_STATUS_FALSE
;
}
rsession
->
recv
+=
s
;
...
...
@@ -893,7 +895,7 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession)
if
(
state
->
remainlen
==
0
)
{
if
(
state
->
type
!=
RTMP_TYPE_AUDIO
&&
state
->
type
!=
RTMP_TYPE_VIDEO
&&
state
->
type
!=
RTMP_TYPE_ACK
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_DEBUG
,
"[chunk_stream=%d type=0x%x ts=%d stream_id=0x%x] len=%d
\n
"
,
rsession
->
amfnumber
,
state
->
type
,
(
int
)
state
->
ts
,
state
->
stream_id
,
state
->
origlen
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_DEBUG
,
"[chunk_stream=%d type=0x%x ts=%d stream_id=0x%x] len=%d
\n
"
,
rsession
->
amfnumber
,
state
->
type
,
(
int
)
state
->
ts
,
state
->
stream_id
,
state
->
origlen
);
}
#ifdef RTMP_DEBUG_IO
fprintf
(
rsession
->
io_debug_in
,
"[chunk_stream=%d type=0x%x ts=%d stream_id=0x%x] len=%d
\n
"
,
rsession
->
amfnumber
,
state
->
type
,
(
int
)
state
->
ts
,
state
->
stream_id
,
state
->
origlen
);
...
...
@@ -901,7 +903,7 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession)
switch
(
state
->
type
)
{
case
RTMP_TYPE_CHUNKSIZE
:
rsession
->
in_chunksize
=
state
->
buf
[
0
]
<<
24
|
state
->
buf
[
1
]
<<
16
|
state
->
buf
[
2
]
<<
8
|
state
->
buf
[
3
];
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_DEBUG
,
"SET CHUNKSIZE=%d
\n
"
,
(
int
)
rsession
->
in_chunksize
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_DEBUG
,
"SET CHUNKSIZE=%d
\n
"
,
(
int
)
rsession
->
in_chunksize
);
break
;
case
RTMP_TYPE_USERCTRL
:
rtmp_handle_control
(
rsession
,
rsession
->
amfnumber
);
...
...
@@ -927,7 +929,7 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession)
rsession
->
tech_pvt
->
over_size
=
0
;
}
if
(
rsession
->
tech_pvt
->
over_size
>
10
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_DEBUG
,
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
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
*
40
);
switch_buffer_zero
(
rsession
->
tech_pvt
->
readbuf
);
...
...
@@ -949,7 +951,7 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession)
break
;
case
RTMP_TYPE_WINDOW_ACK_SIZE
:
rsession
->
send_ack_window
=
(
state
->
buf
[
0
]
<<
24
)
|
(
state
->
buf
[
1
]
<<
16
)
|
(
state
->
buf
[
2
]
<<
8
)
|
(
state
->
buf
[
3
]);
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_DEBUG
,
"Set window size: %lu bytes
\n
"
,
(
long
unsigned
int
)
rsession
->
send_ack_window
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_DEBUG
,
"Set window size: %lu bytes
\n
"
,
(
long
unsigned
int
)
rsession
->
send_ack_window
);
break
;
case
RTMP_TYPE_ACK
:
{
...
...
@@ -968,7 +970,7 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession)
break
;
}
default:
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_WARNING
,
"Cannot handle message type 0x%x
\n
"
,
state
->
type
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_WARNING
,
"Cannot handle message type 0x%x
\n
"
,
state
->
type
);
break
;
}
state
->
buf_pos
=
0
;
...
...
src/mod/endpoints/mod_rtmp/rtmp_sig.c
浏览文件 @
6f89e253
...
...
@@ -118,7 +118,7 @@ RTMP_INVOKE_FUNCTION(rtmp_i_connect)
amf0_null_new
(),
amf0_str
(
rsession
->
uuid
),
NULL
);
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_NOTICE
,
"Sent connect reply
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_NOTICE
,
"Sent connect reply
\n
"
);
return
SWITCH_STATUS_SUCCESS
;
}
...
...
@@ -133,7 +133,7 @@ RTMP_INVOKE_FUNCTION(rtmp_i_createStream)
amf0_number_new
(
rsession
->
next_streamid
),
NULL
);
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_INFO
,
"Replied to createStream (%u)
\n
"
,
rsession
->
next_streamid
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_INFO
,
"Replied to createStream (%u)
\n
"
,
rsession
->
next_streamid
);
rsession
->
next_streamid
++
;
...
...
@@ -156,7 +156,7 @@ RTMP_INVOKE_FUNCTION(rtmp_i_receiveaudio)
switch_clear_flag
(
rsession
,
SFLAG_AUDIO
);
}
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_INFO
,
"%sending audio
\n
"
,
enabled
?
"S"
:
"Not s"
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_INFO
,
"%sending audio
\n
"
,
enabled
?
"S"
:
"Not s"
);
return
SWITCH_STATUS_SUCCESS
;
}
...
...
@@ -174,7 +174,7 @@ RTMP_INVOKE_FUNCTION(rtmp_i_receivevideo)
switch_clear_flag
(
rsession
,
SFLAG_VIDEO
);
}
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_INFO
,
"%sending video
\n
"
,
enabled
?
"S"
:
"Not s"
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_INFO
,
"%sending video
\n
"
,
enabled
?
"S"
:
"Not s"
);
return
SWITCH_STATUS_SUCCESS
;
}
...
...
@@ -185,7 +185,7 @@ RTMP_INVOKE_FUNCTION(rtmp_i_play)
amf0_data
*
obj
=
amf0_object_new
();
amf0_data
*
object
=
amf0_object_new
();
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_DEBUG
,
"Got play for %s on stream %d
\n
"
,
switch_str_nil
(
amf0_get_string
(
argv
[
1
])),
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_DEBUG
,
"Got play for %s on stream %d
\n
"
,
switch_str_nil
(
amf0_get_string
(
argv
[
1
])),
state
->
stream_id
);
/* Set outgoing chunk size to 1024 bytes */
...
...
@@ -271,7 +271,7 @@ RTMP_INVOKE_FUNCTION(rtmp_i_publish)
NULL
);
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_INFO
,
"Got publish on stream %u.
\n
"
,
state
->
stream_id
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_INFO
,
"Got publish on stream %u.
\n
"
,
state
->
stream_id
);
return
SWITCH_STATUS_SUCCESS
;
}
...
...
@@ -783,7 +783,7 @@ RTMP_INVOKE_FUNCTION(rtmp_i_sendevent)
uuid
=
amf0_get_string
(
argv
[
1
]);
obj
=
argv
[
2
];
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"Bad argument for sendevent"
);
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_ERROR
,
"Bad argument for sendevent"
);
return
SWITCH_STATUS_FALSE
;
}
...
...
src/mod/endpoints/mod_rtmp/rtmp_tcp.c
浏览文件 @
6f89e253
...
...
@@ -70,7 +70,7 @@ static void rtmp_tcp_alter_pollfd(rtmp_session_t *rsession, switch_bool_t pollou
if
(
pollout
)
{
io_pvt
->
pollfd
->
reqevents
|=
SWITCH_POLLOUT
;
}
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_NOTICE
,
"Pollout: %s
\n
"
,
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_NOTICE
,
"Pollout: %s
\n
"
,
pollout
?
"true"
:
"false"
);
switch_pollset_add
(
io
->
pollset
,
io_pvt
->
pollfd
);
...
...
@@ -153,7 +153,7 @@ static switch_status_t rtmp_tcp_write(rtmp_session_t *rsession, const unsigned c
}
/* We didnt send it all... add it to the sendq*/
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_DEBUG
,
"%"
SWITCH_SIZE_T_FMT
" bytes added to sendq.
\n
"
,
(
orig_len
-
*
len
));
switch_log_printf
(
SWITCH_CHANNEL_
UUID_LOG
(
rsession
->
uuid
)
,
SWITCH_LOG_DEBUG
,
"%"
SWITCH_SIZE_T_FMT
" bytes added to sendq.
\n
"
,
(
orig_len
-
*
len
));
switch_buffer_write
(
io_pvt
->
sendq
,
(
buf
+
*
len
),
orig_len
-
*
len
);
...
...
@@ -217,7 +217,7 @@ void *SWITCH_THREAD_FUNC rtmp_io_tcp_thread(switch_thread_t *thread, void *obj)
return
NULL
;
}
}
else
{
rtmp_session_t
*
new
session
;
rtmp_session_t
*
r
session
;
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
"
);
...
...
@@ -227,7 +227,7 @@ void *SWITCH_THREAD_FUNC rtmp_io_tcp_thread(switch_thread_t *thread, void *obj)
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Couldn't disable Nagle.
\n
"
);
}
if
(
rtmp_session_request
(
io
->
base
.
profile
,
&
new
session
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
rtmp_session_request
(
io
->
base
.
profile
,
&
r
session
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"RTMP session request failed
\n
"
);
switch_socket_close
(
newsocket
);
}
else
{
...
...
@@ -235,20 +235,20 @@ void *SWITCH_THREAD_FUNC rtmp_io_tcp_thread(switch_thread_t *thread, void *obj)
char
ipbuf
[
200
];
/* Create out private data and attach it to the rtmp session structure */
rtmp_tcp_io_private_t
*
pvt
=
switch_core_alloc
(
new
session
->
pool
,
sizeof
(
*
pvt
));
new
session
->
io_private
=
pvt
;
rtmp_tcp_io_private_t
*
pvt
=
switch_core_alloc
(
r
session
->
pool
,
sizeof
(
*
pvt
));
r
session
->
io_private
=
pvt
;
pvt
->
socket
=
newsocket
;
switch_socket_create_pollfd
(
&
pvt
->
pollfd
,
newsocket
,
SWITCH_POLLIN
|
SWITCH_POLLERR
,
newsession
,
new
session
->
pool
);
switch_socket_create_pollfd
(
&
pvt
->
pollfd
,
newsocket
,
SWITCH_POLLIN
|
SWITCH_POLLERR
,
rsession
,
r
session
->
pool
);
switch_pollset_add
(
io
->
pollset
,
pvt
->
pollfd
);
switch_buffer_create_dynamic
(
&
pvt
->
sendq
,
512
,
1024
,
0
);
/* Get the remote address/port info */
switch_socket_addr_get
(
&
addr
,
SWITCH_TRUE
,
newsocket
);
switch_get_addr
(
ipbuf
,
sizeof
(
ipbuf
),
addr
);
newsession
->
remote_address
=
switch_core_strdup
(
new
session
->
pool
,
ipbuf
);
new
session
->
remote_port
=
switch_sockaddr_get_port
(
addr
);
switch_log_printf
(
SWITCH_CHANNEL_UUID_LOG
(
new
session
->
uuid
),
SWITCH_LOG_INFO
,
"Rtmp connection from %s:%i
\n
"
,
newsession
->
remote_address
,
new
session
->
remote_port
);
rsession
->
remote_address
=
switch_core_strdup
(
r
session
->
pool
,
ipbuf
);
r
session
->
remote_port
=
switch_sockaddr_get_port
(
addr
);
switch_log_printf
(
SWITCH_CHANNEL_UUID_LOG
(
r
session
->
uuid
),
SWITCH_LOG_INFO
,
"Rtmp connection from %s:%i
\n
"
,
rsession
->
remote_address
,
r
session
->
remote_port
);
}
}
}
else
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论