From 33efec51f4a0bee0070f82c01a5fb1409f7c18cd Mon Sep 17 00:00:00 2001 From: Alexandre Janniaux Date: Thu, 1 Jul 2021 09:41:43 +0200 Subject: [PATCH] imem-access: add option to change pts-delay Application using imem access cannot define whether they provide live content, file content, or camera content, thus buffering is always badly defined for those case. In addition, the pts delay was always the same so it was also badly configured most of the time. A dedicated option allows the application writer to configure the necessary pts delay for their use case. --- modules/access/imem-access.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/access/imem-access.c b/modules/access/imem-access.c index ab1461773d1..46b3c10d47a 100644 --- a/modules/access/imem-access.c +++ b/modules/access/imem-access.c @@ -97,8 +97,14 @@ static int Control(stream_t *access, int query, va_list args) break; case STREAM_GET_PTS_DELAY: - *va_arg(args, vlc_tick_t *) = DEFAULT_PTS_DELAY; + { + vlc_tick_t delay = VLC_TICK_FROM_MS( + var_InheritInteger(access, "imem-pts-delay")); + if (delay < 0) + delay = DEFAULT_PTS_DELAY; + *va_arg(args, vlc_tick_t *) = delay; break; + } case STREAM_SET_PAUSE_STATE: break; @@ -164,6 +170,8 @@ static void Close(vlc_object_t *object) sys->close_cb(sys->opaque); } +#define IMEM_PTS_DELAY_TEXT "PTS delay in milliseconds" +#define IMEM_PTS_DELAY_LONGTEXT "Delay of presentation timestamp used in buffering, in milliseconds" vlc_module_begin() set_shortname(N_("Memory stream")) set_description(N_("In-memory stream input")) @@ -172,4 +180,8 @@ vlc_module_begin() add_shortcut("imem") set_capability("access", 0) set_callbacks(Open, Close) + + add_integer("imem-pts-delay", DEFAULT_PTS_DELAY, + IMEM_PTS_DELAY_TEXT, IMEM_PTS_DELAY_LONGTEXT) + change_volatile() vlc_module_end() -- GitLab