From 009f30b4dfb92e23bdb7140507964face471a414 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Thu, 23 Apr 2020 19:36:00 +0200 Subject: [PATCH] bug fix: if small network buffers are used we get much better audio quality when drop outs occur --- ChangeLog | 4 ++-- src/client.cpp | 4 ++++ src/client.h | 4 ++-- src/server.cpp | 4 ++++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index bae35ce7..7d2ab394 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,8 @@ * added bodhran instrument icon, created by bomm (Ticket #131) + * bug fix: if small network buffers are used we get much better audio quality when drop outs occur + * bug fix: if names given with the -o option were too long, the server registration failed (Ticket #91) * bug fix: audio level changes if Buffer Delay is changed (Ticket #106) @@ -28,8 +30,6 @@ TODO support internationalization TODO sometimes I cannot see the central server in the server list -TODO improve audio drop out behaviour with OPUS64 by tuning the coding rate (it seems that for some coding rates we get loud artifacts on audio drop outs whereas for slightly different rates the behavior is much more pleasent), maybe test with OPUS complexity settings, quality settings, etc to improve PLC - TODO try to find a way to catch Windows exceptions in case a 64 bit Jamulus tries to load a 32 bit Jack Audio ASIO dll diff --git a/src/client.cpp b/src/client.cpp index fee96619..86e26cf8 100755 --- a/src/client.cpp +++ b/src/client.cpp @@ -104,6 +104,10 @@ CClient::CClient ( const quint16 iPortNumber, opus_custom_encoder_ctl ( Opus64EncoderMono, OPUS_SET_VBR ( 0 ) ); opus_custom_encoder_ctl ( Opus64EncoderStereo, OPUS_SET_VBR ( 0 ) ); + // for 64 samples frame size we have to adjust the PLC behavior to avoid loud artifacts + opus_custom_encoder_ctl ( Opus64EncoderMono, OPUS_SET_PACKET_LOSS_PERC ( 35 ) ); + opus_custom_encoder_ctl ( Opus64EncoderStereo, OPUS_SET_PACKET_LOSS_PERC ( 35 ) ); + // we want as low delay as possible opus_custom_encoder_ctl ( OpusEncoderMono, OPUS_SET_APPLICATION ( OPUS_APPLICATION_RESTRICTED_LOWDELAY ) ); opus_custom_encoder_ctl ( OpusEncoderStereo, OPUS_SET_APPLICATION ( OPUS_APPLICATION_RESTRICTED_LOWDELAY ) ); diff --git a/src/client.h b/src/client.h index f3dda0ec..bcea8094 100755 --- a/src/client.h +++ b/src/client.h @@ -85,14 +85,14 @@ // N: number of bytes per packet (values below) #define OPUS_NUM_BYTES_MONO_LOW_QUALITY 12 #define OPUS_NUM_BYTES_MONO_NORMAL_QUALITY 22 -#define OPUS_NUM_BYTES_MONO_HIGH_QUALITY 35 +#define OPUS_NUM_BYTES_MONO_HIGH_QUALITY 36 #define OPUS_NUM_BYTES_MONO_LOW_QUALITY_DBLE_FRAMESIZE 25 #define OPUS_NUM_BYTES_MONO_NORMAL_QUALITY_DBLE_FRAMESIZE 45 #define OPUS_NUM_BYTES_MONO_HIGH_QUALITY_DBLE_FRAMESIZE 71 #define OPUS_NUM_BYTES_STEREO_LOW_QUALITY 24 #define OPUS_NUM_BYTES_STEREO_NORMAL_QUALITY 35 -#define OPUS_NUM_BYTES_STEREO_HIGH_QUALITY 72 +#define OPUS_NUM_BYTES_STEREO_HIGH_QUALITY 73 #define OPUS_NUM_BYTES_STEREO_LOW_QUALITY_DBLE_FRAMESIZE 47 #define OPUS_NUM_BYTES_STEREO_NORMAL_QUALITY_DBLE_FRAMESIZE 71 #define OPUS_NUM_BYTES_STEREO_HIGH_QUALITY_DBLE_FRAMESIZE 142 diff --git a/src/server.cpp b/src/server.cpp index 7d794815..d3658c0c 100755 --- a/src/server.cpp +++ b/src/server.cpp @@ -286,6 +286,10 @@ CServer::CServer ( const int iNewMaxNumChan, opus_custom_encoder_ctl ( Opus64EncoderMono[i], OPUS_SET_VBR ( 0 ) ); opus_custom_encoder_ctl ( Opus64EncoderStereo[i], OPUS_SET_VBR ( 0 ) ); + // for 64 samples frame size we have to adjust the PLC behavior to avoid loud artifacts + opus_custom_encoder_ctl ( Opus64EncoderMono[i], OPUS_SET_PACKET_LOSS_PERC ( 35 ) ); + opus_custom_encoder_ctl ( Opus64EncoderStereo[i], OPUS_SET_PACKET_LOSS_PERC ( 35 ) ); + // we want as low delay as possible opus_custom_encoder_ctl ( OpusEncoderMono[i], OPUS_SET_APPLICATION ( OPUS_APPLICATION_RESTRICTED_LOWDELAY ) ); opus_custom_encoder_ctl ( OpusEncoderStereo[i], OPUS_SET_APPLICATION ( OPUS_APPLICATION_RESTRICTED_LOWDELAY ) );