调整alsa参数减小音频延时

This commit is contained in:
张兆鹏 2025-05-13 11:12:24 +08:00
parent 11ea0a9c7f
commit 29bcccd5c9
3 changed files with 7 additions and 6 deletions

View File

@ -22,8 +22,8 @@
static char aioDebugfsPath[256] = {0};
static unsigned int updateCnt = 0;
#define PERIOD_SIZE (1024)
#define PERIOD_COUNT (8)
#define PERIOD_SIZE (256)
#define PERIOD_COUNT (4)
#define UPDATE_AIO_DEBUGFS_INFO(update_flag, item_flag, item, type, buf, path) \
do { \
if (update_flag & item_flag) { \
@ -388,6 +388,7 @@ int alsaSetPcmParams(PCM_CONFIG_S *pcmCfg)
snd_pcm_uframes_t periodSize = PERIOD_SIZE;
snd_pcm_uframes_t prePeriodSize = periodSize;
// alogd("size:%d count:%d\n", PERIOD_SIZE, PERIOD_COUNT);
err = snd_pcm_hw_params_set_period_size_near(pcmCfg->handle, params, &periodSize, &dir);
if (err < 0) {
aloge("set_period_size_near error!");

View File

@ -118,7 +118,7 @@ pcm.PlaybackRateDmix {
}
@args.PERIODSIZE {
type integer
default 960 #1024
default 256 #1024
}
type plug
slave.pcm {
@ -135,7 +135,7 @@ pcm.PlaybackRateDmix {
rate $SAMPLERATE
channels $CHNNUM
period_size $PERIODSIZE
periods 8
periods 4
}
}
hooks.0 {

View File

@ -118,7 +118,7 @@ pcm.PlaybackRateDmix {
}
@args.PERIODSIZE {
type integer
default 960 #1024
default 256 #1024
}
type plug
slave.pcm {
@ -135,7 +135,7 @@ pcm.PlaybackRateDmix {
rate $SAMPLERATE
channels $CHNNUM
period_size $PERIODSIZE
periods 8
periods 4
}
}
hooks.0 {