aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-12-24 23:00:46 +0100
committerMax Kellermann <max@duempel.org>2014-12-24 23:00:46 +0100
commitcec2a837cf7c3f3e2bf5e53c9c88992cb0d0e5e7 (patch)
tree986854ba8c606dbdb8b3ab84e17fc14215ade220 /src
parentcff47262dab4fdf9af2e034037ed8923796972e4 (diff)
downloadmpd-cec2a837cf7c3f3e2bf5e53c9c88992cb0d0e5e7.tar.gz
mpd-cec2a837cf7c3f3e2bf5e53c9c88992cb0d0e5e7.tar.xz
mpd-cec2a837cf7c3f3e2bf5e53c9c88992cb0d0e5e7.zip
output/jack: WriteSamples() returns size_t
Diffstat (limited to 'src')
-rw-r--r--src/output/plugins/JackOutputPlugin.cxx15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/output/plugins/JackOutputPlugin.cxx b/src/output/plugins/JackOutputPlugin.cxx
index acfd1ae0e..e104c3cb4 100644
--- a/src/output/plugins/JackOutputPlugin.cxx
+++ b/src/output/plugins/JackOutputPlugin.cxx
@@ -111,7 +111,11 @@ struct JackOutput {
void Process(jack_nframes_t nframes);
- void WriteSamples(const void *src, size_t n_frames);
+ /**
+ * @return the number of frames that were written
+ */
+ size_t WriteSamples(const void *src, size_t n_frames);
+
size_t Play(const void *chunk, size_t size, Error &error);
};
@@ -636,9 +640,11 @@ mpd_jack_delay(AudioOutput *ao)
: 0;
}
-inline void
+inline size_t
JackOutput::WriteSamples(const void *_src, size_t n_frames)
{
+ const size_t result = n_frames;
+
const float *src = (const float *)_src;
while (n_frames-- > 0) {
@@ -648,6 +654,8 @@ JackOutput::WriteSamples(const void *_src, size_t n_frames)
sizeof(*src));
}
}
+
+ return result;
}
inline size_t
@@ -689,8 +697,7 @@ JackOutput::Play(const void *chunk, size_t size, Error &error)
if (space < size)
size = space;
- WriteSamples(chunk, size);
- return size * frame_size;
+ return WriteSamples(chunk, size) * frame_size;
}
static size_t