Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
fad7f0d5
Commit
fad7f0d5
authored
Oct 31, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RTP: reorder for better readability
parent
e570b837
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
72 deletions
+80
-72
modules/access/rtp/session.c
modules/access/rtp/session.c
+80
-72
No files found.
modules/access/rtp/session.c
View file @
fad7f0d5
...
...
@@ -376,80 +376,13 @@ drop:
}
static
void
rtp_decode
(
demux_t
*
demux
,
const
rtp_session_t
*
session
,
rtp_source_t
*
src
)
{
block_t
*
block
=
src
->
blocks
;
assert
(
block
);
src
->
blocks
=
block
->
p_next
;
block
->
p_next
=
NULL
;
/* Discontinuity detection */
uint16_t
delta_seq
=
rtp_seq
(
block
)
-
(
src
->
last_seq
+
1
);
if
(
delta_seq
!=
0
)
{
if
(
delta_seq
>=
0x8000
)
{
/* Trash too late packets (and PIM Assert duplicates) */
msg_Dbg
(
demux
,
"ignoring late packet (sequence: %"
PRIu16
")"
,
rtp_seq
(
block
));
goto
drop
;
}
msg_Warn
(
demux
,
"%"
PRIu16
" packet(s) lost"
,
delta_seq
);
block
->
i_flags
|=
BLOCK_FLAG_DISCONTINUITY
;
}
src
->
last_seq
=
rtp_seq
(
block
);
/* Match the payload type */
void
*
pt_data
;
const
rtp_pt_t
*
pt
=
rtp_find_ptype
(
session
,
src
,
block
,
&
pt_data
);
if
(
pt
==
NULL
)
{
msg_Dbg
(
demux
,
"unknown payload (%"
PRIu8
")"
,
rtp_ptype
(
block
));
goto
drop
;
}
/* Computes the PTS from the RTP timestamp and payload RTP frequency.
* DTS is unknown. Also, while the clock frequency depends on the payload
* format, a single source MUST only use payloads of a chosen frequency.
* Otherwise it would be impossible to compute consistent timestamps. */
const
uint32_t
timestamp
=
rtp_timestamp
(
block
);
block
->
i_pts
=
src
->
ref_ntp
+
CLOCK_FREQ
*
(
int32_t
)(
timestamp
-
src
->
ref_rtp
)
/
pt
->
frequency
;
/* TODO: proper inter-medias/sessions sync (using RTCP-SR) */
src
->
ref_ntp
=
block
->
i_pts
;
src
->
ref_rtp
=
timestamp
;
/* CSRC count */
size_t
skip
=
12u
+
(
block
->
p_buffer
[
0
]
&
0x0F
)
*
4
;
/* Extension header (ignored for now) */
if
(
block
->
p_buffer
[
0
]
&
0x10
)
{
skip
+=
4
;
if
(
block
->
i_buffer
<
skip
)
goto
drop
;
skip
+=
4
*
GetWBE
(
block
->
p_buffer
+
skip
-
2
);
}
if
(
block
->
i_buffer
<
skip
)
goto
drop
;
block
->
p_buffer
+=
skip
;
block
->
i_buffer
-=
skip
;
pt
->
decode
(
demux
,
pt_data
,
block
);
return
;
drop:
block_Release
(
block
);
}
static
void
rtp_decode
(
demux_t
*
,
const
rtp_session_t
*
,
rtp_source_t
*
);
/**
* Dequeues an RTP packet and pass it to decoder. Not cancellation-safe(?).
* Dequeues RTP packets and pass them to decoder. Not cancellation-safe(?).
* A packet is decoded if it is the next in sequence order, or if we have
* given up waiting on the missing packets (time out) from the last one
* already decoded.
*
* @param demux VLC demux object
* @param session RTP session receiving the packet
...
...
@@ -527,3 +460,78 @@ bool rtp_dequeue (demux_t *demux, const rtp_session_t *session,
}
return
pending
;
}
/**
* Decodes one RTP packet.
*/
static
void
rtp_decode
(
demux_t
*
demux
,
const
rtp_session_t
*
session
,
rtp_source_t
*
src
)
{
block_t
*
block
=
src
->
blocks
;
assert
(
block
);
src
->
blocks
=
block
->
p_next
;
block
->
p_next
=
NULL
;
/* Discontinuity detection */
uint16_t
delta_seq
=
rtp_seq
(
block
)
-
(
src
->
last_seq
+
1
);
if
(
delta_seq
!=
0
)
{
if
(
delta_seq
>=
0x8000
)
{
/* Trash too late packets (and PIM Assert duplicates) */
msg_Dbg
(
demux
,
"ignoring late packet (sequence: %"
PRIu16
")"
,
rtp_seq
(
block
));
goto
drop
;
}
msg_Warn
(
demux
,
"%"
PRIu16
" packet(s) lost"
,
delta_seq
);
block
->
i_flags
|=
BLOCK_FLAG_DISCONTINUITY
;
}
src
->
last_seq
=
rtp_seq
(
block
);
/* Match the payload type */
void
*
pt_data
;
const
rtp_pt_t
*
pt
=
rtp_find_ptype
(
session
,
src
,
block
,
&
pt_data
);
if
(
pt
==
NULL
)
{
msg_Dbg
(
demux
,
"unknown payload (%"
PRIu8
")"
,
rtp_ptype
(
block
));
goto
drop
;
}
/* Computes the PTS from the RTP timestamp and payload RTP frequency.
* DTS is unknown. Also, while the clock frequency depends on the payload
* format, a single source MUST only use payloads of a chosen frequency.
* Otherwise it would be impossible to compute consistent timestamps. */
const
uint32_t
timestamp
=
rtp_timestamp
(
block
);
block
->
i_pts
=
src
->
ref_ntp
+
CLOCK_FREQ
*
(
int32_t
)(
timestamp
-
src
->
ref_rtp
)
/
pt
->
frequency
;
/* TODO: proper inter-medias/sessions sync (using RTCP-SR) */
src
->
ref_ntp
=
block
->
i_pts
;
src
->
ref_rtp
=
timestamp
;
/* CSRC count */
size_t
skip
=
12u
+
(
block
->
p_buffer
[
0
]
&
0x0F
)
*
4
;
/* Extension header (ignored for now) */
if
(
block
->
p_buffer
[
0
]
&
0x10
)
{
skip
+=
4
;
if
(
block
->
i_buffer
<
skip
)
goto
drop
;
skip
+=
4
*
GetWBE
(
block
->
p_buffer
+
skip
-
2
);
}
if
(
block
->
i_buffer
<
skip
)
goto
drop
;
block
->
p_buffer
+=
skip
;
block
->
i_buffer
-=
skip
;
pt
->
decode
(
demux
,
pt_data
,
block
);
return
;
drop:
block_Release
(
block
);
}
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