Skip to content

Commit

Permalink
codal_port/modaudio: Stop streaming audio when data is exhausted.
Browse files Browse the repository at this point in the history
Signed-off-by: Damien George <[email protected]>
  • Loading branch information
dpgeorge committed Aug 7, 2024
1 parent c7c7485 commit 6c520d9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/codal_port/modaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,13 @@ static void audio_data_fetcher(mp_sched_node_t *node) {

if (audio_source_frame == NULL) {
// Audio source is exhausted.
// Fill any remaining audio_output_buffer bytes with silence.

if (audio_output_buffer_offset == 0) {
// No output data left, finish output streaming.
return;
}

// Fill remaining audio_output_buffer bytes with silence, for the final output frame.
memset(dest, 128, AUDIO_OUTPUT_BUFFER_SIZE - audio_output_buffer_offset);
audio_output_buffer_offset = AUDIO_OUTPUT_BUFFER_SIZE;
} else {
Expand Down

0 comments on commit 6c520d9

Please sign in to comment.