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
69d28e6f
Commit
69d28e6f
authored
Jul 15, 2009
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed clock handling on rate change with high caching delay.
Becareful about possible regressions.
parent
62707188
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
11 deletions
+21
-11
src/input/clock.c
src/input/clock.c
+21
-11
No files found.
src/input/clock.c
View file @
69d28e6f
...
...
@@ -163,6 +163,8 @@ struct input_clock_t
static
mtime_t
ClockStreamToSystem
(
input_clock_t
*
,
mtime_t
i_stream
);
static
mtime_t
ClockSystemToStream
(
input_clock_t
*
,
mtime_t
i_system
);
static
mtime_t
ClockGetTsOffset
(
input_clock_t
*
);
/*****************************************************************************
* input_clock_New: create a new clock
*****************************************************************************/
...
...
@@ -297,13 +299,12 @@ void input_clock_ChangeRate( input_clock_t *cl, int i_rate )
{
vlc_mutex_lock
(
&
cl
->
lock
);
/* Move the reference point */
if
(
cl
->
b_has_reference
)
{
cl
->
last
.
i_system
=
ClockStreamToSystem
(
cl
,
cl
->
last
.
i_stream
+
AvgGet
(
&
cl
->
drift
)
);
cl
->
ref
=
cl
->
last
;
/* Move the reference point (as if we were playing at the new rate
* from the start */
cl
->
ref
.
i_system
=
cl
->
last
.
i_system
-
(
cl
->
last
.
i_system
-
cl
->
ref
.
i_system
)
*
i_rate
/
cl
->
i_rate
;
}
cl
->
i_rate
=
i_rate
;
vlc_mutex_unlock
(
&
cl
->
lock
);
...
...
@@ -358,8 +359,6 @@ int input_clock_ConvertTS( input_clock_t *cl,
int
*
pi_rate
,
mtime_t
*
pi_ts0
,
mtime_t
*
pi_ts1
,
mtime_t
i_ts_bound
)
{
mtime_t
i_pts_delay
;
assert
(
pi_ts0
);
vlc_mutex_lock
(
&
cl
->
lock
);
...
...
@@ -375,28 +374,30 @@ int input_clock_ConvertTS( input_clock_t *cl,
return
VLC_EGENERIC
;
}
/* */
const
mtime_t
i_ts_delay
=
cl
->
i_pts_delay
+
ClockGetTsOffset
(
cl
);
/* */
if
(
*
pi_ts0
>
VLC_TS_INVALID
)
{
*
pi_ts0
=
ClockStreamToSystem
(
cl
,
*
pi_ts0
+
AvgGet
(
&
cl
->
drift
)
);
if
(
*
pi_ts0
>
cl
->
i_ts_max
)
cl
->
i_ts_max
=
*
pi_ts0
;
*
pi_ts0
+=
cl
->
i_p
ts_delay
;
*
pi_ts0
+=
i_
ts_delay
;
}
/* XXX we do not ipdate i_ts_max on purpose */
if
(
pi_ts1
&&
*
pi_ts1
>
VLC_TS_INVALID
)
{
*
pi_ts1
=
ClockStreamToSystem
(
cl
,
*
pi_ts1
+
AvgGet
(
&
cl
->
drift
)
)
+
cl
->
i_p
ts_delay
;
i_
ts_delay
;
}
i_pts_delay
=
cl
->
i_pts_delay
;
vlc_mutex_unlock
(
&
cl
->
lock
);
/* Check ts validity */
if
(
i_ts_bound
!=
INT64_MAX
&&
*
pi_ts0
>
VLC_TS_INVALID
&&
*
pi_ts0
>=
mdate
()
+
i_
p
ts_delay
+
i_ts_bound
)
*
pi_ts0
>
VLC_TS_INVALID
&&
*
pi_ts0
>=
mdate
()
+
i_ts_delay
+
i_ts_bound
)
return
VLC_EGENERIC
;
return
VLC_SUCCESS
;
...
...
@@ -443,7 +444,7 @@ void input_clock_ChangeSystemOrigin( input_clock_t *cl, mtime_t i_system )
vlc_mutex_lock
(
&
cl
->
lock
);
assert
(
cl
->
b_has_reference
);
const
mtime_t
i_offset
=
i_system
-
cl
->
ref
.
i_system
;
const
mtime_t
i_offset
=
i_system
-
cl
->
ref
.
i_system
-
ClockGetTsOffset
(
cl
)
;
cl
->
ref
.
i_system
+=
i_offset
;
cl
->
last
.
i_system
+=
i_offset
;
...
...
@@ -527,6 +528,15 @@ static mtime_t ClockSystemToStream( input_clock_t *cl, mtime_t i_system )
cl
->
ref
.
i_stream
;
}
/**
* It returns timestamp display offset due to ref/last modfied on rate changes
* It ensures that currently converted dates are not changed.
*/
static
mtime_t
ClockGetTsOffset
(
input_clock_t
*
cl
)
{
return
cl
->
i_pts_delay
*
(
cl
->
i_rate
-
INPUT_RATE_DEFAULT
)
/
INPUT_RATE_DEFAULT
;
}
/*****************************************************************************
* Long term average helpers
*****************************************************************************/
...
...
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