From edc2fb1524d1e7feca96d4c403c16dd0710d6c03 Mon Sep 17 00:00:00 2001 From: Christian Spielberger Date: Fri, 9 Aug 2024 14:28:50 +0200 Subject: [PATCH] aufile: fixes for prm->duration (#3102) In order to retrieve the duration a read handler or setting ptime is not needed. --- modules/aufile/aufile_src.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/aufile/aufile_src.c b/modules/aufile/aufile_src.c index 1794c6b4f4..5df5981764 100644 --- a/modules/aufile/aufile_src.c +++ b/modules/aufile/aufile_src.c @@ -197,7 +197,7 @@ int aufile_src_alloc(struct ausrc_st **stp, const struct ausrc *as, struct aufile_prm fprm; int err; - if (!stp || !as || !prm || !prm->ptime) + if (!stp || !as || !prm) return EINVAL; if (prm->fmt != AUFMT_S16LE) { @@ -216,6 +216,8 @@ int aufile_src_alloc(struct ausrc_st **stp, const struct ausrc *as, st->errh = errh; st->arg = arg; st->ptime = prm->ptime; + if (!st->ptime) + st->ptime = 20; err = aufile_open(&st->aufile, &fprm, dev, AUFILE_READ); if (err) { @@ -231,10 +233,8 @@ int aufile_src_alloc(struct ausrc_st **stp, const struct ausrc *as, prm->ch = fprm.channels; prm->duration = aufile_get_length(st->aufile, &fprm); - if (!rh) { - mem_deref(st); - return 0; - } + if (!rh) + goto out; st->prm = *prm;