New upstream version 2.4.1+ds
authorIOhannes m zmölnig (Debian/GNU) <umlaeute@debian.org>
Thu, 17 Oct 2024 17:33:36 +0000 (19:33 +0200)
committerIOhannes m zmölnig (Debian/GNU) <umlaeute@debian.org>
Thu, 17 Oct 2024 17:33:36 +0000 (19:33 +0200)
docs/changelog.yml
src/Regulator.cpp
src/UdpDataProtocol.cpp
src/jacktrip_globals.h
win/meson.build

index 105c4298ef2ff924aadea62a0e8c2daf9b8a4295..811e2ec4ce79da1ace38ea27befc60bf4d9b336a 100644 (file)
@@ -1,3 +1,9 @@
+- Version: "2.4.1"
+  Date: 2024-09-27
+  Description:
+  - (fixed) Disabling qWave Quality of Service for Windows users
+  - (fixed) PLC occasional popping sound when you first connect
+  - (fixed) PLC auto headroom optimization for very low jitter
 - Version: "2.4.0"
   Date: 2024-09-13
   Description:
index f847a0dad68e0947e83f529c6096b883516975d9..cbf06d733456665cc97205729ea4e95d60203c76 100644 (file)
@@ -479,8 +479,18 @@ void Regulator::updateTolerance(int glitches, int skipped)
         // only increase headroom if doing so would have reduced the number of
         // glitches that occured over the past second by 1% or more.
         // prevent headroom from growing beyond rolling average of max.
-        const int skipsAllowed =
-            static_cast<int>(AutoHeadroomGlitchTolerance * mSampleRate / mPeerFPP);
+        int skipsAllowed;
+        if (mMsecTolerance >= (mPeerFPPdurMsec * 2)) {
+            // calculate skips allowed if tolerance if above or equal to duration of two
+            // packets
+            skipsAllowed =
+                static_cast<int>(AutoHeadroomGlitchTolerance * mSampleRate / mPeerFPP);
+        } else {
+            // zero skips allowed if tolerance is below duration of two packets
+            skipsAllowed = 0;
+            // also don't require two intervals in a row (override)
+            mSkipAutoHeadroom = false;
+        }
         if (glitches > 0 && skipped > skipsAllowed
             && mCurrentHeadroom + 1 <= pushStat->longTermMax) {
             if (mSkipAutoHeadroom) {
@@ -494,8 +504,8 @@ void Regulator::updateTolerance(int glitches, int skipped)
                      << " (max=" << pushStat->longTermMax << ")" << endl;
             }
         } else {
-            // require 2 seconds in a row if headroom >= two packet intervals
-            mSkipAutoHeadroom = mMsecTolerance >= (mPeerFPPdurMsec * 2);
+            // thresholds not met: require 2 intervals in a row
+            mSkipAutoHeadroom = true;
         }
     } else {
         // fixed headroom
@@ -541,7 +551,16 @@ void Regulator::updatePushStats(int seq_num)
         mLastSkipped            = totalSkipped;
         if (mAuto && pushStat->lastTime > AutoInitDur) {
             // after AutoInitDur: update auto tolerance once per second
-            updateTolerance(newGlitches, newSkipped);
+            if (pushStat->lastTime <= (AutoInitDur + 3000)) {
+                // Ignore glitches and skips for the first 3 seconds after
+                // we have switched from using the startup tolerance to
+                // a calculated tolerance. Otherwise, the switch can
+                // sometimes cause it to bump headroom prematurely even
+                // though there are no real audio glitches.
+                updateTolerance(0, 0);
+            } else {
+                updateTolerance(newGlitches, newSkipped);
+            }
         }
     }
 }
@@ -565,7 +584,11 @@ bool Regulator::pullPacket()
     const int lastSeqNumIn = mLastSeqNumIn.load(std::memory_order_acquire);
     int skipped            = 0;
 
-    if ((lastSeqNumIn == -1) || (!mInitialized)) {
+    if ((lastSeqNumIn == -1) || (!mInitialized) || (now < mMsecTolerance)) {
+        // return silence during startup:
+        // * no packets arrived yet
+        // * not initialized
+        // * hasn't run long enough to meet tolerance
         goto ZERO_OUTPUT;
     } else if (lastSeqNumIn == mLastSeqNumOut) {
         goto UNDERRUN;
index 9ae870980a8155b19448d005bf7033e337a37a92..cc499a920243b9210e5bf3c5f5437dc3c23f701a 100644 (file)
@@ -294,7 +294,7 @@ socket_type UdpDataProtocol::bindSocket()
     ::setsockopt(sock_fd, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one));
 #endif
 
-    // set qos for windows after flow is established (requires peer address/port)
+    // set quality of service for the UDP socket
     if (setSocketQos(sock_fd)) {
         std::cout << "Set QoS for network socket" << std::endl;
     } else {
@@ -324,6 +324,9 @@ bool UdpDataProtocol::setSocketQos(socket_type& sock_fd)
     // https://learn.microsoft.com/en-us/windows/win32/api/_qos/
     // https://learn.microsoft.com/en-us/previous-versions/windows/desktop/qos/qwave-api-reference
 
+#if 0
+    // DISABLED SINCE THIS CAUSES GARBLED AUDIO FOR SOME PEOPLE
+
     // Initialize the QoS version parameter.
     QOS_VERSION Version;
     Version.MajorVersion = 1;
@@ -354,6 +357,8 @@ bool UdpDataProtocol::setSocketQos(socket_type& sock_fd)
         std::cerr << WSAGetLastError() << std::endl;
         return false;
     }
+#endif
+
 #elif defined(__APPLE__)
     // set service type "Interactive Voice"
     // TODO: this is supposed to be the right thing to do on OSX, but doesn't seem to do
index e61162a94de5a74e6a2a6978c2763dd0d9d8f33c..daeed1637344806c9e6c8cd20f5f8b5edd53cb05 100644 (file)
@@ -40,7 +40,7 @@
 
 #include "AudioInterface.h"
 
-constexpr const char* const gVersion = "2.4.0";  ///< JackTrip version
+constexpr const char* const gVersion = "2.4.1";  ///< JackTrip version
 
 //*******************************************************************************
 /// \name Default Values
index b7ed4d4c553619ea76a54558427f5a79b91290ad..7362bba79c2522273d3835a409f4121826a2939b 100644 (file)
@@ -31,7 +31,6 @@ if host_machine.system() == 'windows'
                link_args += 'Winhttp.lib'
                link_args += 'Dnsapi.lib'
                link_args += 'Iphlpapi.lib'
-               link_args += 'Qwave.lib'
        endif
 
 endif