aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-12-24 23:22:45 +0100
committerMax Kellermann <max@duempel.org>2014-12-24 23:22:56 +0100
commit5a8d2e80577e1c80186dcf6a05879a9101c34639 (patch)
tree5632c96301a6d220874a4d3abdc8b1e82811d816 /src
parent687fc358fd40bc2873e7cacd6830f7512265012b (diff)
downloadmpd-5a8d2e80577e1c80186dcf6a05879a9101c34639.tar.gz
mpd-5a8d2e80577e1c80186dcf6a05879a9101c34639.tar.xz
mpd-5a8d2e80577e1c80186dcf6a05879a9101c34639.zip
output/jack: cache AudioFormat::channels
Diffstat (limited to 'src')
-rw-r--r--src/output/plugins/JackOutputPlugin.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/output/plugins/JackOutputPlugin.cxx b/src/output/plugins/JackOutputPlugin.cxx
index e4239a70b..99de03fb3 100644
--- a/src/output/plugins/JackOutputPlugin.cxx
+++ b/src/output/plugins/JackOutputPlugin.cxx
@@ -145,16 +145,18 @@ JackOutput::Process(jack_nframes_t nframes)
jack_nframes_t available = GetAvailable();
+ const unsigned n_channels = audio_format.channels;
+
if (pause) {
/* empty the ring buffers */
- for (unsigned i = 0; i < audio_format.channels; ++i)
+ for (unsigned i = 0; i < n_channels; ++i)
jack_ringbuffer_read_advance(ringbuffer[i],
available * jack_sample_size);
/* generate silence while MPD is paused */
- for (unsigned i = 0; i < audio_format.channels; ++i) {
+ for (unsigned i = 0; i < n_channels; ++i) {
jack_default_audio_sample_t *out =
(jack_default_audio_sample_t *)
jack_port_get_buffer(ports[i], nframes);
@@ -168,7 +170,7 @@ JackOutput::Process(jack_nframes_t nframes)
if (available > nframes)
available = nframes;
- for (unsigned i = 0; i < audio_format.channels; ++i) {
+ for (unsigned i = 0; i < n_channels; ++i) {
jack_default_audio_sample_t *out =
(jack_default_audio_sample_t *)
jack_port_get_buffer(ports[i], nframes);
@@ -188,7 +190,7 @@ JackOutput::Process(jack_nframes_t nframes)
/* generate silence for the unused source ports */
- for (unsigned i = audio_format.channels; i < num_source_ports; ++i) {
+ for (unsigned i = n_channels; i < num_source_ports; ++i) {
jack_default_audio_sample_t *out =
(jack_default_audio_sample_t *)
jack_port_get_buffer(ports[i], nframes);