Skip to content

Commit 6c520d9

Browse files
committed
codal_port/modaudio: Stop streaming audio when data is exhausted.
Signed-off-by: Damien George <[email protected]>
1 parent c7c7485 commit 6c520d9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/codal_port/modaudio.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,13 @@ static void audio_data_fetcher(mp_sched_node_t *node) {
124124

125125
if (audio_source_frame == NULL) {
126126
// Audio source is exhausted.
127-
// Fill any remaining audio_output_buffer bytes with silence.
127+
128+
if (audio_output_buffer_offset == 0) {
129+
// No output data left, finish output streaming.
130+
return;
131+
}
132+
133+
// Fill remaining audio_output_buffer bytes with silence, for the final output frame.
128134
memset(dest, 128, AUDIO_OUTPUT_BUFFER_SIZE - audio_output_buffer_offset);
129135
audio_output_buffer_offset = AUDIO_OUTPUT_BUFFER_SIZE;
130136
} else {

0 commit comments

Comments
 (0)