[vlc-commits] XCB screen: set true PTS instead of synthetic one
Rémi Denis-Courmont
git at videolan.org
Thu Oct 18 18:01:35 CEST 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Oct 18 18:56:02 2012 +0300| [9b3b6803540d975ced2e477ad2fce36b26eb78d0] | committer: Rémi Denis-Courmont
XCB screen: set true PTS instead of synthetic one
This should account for long term drift better, especially when
synchronizing with audio or video capture.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9b3b6803540d975ced2e477ad2fce36b26eb78d0
---
modules/access/screen/xcb.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/modules/access/screen/xcb.c b/modules/access/screen/xcb.c
index c31d380..eb5bd35 100644
--- a/modules/access/screen/xcb.c
+++ b/modules/access/screen/xcb.c
@@ -101,7 +101,6 @@ struct demux_sys_t
/* All owned by timer thread while timer is armed: */
xcb_connection_t *conn;
es_out_id_t *es;
- mtime_t pts, interval;
float rate;
xcb_window_t window;
xcb_pixmap_t pixmap;
@@ -209,17 +208,17 @@ static int Open (vlc_object_t *obj)
p_sys->rate = var_InheritFloat (obj, "screen-fps");
if (!p_sys->rate)
goto error;
- p_sys->interval = (float)CLOCK_FREQ / p_sys->rate;
- if (!p_sys->interval)
+
+ mtime_t interval = (float)CLOCK_FREQ / p_sys->rate;
+ if (!interval)
goto error;
p_sys->cur_w = 0;
p_sys->cur_h = 0;
p_sys->es = NULL;
- p_sys->pts = VLC_TS_INVALID;
if (vlc_timer_create (&p_sys->timer, Demux, demux))
goto error;
- vlc_timer_schedule (p_sys->timer, false, 1, p_sys->interval);
+ vlc_timer_schedule (p_sys->timer, false, 1, interval);
/* Initializes demux */
demux->pf_demux = NULL;
@@ -422,13 +421,10 @@ discard:
/* Send block - zero copy */
if (sys->es != NULL)
{
- if (sys->pts == VLC_TS_INVALID)
- sys->pts = mdate ();
- block->i_pts = block->i_dts = sys->pts;
+ block->i_pts = block->i_dts = mdate ();
- es_out_Control (demux->out, ES_OUT_SET_PCR, sys->pts);
+ es_out_Control (demux->out, ES_OUT_SET_PCR, block->i_pts);
es_out_Send (demux->out, sys->es, block);
- sys->pts += sys->interval;
}
}
More information about the vlc-commits
mailing list