Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
2c17fb61
Commit
2c17fb61
authored
Nov 24, 2015
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rtsp: Log getaddrinfo failures
And forward the logging contexts when needed.
parent
12b14382
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
10 deletions
+20
-10
rtsp.c
libavformat/rtsp.c
+17
-8
rtsp.h
libavformat/rtsp.h
+2
-1
rtspdec.c
libavformat/rtspdec.c
+1
-1
No files found.
libavformat/rtsp.c
View file @
2c17fb61
...
@@ -178,12 +178,19 @@ static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end)
...
@@ -178,12 +178,19 @@ static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end)
}
}
}
}
static
int
get_sockaddr
(
const
char
*
buf
,
struct
sockaddr_storage
*
sock
)
static
int
get_sockaddr
(
AVFormatContext
*
s
,
const
char
*
buf
,
struct
sockaddr_storage
*
sock
)
{
{
struct
addrinfo
hints
=
{
0
},
*
ai
=
NULL
;
struct
addrinfo
hints
=
{
0
},
*
ai
=
NULL
;
int
ret
;
hints
.
ai_flags
=
AI_NUMERICHOST
;
hints
.
ai_flags
=
AI_NUMERICHOST
;
if
(
getaddrinfo
(
buf
,
NULL
,
&
hints
,
&
ai
))
if
((
ret
=
getaddrinfo
(
buf
,
NULL
,
&
hints
,
&
ai
)))
{
av_log
(
s
,
AV_LOG_ERROR
,
"getaddrinfo(%s): %s
\n
"
,
buf
,
gai_strerror
(
ret
));
return
-
1
;
return
-
1
;
}
memcpy
(
sock
,
ai
->
ai_addr
,
FFMIN
(
sizeof
(
*
sock
),
ai
->
ai_addrlen
));
memcpy
(
sock
,
ai
->
ai_addr
,
FFMIN
(
sizeof
(
*
sock
),
ai
->
ai_addrlen
));
freeaddrinfo
(
ai
);
freeaddrinfo
(
ai
);
return
0
;
return
0
;
...
@@ -391,7 +398,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
...
@@ -391,7 +398,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
if
(
strcmp
(
buf1
,
"IP4"
)
&&
strcmp
(
buf1
,
"IP6"
))
if
(
strcmp
(
buf1
,
"IP4"
)
&&
strcmp
(
buf1
,
"IP6"
))
return
;
return
;
get_word_sep
(
buf1
,
sizeof
(
buf1
),
"/"
,
&
p
);
get_word_sep
(
buf1
,
sizeof
(
buf1
),
"/"
,
&
p
);
if
(
get_sockaddr
(
buf1
,
&
sdp_ip
))
if
(
get_sockaddr
(
s
,
buf1
,
&
sdp_ip
))
return
;
return
;
ttl
=
16
;
ttl
=
16
;
if
(
*
p
==
'/'
)
{
if
(
*
p
==
'/'
)
{
...
@@ -853,7 +860,8 @@ static void rtsp_parse_range(int *min_ptr, int *max_ptr, const char **pp)
...
@@ -853,7 +860,8 @@ static void rtsp_parse_range(int *min_ptr, int *max_ptr, const char **pp)
}
}
/* XXX: only one transport specification is parsed */
/* XXX: only one transport specification is parsed */
static
void
rtsp_parse_transport
(
RTSPMessageHeader
*
reply
,
const
char
*
p
)
static
void
rtsp_parse_transport
(
AVFormatContext
*
s
,
RTSPMessageHeader
*
reply
,
const
char
*
p
)
{
{
char
transport_protocol
[
16
];
char
transport_protocol
[
16
];
char
profile
[
16
];
char
profile
[
16
];
...
@@ -945,7 +953,7 @@ static void rtsp_parse_transport(RTSPMessageHeader *reply, const char *p)
...
@@ -945,7 +953,7 @@ static void rtsp_parse_transport(RTSPMessageHeader *reply, const char *p)
if
(
*
p
==
'='
)
{
if
(
*
p
==
'='
)
{
p
++
;
p
++
;
get_word_sep
(
buf
,
sizeof
(
buf
),
";,"
,
&
p
);
get_word_sep
(
buf
,
sizeof
(
buf
),
";,"
,
&
p
);
get_sockaddr
(
buf
,
&
th
->
destination
);
get_sockaddr
(
s
,
buf
,
&
th
->
destination
);
}
}
}
else
if
(
!
strcmp
(
parameter
,
"source"
))
{
}
else
if
(
!
strcmp
(
parameter
,
"source"
))
{
if
(
*
p
==
'='
)
{
if
(
*
p
==
'='
)
{
...
@@ -1032,7 +1040,8 @@ static void rtsp_parse_rtp_info(RTSPState *rt, const char *p)
...
@@ -1032,7 +1040,8 @@ static void rtsp_parse_rtp_info(RTSPState *rt, const char *p)
handle_rtp_info
(
rt
,
url
,
seq
,
rtptime
);
handle_rtp_info
(
rt
,
url
,
seq
,
rtptime
);
}
}
void
ff_rtsp_parse_line
(
RTSPMessageHeader
*
reply
,
const
char
*
buf
,
void
ff_rtsp_parse_line
(
AVFormatContext
*
s
,
RTSPMessageHeader
*
reply
,
const
char
*
buf
,
RTSPState
*
rt
,
const
char
*
method
)
RTSPState
*
rt
,
const
char
*
method
)
{
{
const
char
*
p
;
const
char
*
p
;
...
@@ -1049,7 +1058,7 @@ void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf,
...
@@ -1049,7 +1058,7 @@ void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf,
}
else
if
(
av_stristart
(
p
,
"Content-Length:"
,
&
p
))
{
}
else
if
(
av_stristart
(
p
,
"Content-Length:"
,
&
p
))
{
reply
->
content_length
=
strtol
(
p
,
NULL
,
10
);
reply
->
content_length
=
strtol
(
p
,
NULL
,
10
);
}
else
if
(
av_stristart
(
p
,
"Transport:"
,
&
p
))
{
}
else
if
(
av_stristart
(
p
,
"Transport:"
,
&
p
))
{
rtsp_parse_transport
(
reply
,
p
);
rtsp_parse_transport
(
s
,
reply
,
p
);
}
else
if
(
av_stristart
(
p
,
"CSeq:"
,
&
p
))
{
}
else
if
(
av_stristart
(
p
,
"CSeq:"
,
&
p
))
{
reply
->
seq
=
strtol
(
p
,
NULL
,
10
);
reply
->
seq
=
strtol
(
p
,
NULL
,
10
);
}
else
if
(
av_stristart
(
p
,
"Range:"
,
&
p
))
{
}
else
if
(
av_stristart
(
p
,
"Range:"
,
&
p
))
{
...
@@ -1178,7 +1187,7 @@ start:
...
@@ -1178,7 +1187,7 @@ start:
request
=
1
;
request
=
1
;
}
}
}
else
{
}
else
{
ff_rtsp_parse_line
(
reply
,
p
,
rt
,
method
);
ff_rtsp_parse_line
(
s
,
reply
,
p
,
rt
,
method
);
av_strlcat
(
rt
->
last_reply
,
p
,
sizeof
(
rt
->
last_reply
));
av_strlcat
(
rt
->
last_reply
,
p
,
sizeof
(
rt
->
last_reply
));
av_strlcat
(
rt
->
last_reply
,
"
\n
"
,
sizeof
(
rt
->
last_reply
));
av_strlcat
(
rt
->
last_reply
,
"
\n
"
,
sizeof
(
rt
->
last_reply
));
}
}
...
...
libavformat/rtsp.h
View file @
2c17fb61
...
@@ -459,7 +459,8 @@ typedef struct RTSPStream {
...
@@ -459,7 +459,8 @@ typedef struct RTSPStream {
char
crypto_params
[
100
];
char
crypto_params
[
100
];
}
RTSPStream
;
}
RTSPStream
;
void
ff_rtsp_parse_line
(
RTSPMessageHeader
*
reply
,
const
char
*
buf
,
void
ff_rtsp_parse_line
(
AVFormatContext
*
s
,
RTSPMessageHeader
*
reply
,
const
char
*
buf
,
RTSPState
*
rt
,
const
char
*
method
);
RTSPState
*
rt
,
const
char
*
method
);
/**
/**
...
...
libavformat/rtspdec.c
View file @
2c17fb61
...
@@ -151,7 +151,7 @@ static inline int rtsp_read_request(AVFormatContext *s,
...
@@ -151,7 +151,7 @@ static inline int rtsp_read_request(AVFormatContext *s,
return
ret
;
return
ret
;
if
(
rbuflen
>
1
)
{
if
(
rbuflen
>
1
)
{
av_log
(
s
,
AV_LOG_TRACE
,
"Parsing[%d]: %s
\n
"
,
rbuflen
,
rbuf
);
av_log
(
s
,
AV_LOG_TRACE
,
"Parsing[%d]: %s
\n
"
,
rbuflen
,
rbuf
);
ff_rtsp_parse_line
(
request
,
rbuf
,
rt
,
method
);
ff_rtsp_parse_line
(
s
,
request
,
rbuf
,
rt
,
method
);
}
}
}
while
(
rbuflen
>
0
);
}
while
(
rbuflen
>
0
);
if
(
request
->
seq
!=
rt
->
seq
+
1
)
{
if
(
request
->
seq
!=
rt
->
seq
+
1
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment