Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
0ffc325f
Commit
0ffc325f
authored
Nov 07, 2003
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* udp: mp3/rtp is now correctly working.
parent
30410626
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
23 deletions
+30
-23
modules/access/udp.c
modules/access/udp.c
+30
-23
No files found.
modules/access/udp.c
View file @
0ffc325f
...
...
@@ -2,7 +2,7 @@
* udp.c: raw UDP & RTP access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: udp.c,v 1.2
4 2003/10/23 14:30:26 jpsaman
Exp $
* $Id: udp.c,v 1.2
5 2003/11/07 18:32:55 fenrir
Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Tristan Leteurtre <tooney@via.ecp.fr>
...
...
@@ -368,17 +368,17 @@ static ssize_t Read( input_thread_t * p_input, byte_t * p_buffer, size_t i_len )
{
#ifdef WIN32
/* On win32 recv() will fail if the datagram doesn't fit inside
* the passed buffer, even though the buffer will be filled with
* the first part of the datagram. */
* the passed buffer, even though the buffer will be filled with
* the first part of the datagram. */
if
(
WSAGetLastError
()
==
WSAEMSGSIZE
)
{
msg_Err
(
p_input
,
"recv() failed. "
"Increase the mtu size (--mtu option)"
);
i_recv
=
i_len
;
}
else
{
msg_Err
(
p_input
,
"recv() failed. "
"Increase the mtu size (--mtu option)"
);
i_recv
=
i_len
;
}
else
#endif
msg_Err
(
p_input
,
"recv failed (%s)"
,
strerror
(
errno
)
);
msg_Err
(
p_input
,
"recv failed (%s)"
,
strerror
(
errno
)
);
}
return
i_recv
;
...
...
@@ -395,6 +395,7 @@ static ssize_t RTPRead( input_thread_t * p_input, byte_t * p_buffer,
int
i_rtp_version
;
int
i_CSRC_count
;
int
i_payload_type
;
int
i_skip
=
0
;
byte_t
*
p_tmp_buffer
=
alloca
(
p_input
->
i_mtu
);
...
...
@@ -414,12 +415,18 @@ static ssize_t RTPRead( input_thread_t * p_input, byte_t * p_buffer,
if
(
i_rtp_version
!=
2
)
msg_Dbg
(
p_input
,
"RTP version is %u, should be 2"
,
i_rtp_version
);
if
(
i_payload_type
!=
33
&&
i_payload_type
!=
14
&&
i_payload_type
!=
32
)
if
(
i_payload_type
==
14
)
{
i_skip
=
4
;
}
else
if
(
i_payload_type
!=
33
&&
i_payload_type
!=
32
)
{
msg_Dbg
(
p_input
,
"unsupported RTP payload type (%u)"
,
i_payload_type
);
}
i_skip
+=
RTP_HEADER_LEN
+
4
*
i_CSRC_count
;
/* A CSRC extension field is 32 bits in size (4 bytes) */
if
(
i_ret
<
(
RTP_HEADER_LEN
+
4
*
i_CSRC_count
)
)
if
(
i_ret
<
i_skip
)
{
/* Packet is not big enough to hold the complete RTP_HEADER with
* CSRC extensions.
...
...
@@ -429,7 +436,7 @@ static ssize_t RTPRead( input_thread_t * p_input, byte_t * p_buffer,
}
/* Return the packet without the RTP header. */
i_ret
-=
(
RTP_HEADER_LEN
+
4
*
i_CSRC_count
)
;
i_ret
-=
i_skip
;
if
(
(
size_t
)
i_ret
>
i_len
)
{
...
...
@@ -438,9 +445,7 @@ static ssize_t RTPRead( input_thread_t * p_input, byte_t * p_buffer,
i_ret
=
i_len
;
}
p_input
->
p_vlc
->
pf_memcpy
(
p_buffer
,
p_tmp_buffer
+
RTP_HEADER_LEN
+
4
*
i_CSRC_count
,
i_ret
);
p_input
->
p_vlc
->
pf_memcpy
(
p_buffer
,
&
p_tmp_buffer
[
i_skip
],
i_ret
);
return
i_ret
;
}
...
...
@@ -462,7 +467,7 @@ static ssize_t RTPChoose( input_thread_t * p_input, byte_t * p_buffer,
ssize_t
i_ret
=
Read
(
p_input
,
p_tmp_buffer
,
p_input
->
i_mtu
);
if
(
i_ret
<=
0
)
return
0
;
/* i_ret is at least 1 */
/* Check that it's not TS. */
if
(
p_tmp_buffer
[
0
]
==
0x47
)
{
...
...
@@ -495,6 +500,10 @@ static ssize_t RTPChoose( input_thread_t * p_input, byte_t * p_buffer,
case
14
:
msg_Dbg
(
p_input
,
"detected MPEG audio over RTP"
);
if
(
!
p_input
->
psz_demux
||
*
p_input
->
psz_demux
==
'\0'
)
{
p_input
->
psz_demux
=
"mp3"
;
}
break
;
case
32
:
...
...
@@ -511,7 +520,7 @@ static ssize_t RTPChoose( input_thread_t * p_input, byte_t * p_buffer,
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
)
)
if
(
i_ret
<
RTP_HEADER_LEN
+
4
*
i_CSRC_count
)
{
/* Packet is not big enough to hold the complete RTP_HEADER with
* CSRC extensions.
...
...
@@ -521,7 +530,7 @@ static ssize_t RTPChoose( input_thread_t * p_input, byte_t * p_buffer,
}
/* 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
)
{
...
...
@@ -530,9 +539,7 @@ static ssize_t RTPChoose( input_thread_t * p_input, byte_t * p_buffer,
i_ret
=
i_len
;
}
p_input
->
p_vlc
->
pf_memcpy
(
p_buffer
,
p_tmp_buffer
+
RTP_HEADER_LEN
+
4
*
i_CSRC_count
,
i_ret
);
p_input
->
p_vlc
->
pf_memcpy
(
p_buffer
,
&
p_tmp_buffer
[
RTP_HEADER_LEN
+
4
*
i_CSRC_count
],
i_ret
);
return
i_ret
;
}
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