Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
10b303ec
Commit
10b303ec
authored
Oct 23, 2003
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reviewed file:
- fixed border cases with peeking in the packet.
parent
876e2bb5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
7 deletions
+30
-7
modules/access/udp.c
modules/access/udp.c
+30
-7
No files found.
modules/access/udp.c
View file @
10b303ec
...
@@ -2,11 +2,13 @@
...
@@ -2,11 +2,13 @@
* udp.c: raw UDP & RTP access plug-in
* udp.c: raw UDP & RTP access plug-in
*****************************************************************************
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* Copyright (C) 2001, 2002 VideoLAN
* $Id: udp.c,v 1.2
3 2003/10/22 17:12:30 gbazi
n Exp $
* $Id: udp.c,v 1.2
4 2003/10/23 14:30:26 jpsama
n Exp $
*
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Tristan Leteurtre <tooney@via.ecp.fr>
* Tristan Leteurtre <tooney@via.ecp.fr>
*
*
* Reviewed: 23 October 2003, Jean-Paul Saman <jpsaman@wxs.nl>
*
* This program is free software; you can redistribute it and/or modify
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation; either version 2 of the License, or
...
@@ -339,9 +341,9 @@ static ssize_t Read( input_thread_t * p_input, byte_t * p_buffer, size_t i_len )
...
@@ -339,9 +341,9 @@ static ssize_t Read( input_thread_t * p_input, byte_t * p_buffer, size_t i_len )
timeout
.
tv_usec
=
500000
;
timeout
.
tv_usec
=
500000
;
/* Find if some data is available */
/* Find if some data is available */
while
(
(
i_ret
=
select
(
p_access_data
->
i_handle
+
1
,
&
fds
,
while
(
(
(
i_ret
=
select
(
p_access_data
->
i_handle
+
1
,
&
fds
,
NULL
,
NULL
,
&
timeout
))
==
0
NULL
,
NULL
,
&
timeout
))
==
0
)
||
(
i_ret
<
0
&&
errno
==
EINTR
)
)
||
(
(
i_ret
<
0
)
&&
(
errno
==
EINTR
)
)
)
{
{
FD_ZERO
(
&
fds
);
FD_ZERO
(
&
fds
);
FD_SET
(
p_access_data
->
i_handle
,
&
fds
);
FD_SET
(
p_access_data
->
i_handle
,
&
fds
);
...
@@ -400,7 +402,7 @@ static ssize_t RTPRead( input_thread_t * p_input, byte_t * p_buffer,
...
@@ -400,7 +402,7 @@ static ssize_t RTPRead( input_thread_t * p_input, byte_t * p_buffer,
* We first assume that RTP header size is the classic RTP_HEADER_LEN. */
* We first assume that RTP header size is the classic RTP_HEADER_LEN. */
ssize_t
i_ret
=
Read
(
p_input
,
p_tmp_buffer
,
p_input
->
i_mtu
);
ssize_t
i_ret
=
Read
(
p_input
,
p_tmp_buffer
,
p_input
->
i_mtu
);
if
(
i_ret
<
0
)
return
0
;
if
(
i_ret
<
=
0
)
return
0
;
/* i_ret is at least 1 */
/* Parse the header and make some verifications.
/* Parse the header and make some verifications.
* See RFC 1889 & RFC 2250. */
* See RFC 1889 & RFC 2250. */
...
@@ -416,6 +418,16 @@ static ssize_t RTPRead( input_thread_t * p_input, byte_t * p_buffer,
...
@@ -416,6 +418,16 @@ static ssize_t RTPRead( input_thread_t * p_input, byte_t * p_buffer,
&&
i_payload_type
!=
32
)
&&
i_payload_type
!=
32
)
msg_Dbg
(
p_input
,
"unsupported RTP payload type (%u)"
,
i_payload_type
);
msg_Dbg
(
p_input
,
"unsupported RTP payload type (%u)"
,
i_payload_type
);
/* A CSRC extension field is 32 bits in size (4 bytes) */
if
(
i_ret
<
(
RTP_HEADER_LEN
+
4
*
i_CSRC_count
)
)
{
/* Packet is not big enough to hold the complete RTP_HEADER with
* CSRC extensions.
*/
msg_Warn
(
p_input
,
"RTP input trashing %d bytes"
,
i_ret
-
i_len
);
return
0
;
}
/* Return the packet without the RTP header. */
/* Return the packet without the RTP header. */
i_ret
-=
(
RTP_HEADER_LEN
+
4
*
i_CSRC_count
);
i_ret
-=
(
RTP_HEADER_LEN
+
4
*
i_CSRC_count
);
...
@@ -449,7 +461,7 @@ static ssize_t RTPChoose( input_thread_t * p_input, byte_t * p_buffer,
...
@@ -449,7 +461,7 @@ static ssize_t RTPChoose( input_thread_t * p_input, byte_t * p_buffer,
* We first assume that RTP header size is the classic RTP_HEADER_LEN. */
* We first assume that RTP header size is the classic RTP_HEADER_LEN. */
ssize_t
i_ret
=
Read
(
p_input
,
p_tmp_buffer
,
p_input
->
i_mtu
);
ssize_t
i_ret
=
Read
(
p_input
,
p_tmp_buffer
,
p_input
->
i_mtu
);
if
(
i_ret
<
0
)
return
0
;
if
(
i_ret
<
=
0
)
return
0
;
/* i_ret is at least 1 */
/* Check that it's not TS. */
/* Check that it's not TS. */
if
(
p_tmp_buffer
[
0
]
==
0x47
)
if
(
p_tmp_buffer
[
0
]
==
0x47
)
...
@@ -496,8 +508,19 @@ static ssize_t RTPChoose( input_thread_t * p_input, byte_t * p_buffer,
...
@@ -496,8 +508,19 @@ static ssize_t RTPChoose( input_thread_t * p_input, byte_t * p_buffer,
return
i_ret
;
return
i_ret
;
}
}
/* Return the packet without the RTP header. */
p_input
->
pf_read
=
RTPRead
;
p_input
->
pf_read
=
RTPRead
;
/* A CSRC extension field is 32 bits in size (4 bytes) */
if
(
i_ret
<
(
RTP_HEADER_LEN
+
4
*
i_CSRC_count
)
)
{
/* Packet is not big enough to hold the complete RTP_HEADER with
* CSRC extensions.
*/
msg_Warn
(
p_input
,
"RTP input trashing %d bytes"
,
i_ret
-
i_len
);
return
0
;
}
/* Return the packet without the RTP header. */
i_ret
-=
(
RTP_HEADER_LEN
+
4
*
i_CSRC_count
);
i_ret
-=
(
RTP_HEADER_LEN
+
4
*
i_CSRC_count
);
if
(
(
size_t
)
i_ret
>
i_len
)
if
(
(
size_t
)
i_ret
>
i_len
)
...
...
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