diff options
author | René Stadler <mail@renestadler.de> | 2009-10-02 23:51:29 +0300 |
---|---|---|
committer | René Stadler <mail@renestadler.de> | 2009-10-06 20:54:20 +0300 |
commit | 15c6175044d1a308eb463347cd8d4c88b53ecb35 (patch) | |
tree | 89d960394f4a13c4134c45172be5c2ec9bd325bf /ext/pulse/pulsesrc.c | |
parent | 86b8935b07b989a7c08aaa04a153dbfb8a76c167 (diff) |
pulsesrc: guard fragment size with a lower limit based on latency-time
In case that the pulse daemon runs the source device at a relatively low fixed
fragment size compared to the requested latency-time, configure the ring buffer
segsize to the largest integer multiple of the fragment size that is still
smaller than or equal to the requested latency-time.
Fixes bug #597463.
Diffstat (limited to 'ext/pulse/pulsesrc.c')
-rw-r--r-- | ext/pulse/pulsesrc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/pulse/pulsesrc.c b/ext/pulse/pulsesrc.c index 1da79366..d53acf8e 100644 --- a/ext/pulse/pulsesrc.c +++ b/ext/pulse/pulsesrc.c @@ -1014,8 +1014,11 @@ gst_pulsesrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec) GST_INFO_OBJECT (pulsesrc, "fragsize: %d (wanted %d)", actual->fragsize, wanted.fragsize); - /* adjust latency again */ - spec->segsize = actual->fragsize; + if (actual->fragsize >= wanted.fragsize) { + spec->segsize = actual->fragsize; + } else { + spec->segsize = actual->fragsize * (wanted.fragsize / actual->fragsize); + } spec->segtotal = actual->maxlength / spec->segsize; pa_threaded_mainloop_unlock (pulsesrc->mainloop); |