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
090a2cce
Commit
090a2cce
authored
Jul 31, 2012
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
transcode: simplify drift calculation
Show drift value in debug log
parent
97acb225
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
16 deletions
+22
-16
modules/stream_out/transcode/audio.c
modules/stream_out/transcode/audio.c
+9
-7
modules/stream_out/transcode/video.c
modules/stream_out/transcode/video.c
+13
-9
No files found.
modules/stream_out/transcode/audio.c
View file @
090a2cce
...
...
@@ -328,17 +328,19 @@ int transcode_audio_process( sout_stream_t *p_stream,
{
if
(
p_sys
->
b_master_sync
)
{
mtime_t
i_
d
ts
=
date_Get
(
&
id
->
interpolated_pts
)
+
1
;
if
(
p_audio_buf
->
i_pts
-
i_dts
>
MASTER_SYNC_MAX_DRIFT
||
p_audio_buf
->
i_pts
-
i_dts
<
-
MASTER_SYNC_MAX_DRIFT
)
mtime_t
i_
p
ts
=
date_Get
(
&
id
->
interpolated_pts
)
+
1
;
mtime_t
i_drift
=
p_audio_buf
->
i_pts
-
i_pts
;
if
(
i_drift
>
MASTER_SYNC_MAX_DRIFT
||
i_drift
<
-
MASTER_SYNC_MAX_DRIFT
)
{
msg_Dbg
(
p_stream
,
"drift is too high, resetting master sync"
);
msg_Dbg
(
p_stream
,
"drift is too high (%"
PRId64
"), resetting master sync"
,
i_drift
);
date_Set
(
&
id
->
interpolated_pts
,
p_audio_buf
->
i_pts
);
i_
d
ts
=
p_audio_buf
->
i_pts
+
1
;
i_
p
ts
=
p_audio_buf
->
i_pts
+
1
;
}
p_sys
->
i_master_drift
=
p_audio_buf
->
i_pts
-
i_
d
ts
;
p_sys
->
i_master_drift
=
p_audio_buf
->
i_pts
-
i_
p
ts
;
date_Increment
(
&
id
->
interpolated_pts
,
p_audio_buf
->
i_nb_samples
);
p_audio_buf
->
i_pts
-=
p_sys
->
i_master_drift
;
p_audio_buf
->
i_pts
=
i_pts
;
}
p_audio_buf
->
i_dts
=
p_audio_buf
->
i_pts
;
...
...
modules/stream_out/transcode/video.c
View file @
090a2cce
...
...
@@ -601,15 +601,16 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_t *id,
if
(
p_sys
->
b_master_sync
)
{
mtime_t
i_video_drift
;
mtime_t
i_master_drift
=
p_sys
->
i_master_drift
;
mtime_t
i_pts
;
mtime_t
i_pts
=
date_Get
(
&
id
->
interpolated_pts
)
+
1
;
mtime_t
i_video_drift
=
p_pic
->
date
-
i_pts
;
i_pts
=
date_Get
(
&
id
->
interpolated_pts
)
+
1
;
if
(
unlikely
(
p_pic
->
date
-
i_pts
>
MASTER_SYNC_MAX_DRIFT
||
p_pic
->
date
-
i_pts
<
-
MASTER_SYNC_MAX_DRIFT
)
)
if
(
unlikely
(
i_video_drift
>
MASTER_SYNC_MAX_DRIFT
||
i_video_drift
<
-
MASTER_SYNC_MAX_DRIFT
)
)
{
msg_Dbg
(
p_stream
,
"drift is too high, resetting master sync"
);
msg_Dbg
(
p_stream
,
"drift is too high (%"
PRId64
", resetting master sync"
,
i_video_drift
);
date_Set
(
&
id
->
interpolated_pts
,
p_pic
->
date
);
i_pts
=
p_pic
->
date
+
1
;
}
...
...
@@ -717,10 +718,13 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_t *id,
if
(
p_sys
->
b_master_sync
)
{
mtime_t
i_pts
=
date_Get
(
&
id
->
interpolated_pts
)
+
1
;
if
(
unlikely
(
p_pic
->
date
-
i_pts
>
MASTER_SYNC_MAX_DRIFT
||
p_pic
->
date
-
i_pts
<
-
MASTER_SYNC_MAX_DRIFT
)
)
mtime_t
i_video_drift
=
p_pic
->
date
-
i_pts
;
if
(
unlikely
(
i_video_drift
>
MASTER_SYNC_MAX_DRIFT
||
i_video_drift
<
-
MASTER_SYNC_MAX_DRIFT
)
)
{
msg_Dbg
(
p_stream
,
"drift is too high, resetting master sync"
);
msg_Dbg
(
p_stream
,
"drift is too high (%"
PRId64
"), resetting master sync"
,
i_video_drift
);
date_Set
(
&
id
->
interpolated_pts
,
p_pic
->
date
);
i_pts
=
p_pic
->
date
+
1
;
}
...
...
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