diff options
author | Thierry Bultel <thierry.bultel@iot.bzh> | 2018-06-26 17:28:23 +0200 |
---|---|---|
committer | Thierry Bultel <thierry.bultel@iot.bzh> | 2018-06-26 17:28:23 +0200 |
commit | 731c21e80ba45339b7dd9b8eae63accd3597d281 (patch) | |
tree | aa7d371fdf03eff93ade8f135b589edf53eef9ad /plugins/alsa/alsa-softmixer.h | |
parent | 7a02db1106cc5fab6016b05a5c13d3dc7c6f0be9 (diff) |
Rework the pcm copy loop and save a lot of CPUeel
- removed the systemd polling usage
- uses a while loop for reading
- improved the write loop, leveraging the available space
at each iteration
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
Diffstat (limited to 'plugins/alsa/alsa-softmixer.h')
-rw-r--r-- | plugins/alsa/alsa-softmixer.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/alsa/alsa-softmixer.h b/plugins/alsa/alsa-softmixer.h index 6c1519d..26c864c 100644 --- a/plugins/alsa/alsa-softmixer.h +++ b/plugins/alsa/alsa-softmixer.h @@ -22,13 +22,13 @@ #define _ALSA_SOFTMIXER_ #include <afb/afb-binding.h> -#include <systemd/sd-event.h> #include <json-c/json_object.h> #include <stdlib.h> #include <stdio.h> #include <assert.h> #include <alsa/asoundlib.h> #include <stdbool.h> +#include <systemd/sd-event.h> #include "ctl-plugin.h" #include "wrap-json.h" @@ -91,13 +91,19 @@ typedef struct { // IO Job void * buf; snd_pcm_uframes_t buf_count; /* filled samples */ - snd_pcm_uframes_t buf_size; /* buffer size in frames */ + snd_pcm_uframes_t buf_pos; /* begin of data */ + snd_pcm_uframes_t buf_size; /* buffer size in frames */ + uint32_t write_err_count; + uint32_t read_err_count; unsigned int channels; sd_event *sdLoop; pthread_t thread; int tid; char* info; + struct pollfd * pollFds; + int pcmInCount; + } AlsaPcmCopyHandleT; |