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
e2c71160
Commit
e2c71160
authored
Sep 23, 2008
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
System clock is given to input_ClockSetPCR.
No functionnal change yet.
parent
987d3a85
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
17 deletions
+21
-17
src/input/clock.c
src/input/clock.c
+17
-14
src/input/es_out.c
src/input/es_out.c
+3
-2
src/input/input_internal.h
src/input/input_internal.h
+1
-1
No files found.
src/input/clock.c
View file @
e2c71160
...
...
@@ -144,19 +144,22 @@ void input_ClockInit( input_clock_t *cl, bool b_master, int i_cr_average, int i_
/*****************************************************************************
* input_ClockSetPCR: manages a clock reference
*
* i_ck_stream: date in stream clock
* i_ck_system: date in system clock
*****************************************************************************/
void
input_ClockSetPCR
(
input_thread_t
*
p_input
,
input_clock_t
*
cl
,
mtime_t
i_clock
)
input_clock_t
*
cl
,
mtime_t
i_ck_stream
,
mtime_t
i_ck_system
)
{
const
bool
b_synchronize
=
p_input
->
b_can_pace_control
&&
cl
->
b_master
;
const
mtime_t
i_mdate
=
mdate
();
if
(
(
cl
->
i_synchro_state
!=
SYNCHRO_OK
)
||
(
i_c
lock
==
0
&&
cl
->
last_cr
!=
0
)
)
(
i_c
k_stream
==
0
&&
cl
->
last_cr
!=
0
)
)
{
/* Feed synchro with a new reference point. */
ClockNewRef
(
cl
,
i_c
lock
,
__MAX
(
cl
->
last_pts
+
CR_MEAN_PTS_GAP
,
i_
mdate
)
);
ClockNewRef
(
cl
,
i_c
k_stream
,
__MAX
(
cl
->
last_pts
+
CR_MEAN_PTS_GAP
,
i_
ck_system
)
);
cl
->
i_synchro_state
=
SYNCHRO_OK
;
if
(
!
b_synchronize
)
...
...
@@ -167,8 +170,8 @@ void input_ClockSetPCR( input_thread_t *p_input,
}
}
else
if
(
cl
->
last_cr
!=
0
&&
(
(
cl
->
last_cr
-
i_c
lock
)
>
CR_MAX_GAP
||
(
cl
->
last_cr
-
i_c
lock
)
<
-
CR_MAX_GAP
)
)
(
(
cl
->
last_cr
-
i_c
k_stream
)
>
CR_MAX_GAP
||
(
cl
->
last_cr
-
i_c
k_stream
)
<
-
CR_MAX_GAP
)
)
{
/* Stream discontinuity, for which we haven't received a
* warning from the stream control facilities (dd-edited
...
...
@@ -177,27 +180,27 @@ void input_ClockSetPCR( input_thread_t *p_input,
input_ClockInit
(
cl
,
cl
->
b_master
,
cl
->
i_cr_average
,
cl
->
i_rate
);
/* Feed synchro with a new reference point. */
msg_Warn
(
p_input
,
"feeding synchro with a new reference point trying to recover from clock gap"
);
ClockNewRef
(
cl
,
i_c
lock
,
__MAX
(
cl
->
last_pts
+
CR_MEAN_PTS_GAP
,
i_
mdate
)
);
ClockNewRef
(
cl
,
i_c
k_stream
,
__MAX
(
cl
->
last_pts
+
CR_MEAN_PTS_GAP
,
i_
ck_system
)
);
cl
->
i_synchro_state
=
SYNCHRO_OK
;
}
cl
->
last_cr
=
i_c
lock
;
cl
->
last_sysdate
=
i_
mdate
;
cl
->
last_cr
=
i_c
k_stream
;
cl
->
last_sysdate
=
i_
ck_system
;
if
(
!
b_synchronize
&&
i_
mdate
-
cl
->
last_update
>
200000
)
if
(
!
b_synchronize
&&
i_
ck_system
-
cl
->
last_update
>
200000
)
{
/* Smooth clock reference variations. */
const
mtime_t
i_extrapoled_clock
=
ClockCurrent
(
cl
);
/* Bresenham algorithm to smooth variations. */
const
mtime_t
i_tmp
=
cl
->
delta_cr
*
(
cl
->
i_cr_average
-
1
)
+
(
i_extrapoled_clock
-
i_c
lock
)
*
1
+
(
i_extrapoled_clock
-
i_c
k_stream
)
*
1
+
cl
->
i_delta_cr_residue
;
cl
->
i_delta_cr_residue
=
i_tmp
%
cl
->
i_cr_average
;
cl
->
delta_cr
=
i_tmp
/
cl
->
i_cr_average
;
cl
->
last_update
=
i_
mdate
;
cl
->
last_update
=
i_
ck_system
;
}
}
...
...
src/input/es_out.c
View file @
e2c71160
...
...
@@ -1900,8 +1900,9 @@ static int EsOutControl( es_out_t *out, int i_query, va_list args )
p_pgrm
=
EsOutProgramAdd
(
out
,
i_group
);
/* Create it */
i_pcr
=
(
int64_t
)
va_arg
(
args
,
int64_t
);
/* search program */
input_ClockSetPCR
(
p_sys
->
p_input
,
&
p_pgrm
->
clock
,
i_pcr
);
/* search program
* TODO do not use mdate() but proper stream acquisition date */
input_ClockSetPCR
(
p_sys
->
p_input
,
&
p_pgrm
->
clock
,
i_pcr
,
mdate
()
);
return
VLC_SUCCESS
;
}
...
...
src/input/input_internal.h
View file @
e2c71160
...
...
@@ -377,7 +377,7 @@ typedef struct
}
input_clock_t
;
void
input_ClockInit
(
input_clock_t
*
,
bool
b_master
,
int
i_cr_average
,
int
i_rate
);
void
input_ClockSetPCR
(
input_thread_t
*
,
input_clock_t
*
,
mtime_t
);
void
input_ClockSetPCR
(
input_thread_t
*
,
input_clock_t
*
,
mtime_t
i_clock
,
mtime_t
i_system
);
void
input_ClockResetPCR
(
input_clock_t
*
);
mtime_t
input_ClockGetTS
(
input_thread_t
*
,
input_clock_t
*
,
mtime_t
);
void
input_ClockSetRate
(
input_clock_t
*
cl
,
int
i_rate
);
...
...
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