aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/decoder_api.c7
-rw-r--r--src/output_thread.c10
-rw-r--r--src/pcm_utils.c4
3 files changed, 16 insertions, 5 deletions
diff --git a/src/decoder_api.c b/src/decoder_api.c
index bf389222b..dd7096017 100644
--- a/src/decoder_api.c
+++ b/src/decoder_api.c
@@ -249,6 +249,13 @@ decoder_data(struct decoder *decoder,
length = pcm_convert(&dc.in_audio_format, _data,
length, &dc.out_audio_format,
data, &decoder->conv_state);
+
+ /* under certain circumstances, pcm_convert() may
+ return an empty buffer - this condition should be
+ investigated further, but for now, do this check as
+ a workaround: */
+ if (length == 0)
+ return DECODE_COMMAND_NONE;
}
if (replay_gain_info != NULL && (replay_gain_mode != REPLAY_GAIN_OFF))
diff --git a/src/output_thread.c b/src/output_thread.c
index b65a601a3..c887828bb 100644
--- a/src/output_thread.c
+++ b/src/output_thread.c
@@ -69,9 +69,17 @@ static void ao_play(struct audio_output *ao)
assert(size > 0);
- if (!audio_format_equals(&ao->inAudioFormat, &ao->outAudioFormat))
+ if (!audio_format_equals(&ao->inAudioFormat, &ao->outAudioFormat)) {
convertAudioFormat(ao, &data, &size);
+ /* under certain circumstances, pcm_convert() may
+ return an empty buffer - this condition should be
+ investigated further, but for now, do this check as
+ a workaround: */
+ if (size == 0)
+ return;
+ }
+
ret = ao->plugin->play(ao->data, data, size);
if (!ret) {
ao->plugin->cancel(ao->data);
diff --git a/src/pcm_utils.c b/src/pcm_utils.c
index 2fb5f6c3f..f73df8aef 100644
--- a/src/pcm_utils.c
+++ b/src/pcm_utils.c
@@ -379,8 +379,6 @@ pcm_convert_16(const struct audio_format *src_format,
dest_format->sample_rate,
dest_buffer, dest_size,
&state->resample);
- if (len == 0)
- exit(EXIT_FAILURE);
}
return len;
@@ -421,8 +419,6 @@ pcm_convert_24(const struct audio_format *src_format,
dest_format->sample_rate,
(int32_t*)dest_buffer, dest_size,
&state->resample);
- if (len == 0)
- exit(EXIT_FAILURE);
}
return len;