Commit 93d4bf96 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

ALSA: measure time from start (refs #7400)

parent c21bc6b1
...@@ -128,6 +128,7 @@ struct demux_sys_t ...@@ -128,6 +128,7 @@ struct demux_sys_t
es_out_id_t *es; es_out_id_t *es;
vlc_thread_t thread; vlc_thread_t thread;
mtime_t start;
mtime_t caching; mtime_t caching;
snd_pcm_uframes_t period_size; snd_pcm_uframes_t period_size;
unsigned rate; unsigned rate;
...@@ -224,7 +225,7 @@ static int Control (demux_t *demux, int query, va_list ap) ...@@ -224,7 +225,7 @@ static int Control (demux_t *demux, int query, va_list ap)
switch (query) switch (query)
{ {
case DEMUX_GET_TIME: case DEMUX_GET_TIME:
*va_arg (ap, int64_t *) = mdate(); *va_arg (ap, int64_t *) = mdate () - sys->start;
break; break;
case DEMUX_GET_PTS_DELAY: case DEMUX_GET_PTS_DELAY:
...@@ -442,6 +443,7 @@ static int Open (vlc_object_t *obj) ...@@ -442,6 +443,7 @@ static int Open (vlc_object_t *obj)
fmt.audio.i_rate = param; fmt.audio.i_rate = param;
sys->rate = param; sys->rate = param;
sys->start = mdate ();
sys->caching = INT64_C(1000) * var_InheritInteger (demux, "live-caching"); sys->caching = INT64_C(1000) * var_InheritInteger (demux, "live-caching");
param = sys->caching; param = sys->caching;
val = snd_pcm_hw_params_set_buffer_time_near (pcm, hw, &param, NULL); val = snd_pcm_hw_params_set_buffer_time_near (pcm, hw, &param, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment