output: don't allow length==0
Nobody should call playAudio() with an empty chunk. Add some assertions on that.
This commit is contained in:
parent
cc164cc884
commit
79d70f124d
@ -228,6 +228,7 @@ bool playAudio(const char *buffer, size_t length)
|
|||||||
bool ret = false;
|
bool ret = false;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
assert(length > 0);
|
||||||
/* no partial frames allowed */
|
/* no partial frames allowed */
|
||||||
assert((length % audio_format_frame_size(&input_audio_format)) == 0);
|
assert((length % audio_format_frame_size(&input_audio_format)) == 0);
|
||||||
|
|
||||||
|
@ -107,6 +107,8 @@ audio_output_signal(struct audio_output *ao)
|
|||||||
void audio_output_play(struct audio_output *audioOutput,
|
void audio_output_play(struct audio_output *audioOutput,
|
||||||
const char *playChunk, size_t size)
|
const char *playChunk, size_t size)
|
||||||
{
|
{
|
||||||
|
assert(size > 0);
|
||||||
|
|
||||||
if (!audioOutput->open)
|
if (!audioOutput->open)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -65,6 +65,8 @@ static void ao_play(struct audio_output *ao)
|
|||||||
size_t size = ao->args.play.size;
|
size_t size = ao->args.play.size;
|
||||||
bool ret;
|
bool ret;
|
||||||
|
|
||||||
|
assert(size > 0);
|
||||||
|
|
||||||
if (!audio_format_equals(&ao->inAudioFormat, &ao->outAudioFormat))
|
if (!audio_format_equals(&ao->inAudioFormat, &ao->outAudioFormat))
|
||||||
convertAudioFormat(ao, &data, &size);
|
convertAudioFormat(ao, &data, &size);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user