Skip to content

Commit fe998a7

Browse files
fix(playback): guard rare possible divide by 0 in stream_frame #28
Signed-off-by: Dario Pellegrino <dario.pellegrino@voismart.it>
1 parent a388aa9 commit fe998a7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

openai_audio_streamer_glue.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,10 @@ switch_bool_t write_frame(switch_core_session_t *session, switch_media_bug_t *bu
11901190
return SWITCH_TRUE;
11911191
}
11921192

1193+
if (frame->samples == 0 || frame->datalen == 0) {
1194+
return SWITCH_TRUE;
1195+
}
1196+
11931197
uint32_t bytes_needed = frame->datalen;
11941198
uint32_t bytes_per_sample = frame->datalen / frame->samples;
11951199

0 commit comments

Comments
 (0)