Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
aad5f30a
Commit
aad5f30a
authored
Sep 28, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RTP: use the right frequency for jitter computation
parent
08b2e648
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
25 deletions
+41
-25
modules/demux/rtpsession.c
modules/demux/rtpsession.c
+41
-25
No files found.
modules/demux/rtpsession.c
View file @
aad5f30a
...
@@ -192,6 +192,10 @@ rtp_source_destroy (demux_t *demux, const rtp_session_t *session,
...
@@ -192,6 +192,10 @@ rtp_source_destroy (demux_t *demux, const rtp_session_t *session,
free
(
source
);
free
(
source
);
}
}
static
inline
uint8_t
rtp_ptype
(
const
block_t
*
block
)
{
return
block
->
p_buffer
[
1
]
&
0x7F
;
}
static
inline
uint16_t
rtp_seq
(
const
block_t
*
block
)
static
inline
uint16_t
rtp_seq
(
const
block_t
*
block
)
{
{
...
@@ -205,6 +209,24 @@ static inline uint32_t rtp_timestamp (const block_t *block)
...
@@ -205,6 +209,24 @@ static inline uint32_t rtp_timestamp (const block_t *block)
return
GetDWBE
(
block
->
p_buffer
+
4
);
return
GetDWBE
(
block
->
p_buffer
+
4
);
}
}
static
const
struct
rtp_pt_t
*
rtp_find_ptype
(
const
rtp_session_t
*
session
,
rtp_source_t
*
source
,
const
block_t
*
block
,
void
**
pt_data
)
{
uint8_t
ptype
=
rtp_ptype
(
block
);
for
(
unsigned
i
=
0
;
i
<
session
->
ptc
;
i
++
)
{
if
(
session
->
ptv
[
i
].
number
==
ptype
)
{
if
(
pt_data
!=
NULL
)
*
pt_data
=
source
->
opaque
[
i
];
return
&
session
->
ptv
[
i
];
}
}
return
NULL
;
}
/**
/**
* Receives an RTP packet and queues it.
* Receives an RTP packet and queues it.
* @param demux VLC demux object
* @param demux VLC demux object
...
@@ -278,17 +300,22 @@ rtp_receive (demux_t *demux, rtp_session_t *session, block_t *block)
...
@@ -278,17 +300,22 @@ rtp_receive (demux_t *demux, rtp_session_t *session, block_t *block)
tab
[
session
->
srcc
++
]
=
src
;
tab
[
session
->
srcc
++
]
=
src
;
/* Cannot compute jitter yet */
/* Cannot compute jitter yet */
}
}
else
if
(
session
->
ptc
>
0
)
else
{
{
/* Recompute jitter estimate. That is computed from the RTP timestamps
const
rtp_pt_t
*
pt
=
rtp_find_ptype
(
session
,
src
,
block
,
NULL
);
* and the system clock. It is independent of RTP sequence. */
/* FIXME: payload types have the same frequency? */
if
(
pt
!=
NULL
)
uint32_t
freq
=
session
->
ptv
[
0
].
frequency
;
{
uint32_t
ts
=
rtp_timestamp
(
block
);
/* Recompute jitter estimate.
int64_t
d
=
((
now
-
src
->
last_rx
)
*
freq
)
/
CLOCK_FREQ
;
* That is computed from the RTP timestamps and the system clock.
d
-=
ts
-
src
->
last_ts
;
* It is independent of RTP sequence. */
if
(
d
<
0
)
d
=
-
d
;
uint32_t
freq
=
pt
->
frequency
;
src
->
jitter
+=
((
d
-
src
->
jitter
)
+
8
)
>>
4
;
uint32_t
ts
=
rtp_timestamp
(
block
);
int64_t
d
=
((
now
-
src
->
last_rx
)
*
freq
)
/
CLOCK_FREQ
;
d
-=
ts
-
src
->
last_ts
;
if
(
d
<
0
)
d
=
-
d
;
src
->
jitter
+=
((
d
-
src
->
jitter
)
+
8
)
>>
4
;
}
}
}
src
->
last_rx
=
now
;
src
->
last_rx
=
now
;
src
->
last_ts
=
rtp_timestamp
(
block
);
src
->
last_ts
=
rtp_timestamp
(
block
);
...
@@ -367,23 +394,12 @@ rtp_decode (demux_t *demux, const rtp_session_t *session, rtp_source_t *src)
...
@@ -367,23 +394,12 @@ rtp_decode (demux_t *demux, const rtp_session_t *session, rtp_source_t *src)
src
->
last_seq
=
rtp_seq
(
block
);
src
->
last_seq
=
rtp_seq
(
block
);
/* Match the payload type */
/* Match the payload type */
const
rtp_pt_t
*
pt
=
NULL
;
void
*
pt_data
;
void
*
pt_data
=
NULL
;
const
rtp_pt_t
*
pt
=
rtp_find_ptype
(
session
,
src
,
block
,
&
pt_data
);
const
uint8_t
ptype
=
block
->
p_buffer
[
1
]
&
0x7F
;
for
(
unsigned
i
=
0
;
i
<
session
->
ptc
;
i
++
)
{
if
(
session
->
ptv
[
i
].
number
==
ptype
)
{
pt
=
&
session
->
ptv
[
i
];
pt_data
=
src
->
opaque
[
i
];
break
;
}
}
if
(
pt
==
NULL
)
if
(
pt
==
NULL
)
{
{
msg_Dbg
(
demux
,
"ignoring unknown payload (%"
PRIu8
")"
,
ptype
);
msg_Dbg
(
demux
,
"ignoring unknown payload (%"
PRIu8
")"
,
rtp_ptype
(
block
));
goto
drop
;
goto
drop
;
}
}
...
...
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