- fix crash in VPN networks + fix build for softphone clients
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user