mirror of
https://github.com/rock88/moonlight-nx
synced 2024-11-22 11:33:11 +00:00
Fix crash in AudrenAudioRenderer when sometime decode_and_play_sample call with NULL data and zero lenght
This commit is contained in:
parent
34a0ef8332
commit
fba49bf66d
1 changed files with 6 additions and 3 deletions
|
@ -124,9 +124,12 @@ void AudrenAudioRenderer::cleanup() {
|
||||||
|
|
||||||
void AudrenAudioRenderer::decode_and_play_sample(char *data, int length) {
|
void AudrenAudioRenderer::decode_and_play_sample(char *data, int length) {
|
||||||
if (m_decoder && m_decoded_buffer) {
|
if (m_decoder && m_decoded_buffer) {
|
||||||
int decoded_samples = opus_multistream_decode(m_decoder, (const unsigned char *)data, length, m_decoded_buffer, m_samples_per_frame, 0);
|
if (data != NULL && length > 0) {
|
||||||
if (decoded_samples > 0) {
|
int decoded_samples = opus_multistream_decode(m_decoder, (const unsigned char *)data, length, m_decoded_buffer, m_samples_per_frame, 0);
|
||||||
write_audio(m_decoded_buffer, decoded_samples * m_channel_count * sizeof(s16));
|
|
||||||
|
if (decoded_samples > 0) {
|
||||||
|
write_audio(m_decoded_buffer, decoded_samples * m_channel_count * sizeof(s16));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Logger::fatal("Audren", "Invalid call of decode_and_play_sample");
|
Logger::fatal("Audren", "Invalid call of decode_and_play_sample");
|
||||||
|
|
Loading…
Reference in a new issue