diff options
author | Max Kellermann <max@duempel.org> | 2009-03-02 09:42:16 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-03-02 09:42:16 +0100 |
commit | b7bfa24f22a3a5a7709ce425ffc84bd4bb64be08 (patch) | |
tree | 661eef7a3aa2d5d4b153d23b5703c35502bc2262 /src/player_thread.c | |
parent | 0579b6ed27a995d6c700f3684b023fb2fda7e616 (diff) | |
download | mpd-b7bfa24f22a3a5a7709ce425ffc84bd4bb64be08.tar.gz mpd-b7bfa24f22a3a5a7709ce425ffc84bd4bb64be08.tar.xz mpd-b7bfa24f22a3a5a7709ce425ffc84bd4bb64be08.zip |
pcm_volume: return bool
Don't abort MPD when a sample format is not supported by pcm_volume().
Diffstat (limited to 'src/player_thread.c')
-rw-r--r-- | src/player_thread.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/player_thread.c b/src/player_thread.c index 24942fbfd..fb3e9bf68 100644 --- a/src/player_thread.c +++ b/src/player_thread.c @@ -238,6 +238,8 @@ static bool play_chunk(struct song *song, struct music_chunk *chunk, const struct audio_format *format, double sizeToTime) { + bool success; + pc.elapsed_time = chunk->times; pc.bit_rate = chunk->bit_rate; @@ -266,8 +268,15 @@ play_chunk(struct song *song, struct music_chunk *chunk, if (chunk->length == 0) return true; - pcm_volume(chunk->data, chunk->length, - format, pc.software_volume); + success = pcm_volume(chunk->data, chunk->length, + format, pc.software_volume); + if (!success) { + g_warning("pcm_volume() failed on %u:%u:%u", + format->sample_rate, format->bits, format->channels); + pc.errored_song = dc.current_song; + pc.error = PLAYER_ERROR_AUDIO; + return false; + } if (!audio_output_all_play(chunk->data, chunk->length)) { pc.errored_song = dc.current_song; |