aboutsummaryrefslogtreecommitdiffstats
path: root/src/pipe.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-13 02:06:58 +0100
committerMax Kellermann <max@duempel.org>2008-11-13 02:06:58 +0100
commit66ce1495f07cd065346cdc2067b034e142a0fa96 (patch)
treeec22214c5fa70395b38310c0722db97b9f0c362c /src/pipe.c
parent998d9a822535e3cb88801487e95acef296cae9a3 (diff)
downloadmpd-66ce1495f07cd065346cdc2067b034e142a0fa96.tar.gz
mpd-66ce1495f07cd065346cdc2067b034e142a0fa96.tar.xz
mpd-66ce1495f07cd065346cdc2067b034e142a0fa96.zip
music_pipe: continuously check the sample format of all chunks
Provide a debug function which asserts on the sample format of all chunks. Call this function in each iteration of the player main loop.
Diffstat (limited to 'src/pipe.c')
-rw-r--r--src/pipe.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/pipe.c b/src/pipe.c
index c3551265e..7afbefcb1 100644
--- a/src/pipe.c
+++ b/src/pipe.c
@@ -300,3 +300,21 @@ void music_pipe_skip(unsigned num)
while (music_pipe.begin != (unsigned)i)
music_pipe_shift();
}
+
+#ifndef NDEBUG
+void music_pipe_check_format(const struct audio_format *current,
+ int next_index, const struct audio_format *next)
+{
+ const struct audio_format *audio_format = current;
+
+ for (unsigned i = music_pipe.begin; i != music_pipe.end;
+ i = successor(i)) {
+ const struct music_chunk *chunk = music_pipe_get_chunk(i);
+
+ if (next_index > 0 && i == (unsigned)next_index)
+ audio_format = next;
+
+ assert(chunk->length % audio_format_frame_size(audio_format) == 0);
+ }
+}
+#endif