soundserver_cubeb: Verify buffer is not null.

This commit is contained in:
joevt 2024-05-04 22:57:39 -07:00 committed by dingusdev
parent 900e58f0ad
commit 86d8ae0911

View File

@ -118,19 +118,22 @@ long sound_out_callback(cubeb_stream *stream, void *user_data,
while (req_frames > 0) {
if (!dma_ch->pull_data((uint32_t)req_frames << 2, &got_len, &p_in)) {
frames = got_len >> 2;
if ((in_buf = (int16_t*)p_in)) {
frames = got_len >> 2;
in_buf = (int16_t*)p_in;
for (int i = (int)frames; i > 0; i--) {
out_buf[0] = BYTESWAP_16(in_buf[0]);
out_buf[1] = BYTESWAP_16(in_buf[1]);
in_buf += 2;
out_buf += 2;
}
for (int i = (int)frames; i > 0; i--) {
out_buf[0] = BYTESWAP_16(in_buf[0]);
out_buf[1] = BYTESWAP_16(in_buf[1]);
in_buf += 2;
out_buf += 2;
req_frames -= frames;
out_frames += frames;
}
else {
LOG_F(ERROR, "Didn't get qdata");
}
req_frames -= frames;
out_frames += frames;
}
else {
break;