diff options
author | Max Kellermann <max@duempel.org> | 2008-10-24 16:56:08 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-24 16:56:08 +0200 |
commit | e7cd237674e131678aa63d149ae116204a5b1a89 (patch) | |
tree | 708e08b5ec9e7f1d1262dc9cdcbcff2528ba352e | |
parent | 0a6704420b7caace3f4eca81ca1862ea5803f6d2 (diff) | |
download | mpd-e7cd237674e131678aa63d149ae116204a5b1a89.tar.gz mpd-e7cd237674e131678aa63d149ae116204a5b1a89.tar.xz mpd-e7cd237674e131678aa63d149ae116204a5b1a89.zip |
jack: optimize local variables
Merge the variables "avail_data" and "avail_frames" into "available".
Both variables are never used at the same time.
Diffstat (limited to '')
-rw-r--r-- | src/audioOutputs/audioOutput_jack.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/audioOutputs/audioOutput_jack.c b/src/audioOutputs/audioOutput_jack.c index 8c843549f..b7d09792f 100644 --- a/src/audioOutputs/audioOutput_jack.c +++ b/src/audioOutputs/audioOutput_jack.c @@ -125,25 +125,24 @@ static int process(jack_nframes_t nframes, void *arg) { JackData *jd = (JackData *) arg; jack_default_audio_sample_t *out; - size_t avail_data, avail_frames; + size_t available; if (nframes <= 0) return 0; for (unsigned i = 0; i < 2; ++i) { - avail_data = jack_ringbuffer_read_space(jd->ringbuffer[i]); - if (avail_data > nframes * sample_size) - avail_data = nframes * sample_size; - - avail_frames = avail_data / sample_size; + available = jack_ringbuffer_read_space(jd->ringbuffer[i]); + available /= sample_size; + if (available > nframes) + available = nframes; out = jack_port_get_buffer(jd->ports[i], nframes); jack_ringbuffer_read(jd->ringbuffer[i], - (char *)out, avail_data); + (char *)out, available * sample_size); - while (avail_frames < nframes) + while (available < nframes) /* ringbuffer underrun, fill with silence */ - out[avail_frames++] = 0.0; + out[available++] = 0.0; } return 0; |