- fix crash in VPN networks + fix build for softphone clients

This commit is contained in:
2026-06-10 09:46:28 +03:00
parent c1ab8778bc
commit 2c89b80dcd
2 changed files with 25 additions and 2 deletions
+15 -1
View File
@@ -34,7 +34,21 @@ void SingleAudioStream::copyPcmTo(Audio::DataWindow& output, int needed)
// Packet by packet // Packet by packet
while (output.filled() < needed) 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; break;
} }
+10 -1
View File
@@ -163,7 +163,7 @@ void NetworkHelper::reload(int networkType)
fillUwpInterfaceList(AF_INET6, networkType, mIPList); fillUwpInterfaceList(AF_INET6, networkType, mIPList);
#else #else
// https://github.com/golang/go/issues/40569 // https://github.com/golang/go/issues/40569
struct ifaddrs* il = NULL; struct ifaddrs* il = nullptr;
if (getifaddrs(&il)) if (getifaddrs(&il))
throw Exception(GETIFADDRS_FAILED, errno); throw Exception(GETIFADDRS_FAILED, errno);
if (il) if (il)
@@ -171,6 +171,15 @@ void NetworkHelper::reload(int networkType)
struct ifaddrs* current = il; struct ifaddrs* current = il;
while (current) 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]; //char ipbuffer[64];
NetworkAddress addr; NetworkAddress addr;
addr.setPort(1000); // Set fake address to keep NetworkAddress initialized addr.setPort(1000); // Set fake address to keep NetworkAddress initialized