Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
b7168586
Commit
b7168586
authored
Mar 02, 2020
by
phunkyfish
Committed by
Aman Gupta
Mar 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/rtp: Pass sources and block filter addresses via sdp file for rtp
Signed-off-by:
Aman Gupta
<
aman@tmm1.net
>
parent
ca7a192d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
9 deletions
+40
-9
rtsp.c
libavformat/rtsp.c
+40
-9
No files found.
libavformat/rtsp.c
View file @
b7168586
...
@@ -2447,8 +2447,8 @@ static int rtp_probe(const AVProbeData *p)
...
@@ -2447,8 +2447,8 @@ static int rtp_probe(const AVProbeData *p)
static
int
rtp_read_header
(
AVFormatContext
*
s
)
static
int
rtp_read_header
(
AVFormatContext
*
s
)
{
{
uint8_t
recvbuf
[
RTP_MAX_PACKET_LENGTH
];
uint8_t
recvbuf
[
RTP_MAX_PACKET_LENGTH
];
char
host
[
500
],
sdp
[
5
00
];
char
host
[
500
],
sdp
[
1000
],
filters_buf
[
10
00
];
int
ret
,
port
;
int
ret
,
port
,
sdp_length
,
nc
;
URLContext
*
in
=
NULL
;
URLContext
*
in
=
NULL
;
int
payload_type
;
int
payload_type
;
AVCodecParameters
*
par
=
NULL
;
AVCodecParameters
*
par
=
NULL
;
...
@@ -2456,6 +2456,7 @@ static int rtp_read_header(AVFormatContext *s)
...
@@ -2456,6 +2456,7 @@ static int rtp_read_header(AVFormatContext *s)
AVIOContext
pb
;
AVIOContext
pb
;
socklen_t
addrlen
=
sizeof
(
addr
);
socklen_t
addrlen
=
sizeof
(
addr
);
RTSPState
*
rt
=
s
->
priv_data
;
RTSPState
*
rt
=
s
->
priv_data
;
const
char
*
p
;
if
(
!
ff_network_init
())
if
(
!
ff_network_init
())
return
AVERROR
(
EIO
);
return
AVERROR
(
EIO
);
...
@@ -2513,13 +2514,40 @@ static int rtp_read_header(AVFormatContext *s)
...
@@ -2513,13 +2514,40 @@ static int rtp_read_header(AVFormatContext *s)
av_url_split
(
NULL
,
0
,
NULL
,
0
,
host
,
sizeof
(
host
),
&
port
,
av_url_split
(
NULL
,
0
,
NULL
,
0
,
host
,
sizeof
(
host
),
&
port
,
NULL
,
0
,
s
->
url
);
NULL
,
0
,
s
->
url
);
snprintf
(
sdp
,
sizeof
(
sdp
),
sdp_length
=
snprintf
(
sdp
+
sdp_length
,
sizeof
(
sdp
)
-
sdp_length
,
"v=0
\r\n
c=IN IP%d %s
\r\n
m=%s %d RTP/AVP %d
\r\n
"
,
"v=0
\r\n
c=IN IP%d %s
\r\n
"
,
addr
.
ss_family
==
AF_INET
?
4
:
6
,
host
);
p
=
strchr
(
s
->
url
,
'?'
);
if
(
p
)
{
static
const
char
*
filters
[][
2
]
=
{{
"sources"
,
"incl"
},
{
"block"
,
"excl"
},
{
NULL
,
NULL
}};
int
i
;
char
*
q
;
for
(
i
=
0
;
filters
[
i
][
0
];
i
++
)
{
if
(
av_find_info_tag
(
filters_buf
,
sizeof
(
filters_buf
),
filters
[
i
][
0
],
p
))
{
q
=
filters_buf
;
while
((
q
=
strchr
(
q
,
','
))
!=
NULL
)
*
q
=
' '
;
nc
=
snprintf
(
sdp
+
sdp_length
,
sizeof
(
sdp
)
-
sdp_length
,
"a=source-filter:%s IN IP%d %s %s
\r\n
"
,
filters
[
i
][
1
],
addr
.
ss_family
==
AF_INET
?
4
:
6
,
host
,
addr
.
ss_family
==
AF_INET
?
4
:
6
,
host
,
filters_buf
);
if
(
nc
<
0
||
nc
+
sdp_length
>=
sizeof
(
sdp
))
goto
fail_nobuf
;
sdp_length
+=
nc
;
}
}
}
nc
=
snprintf
(
sdp
+
sdp_length
,
sizeof
(
sdp
)
-
sdp_length
,
"m=%s %d RTP/AVP %d
\r\n
"
,
par
->
codec_type
==
AVMEDIA_TYPE_DATA
?
"application"
:
par
->
codec_type
==
AVMEDIA_TYPE_DATA
?
"application"
:
par
->
codec_type
==
AVMEDIA_TYPE_VIDEO
?
"video"
:
"audio"
,
par
->
codec_type
==
AVMEDIA_TYPE_VIDEO
?
"video"
:
"audio"
,
port
,
payload_type
);
port
,
payload_type
);
av_log
(
s
,
AV_LOG_VERBOSE
,
"SDP:
\n
%s
\n
"
,
sdp
);
if
(
nc
<
0
||
nc
+
sdp_length
>=
sizeof
(
sdp
))
goto
fail_nobuf
;
sdp_length
+=
nc
;
avcodec_parameters_free
(
&
par
);
avcodec_parameters_free
(
&
par
);
ffio_init_context
(
&
pb
,
sdp
,
strlen
(
sdp
),
0
,
NULL
,
NULL
,
NULL
,
NULL
);
ffio_init_context
(
&
pb
,
sdp
,
strlen
(
sdp
),
0
,
NULL
,
NULL
,
NULL
,
NULL
);
...
@@ -2534,6 +2562,9 @@ static int rtp_read_header(AVFormatContext *s)
...
@@ -2534,6 +2562,9 @@ static int rtp_read_header(AVFormatContext *s)
s
->
pb
=
NULL
;
s
->
pb
=
NULL
;
return
ret
;
return
ret
;
fail_nobuf:
ret
=
AVERROR
(
ENOBUFS
);
av_log
(
s
,
AV_LOG_ERROR
,
"rtp_read_header(): not enough buffer space for sdp-headers
\n
"
);
fail:
fail:
avcodec_parameters_free
(
&
par
);
avcodec_parameters_free
(
&
par
);
if
(
in
)
if
(
in
)
...
...
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