Date: Tue, 25 Feb 2025 11:48:20 GMT From: Christos Margiolis <christos@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 40616b7e41ff - main - sound: Return if the new speed/format is the same as the current one Message-ID: <202502251148.51PBmKTC051065@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=40616b7e41ff96b6d7522445b00f27f26d593a85 commit 40616b7e41ff96b6d7522445b00f27f26d593a85 Author: Christos Margiolis <christos@FreeBSD.org> AuthorDate: 2025-02-25 11:44:12 +0000 Commit: Christos Margiolis <christos@FreeBSD.org> CommitDate: 2025-02-25 11:44:12 +0000 sound: Return if the new speed/format is the same as the current one This gives us a slight performance boost since we do not have to go through chn_setparam() and the driver functions. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: dev_submerge.ch, emaste Differential Revision: https://reviews.freebsd.org/D48012 --- sys/dev/sound/pcm/channel.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 19b2db321cee..c3ee50d51c4b 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -2110,6 +2110,9 @@ chn_setspeed(struct pcm_channel *c, uint32_t speed) oldformat = c->format; oldspeed = c->speed; + if (c->speed == speed) + return (0); + ret = chn_setparam(c, c->format, speed); if (ret != 0) { if (snd_verbose > 3) @@ -2138,6 +2141,9 @@ chn_setformat(struct pcm_channel *c, uint32_t format) oldformat = c->format; oldspeed = c->speed; + if (c->format == format) + return (0); + ret = chn_setparam(c, format, c->speed); if (ret != 0) { if (snd_verbose > 3)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502251148.51PBmKTC051065>