diff options
author | Max Kellermann <max@duempel.org> | 2008-11-02 20:16:56 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-11-02 20:16:56 +0100 |
commit | 79d70f124d1116cf5c3a39b64a63a9dd81c224c1 (patch) | |
tree | b03421352820f13523e774517979624952826847 /src | |
parent | cc164cc88402bef67b9c12f93fb223450834cc2d (diff) | |
download | mpd-79d70f124d1116cf5c3a39b64a63a9dd81c224c1.tar.gz mpd-79d70f124d1116cf5c3a39b64a63a9dd81c224c1.tar.xz mpd-79d70f124d1116cf5c3a39b64a63a9dd81c224c1.zip |
output: don't allow length==0
Nobody should call playAudio() with an empty chunk. Add some
assertions on that.
Diffstat (limited to 'src')
-rw-r--r-- | src/audio.c | 1 | ||||
-rw-r--r-- | src/output_control.c | 2 | ||||
-rw-r--r-- | src/output_thread.c | 2 |
3 files changed, 5 insertions, 0 deletions
diff --git a/src/audio.c b/src/audio.c index 953b1a54e..5fb8ab0b9 100644 --- a/src/audio.c +++ b/src/audio.c @@ -228,6 +228,7 @@ bool playAudio(const char *buffer, size_t length) bool ret = false; unsigned int i; + assert(length > 0); /* no partial frames allowed */ assert((length % audio_format_frame_size(&input_audio_format)) == 0); diff --git a/src/output_control.c b/src/output_control.c index f6ff6347a..10ad0df51 100644 --- a/src/output_control.c +++ b/src/output_control.c @@ -107,6 +107,8 @@ audio_output_signal(struct audio_output *ao) void audio_output_play(struct audio_output *audioOutput, const char *playChunk, size_t size) { + assert(size > 0); + if (!audioOutput->open) return; diff --git a/src/output_thread.c b/src/output_thread.c index 4209f2266..45acdd55f 100644 --- a/src/output_thread.c +++ b/src/output_thread.c @@ -65,6 +65,8 @@ static void ao_play(struct audio_output *ao) size_t size = ao->args.play.size; bool ret; + assert(size > 0); + if (!audio_format_equals(&ao->inAudioFormat, &ao->outAudioFormat)) convertAudioFormat(ao, &data, &size); |