Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
2762a7a2
F
Ffmpeg
项目概览
小白菜888
/
Ffmpeg
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Ffmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2762a7a2
编写于
1月 10, 2011
作者:
M
Martin Storsjö
提交者:
Janne Grunau
1月 24, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rtspdec: Retry with TCP if UDP failed
Signed-off-by:
N
Janne Grunau
<
janne-ffmpeg@jannau.net
>
上级
e836b1b0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
56 addition
and
2 deletion
+56
-2
libavformat/rtsp.c
libavformat/rtsp.c
+3
-1
libavformat/rtsp.h
libavformat/rtsp.h
+13
-0
libavformat/rtspdec.c
libavformat/rtspdec.c
+40
-1
未找到文件。
libavformat/rtsp.c
浏览文件 @
2762a7a2
...
@@ -1291,7 +1291,7 @@ int ff_rtsp_connect(AVFormatContext *s)
...
@@ -1291,7 +1291,7 @@ int ff_rtsp_connect(AVFormatContext *s)
int
port
,
err
,
tcp_fd
;
int
port
,
err
,
tcp_fd
;
RTSPMessageHeader
reply1
=
{
0
},
*
reply
=
&
reply1
;
RTSPMessageHeader
reply1
=
{
0
},
*
reply
=
&
reply1
;
int
lower_transport_mask
=
0
;
int
lower_transport_mask
=
0
;
char
real_challenge
[
64
];
char
real_challenge
[
64
]
=
""
;
struct
sockaddr_storage
peer
;
struct
sockaddr_storage
peer
;
socklen_t
peer_len
=
sizeof
(
peer
);
socklen_t
peer_len
=
sizeof
(
peer
);
...
@@ -1515,6 +1515,8 @@ redirect:
...
@@ -1515,6 +1515,8 @@ redirect:
}
}
}
while
(
err
);
}
while
(
err
);
rt
->
lower_transport_mask
=
lower_transport_mask
;
av_strlcpy
(
rt
->
real_challenge
,
real_challenge
,
sizeof
(
rt
->
real_challenge
));
rt
->
state
=
RTSP_STATE_IDLE
;
rt
->
state
=
RTSP_STATE_IDLE
;
rt
->
seek_timestamp
=
0
;
/* default is to start stream at position zero */
rt
->
seek_timestamp
=
0
;
/* default is to start stream at position zero */
return
0
;
return
0
;
...
...
libavformat/rtsp.h
浏览文件 @
2762a7a2
...
@@ -248,6 +248,9 @@ typedef struct RTSPState {
...
@@ -248,6 +248,9 @@ typedef struct RTSPState {
* of RTSPMessageHeader->real_challenge */
* of RTSPMessageHeader->real_challenge */
enum
RTSPServerType
server_type
;
enum
RTSPServerType
server_type
;
/** the "RealChallenge1:" field from the server */
char
real_challenge
[
64
];
/** plaintext authorization line (username:password) */
/** plaintext authorization line (username:password) */
char
auth
[
128
];
char
auth
[
128
];
...
@@ -313,6 +316,16 @@ typedef struct RTSPState {
...
@@ -313,6 +316,16 @@ typedef struct RTSPState {
/** Filter incoming UDP packets - receive packets only from the right
/** Filter incoming UDP packets - receive packets only from the right
* source address and port. */
* source address and port. */
int
filter_source
;
int
filter_source
;
/**
* A mask with all requested transport methods
*/
int
lower_transport_mask
;
/**
* The number of returned packets
*/
uint64_t
packets
;
}
RTSPState
;
}
RTSPState
;
/**
/**
...
...
libavformat/rtspdec.c
浏览文件 @
2762a7a2
...
@@ -229,6 +229,20 @@ found:
...
@@ -229,6 +229,20 @@ found:
*
prtsp_st
=
rtsp_st
;
*
prtsp_st
=
rtsp_st
;
return
len
;
return
len
;
}
}
static
int
resetup_tcp
(
AVFormatContext
*
s
)
{
RTSPState
*
rt
=
s
->
priv_data
;
char
host
[
1024
];
int
port
;
av_url_split
(
NULL
,
0
,
NULL
,
0
,
host
,
sizeof
(
host
),
&
port
,
NULL
,
0
,
s
->
filename
);
ff_rtsp_undo_setup
(
s
);
return
ff_rtsp_make_setup_request
(
s
,
host
,
port
,
RTSP_LOWER_TRANSPORT_TCP
,
rt
->
real_challenge
);
}
static
int
rtsp_read_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
static
int
rtsp_read_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
{
{
RTSPState
*
rt
=
s
->
priv_data
;
RTSPState
*
rt
=
s
->
priv_data
;
...
@@ -236,6 +250,7 @@ static int rtsp_read_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -236,6 +250,7 @@ static int rtsp_read_packet(AVFormatContext *s, AVPacket *pkt)
RTSPMessageHeader
reply1
,
*
reply
=
&
reply1
;
RTSPMessageHeader
reply1
,
*
reply
=
&
reply1
;
char
cmd
[
1024
];
char
cmd
[
1024
];
retry:
if
(
rt
->
server_type
==
RTSP_SERVER_REAL
)
{
if
(
rt
->
server_type
==
RTSP_SERVER_REAL
)
{
int
i
;
int
i
;
...
@@ -295,8 +310,32 @@ static int rtsp_read_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -295,8 +310,32 @@ static int rtsp_read_packet(AVFormatContext *s, AVPacket *pkt)
}
}
ret
=
ff_rtsp_fetch_packet
(
s
,
pkt
);
ret
=
ff_rtsp_fetch_packet
(
s
,
pkt
);
if
(
ret
<
0
)
if
(
ret
<
0
)
{
if
(
ret
==
FF_NETERROR
(
ETIMEDOUT
)
&&
!
rt
->
packets
)
{
if
(
rt
->
lower_transport
==
RTSP_LOWER_TRANSPORT_UDP
&&
rt
->
lower_transport_mask
&
(
1
<<
RTSP_LOWER_TRANSPORT_TCP
))
{
RTSPMessageHeader
reply1
,
*
reply
=
&
reply1
;
av_log
(
s
,
AV_LOG_WARNING
,
"UDP timeout, retrying with TCP
\n
"
);
if
(
rtsp_read_pause
(
s
)
!=
0
)
return
-
1
;
// TEARDOWN is required on Real-RTSP, but might make
// other servers close the connection.
if
(
rt
->
server_type
==
RTSP_SERVER_REAL
)
ff_rtsp_send_cmd
(
s
,
"TEARDOWN"
,
rt
->
control_uri
,
NULL
,
reply
,
NULL
);
rt
->
session_id
[
0
]
=
'\0'
;
if
(
resetup_tcp
(
s
)
==
0
)
{
rt
->
state
=
RTSP_STATE_IDLE
;
rt
->
need_subscription
=
1
;
if
(
rtsp_read_play
(
s
)
!=
0
)
return
-
1
;
goto
retry
;
}
}
}
return
ret
;
return
ret
;
}
rt
->
packets
++
;
/* send dummy request to keep TCP connection alive */
/* send dummy request to keep TCP connection alive */
if
((
av_gettime
()
-
rt
->
last_cmd_time
)
/
1000000
>=
rt
->
timeout
/
2
)
{
if
((
av_gettime
()
-
rt
->
last_cmd_time
)
/
1000000
>=
rt
->
timeout
/
2
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录