diff options
author | Kővágó, Zoltán <dirty.ice.hu@gmail.com> | 2019-09-19 23:24:21 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2019-09-23 12:28:47 +0200 |
commit | 857271a29c2c0e5deb05deb540a2580d1d408b34 (patch) | |
tree | 4fc6973c058119db43306e2fbedecc007396aa12 /audio/audio_int.h | |
parent | dc88e38fa7f7480becf34712eae41380b62aacc6 (diff) |
audio: common rate control code for timer based outputs
This commit removes the ad-hoc rate-limiting code from noaudio and
wavaudio, and replaces them with a (slightly modified) code from
spiceaudio. This way multiple write calls (for example when the
circular buffer wraps around) do not cause problems.
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Message-id: fd0fe5b95b13fa26d09ae77a72f99d0ea411de14.1568927990.git.DirtY.iCE.hu@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'audio/audio_int.h')
-rw-r--r-- | audio/audio_int.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/audio/audio_int.h b/audio/audio_int.h index 20021df9e8..778615ccaf 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -242,6 +242,15 @@ void *audio_calloc (const char *funcname, int nmemb, size_t size); void audio_run(AudioState *s, const char *msg); +typedef struct RateCtl { + int64_t start_ticks; + int64_t bytes_sent; +} RateCtl; + +void audio_rate_start(RateCtl *rate); +size_t audio_rate_get_bytes(struct audio_pcm_info *info, RateCtl *rate, + size_t bytes_avail); + #define VOICE_ENABLE 1 #define VOICE_DISABLE 2 #define VOICE_VOLUME 3 |