From 2c89b80dcd630507d06c25b13c80f830a54a1c76 Mon Sep 17 00:00:00 2001 From: Dmytro Bogovych Date: Wed, 10 Jun 2026 09:46:28 +0300 Subject: [PATCH] - fix crash in VPN networks + fix build for softphone clients --- src/engine/media/MT_SingleAudioStream.cpp | 16 +++++++++++++++- src/libs/ice/ICENetworkHelper.cpp | 11 ++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/engine/media/MT_SingleAudioStream.cpp b/src/engine/media/MT_SingleAudioStream.cpp index 0ed17385..e01c5c2d 100644 --- a/src/engine/media/MT_SingleAudioStream.cpp +++ b/src/engine/media/MT_SingleAudioStream.cpp @@ -34,7 +34,21 @@ void SingleAudioStream::copyPcmTo(Audio::DataWindow& output, int needed) // Packet by packet while (output.filled() < needed) { - if (mReceiver.getAudioTo(output, {}).mStatus != AudioReceiver::DecodeResult::Status::Ok) + // Number of bytes to fill on this step + auto requested = needed - output.filled(); + + auto options = AudioReceiver::DecodeOptions{ + .mRealtimeProcessing = true, + .mResampleToMainRate = true, + .mSkipDecode = false, + .mElapsed = std::chrono::milliseconds(requested / (AUDIO_SAMPLERATE / 1000)) + }; + + // Try to get the data from receiver / decoder + if (options.mElapsed != 0ms) { + if (mReceiver.getAudioTo(output, options).mStatus != AudioReceiver::DecodeResult::Status::Ok) + break; + } else break; } diff --git a/src/libs/ice/ICENetworkHelper.cpp b/src/libs/ice/ICENetworkHelper.cpp index 7599efb3..b8b67f48 100644 --- a/src/libs/ice/ICENetworkHelper.cpp +++ b/src/libs/ice/ICENetworkHelper.cpp @@ -163,7 +163,7 @@ void NetworkHelper::reload(int networkType) fillUwpInterfaceList(AF_INET6, networkType, mIPList); #else // https://github.com/golang/go/issues/40569 - struct ifaddrs* il = NULL; + struct ifaddrs* il = nullptr; if (getifaddrs(&il)) throw Exception(GETIFADDRS_FAILED, errno); if (il) @@ -171,6 +171,15 @@ void NetworkHelper::reload(int networkType) struct ifaddrs* current = il; while (current) { + // getifaddrs() may return entries with a null ifa_addr (interfaces with + // no assigned address, point-to-point/tunnel interfaces, link-layer + // entries, ...). Dereferencing it would crash, so skip such entries. + if (current->ifa_addr == nullptr) + { + current = current->ifa_next; + continue; + } + //char ipbuffer[64]; NetworkAddress addr; addr.setPort(1000); // Set fake address to keep NetworkAddress initialized