Update UDP output buffer to 1024 bytes to account for versions of nc that only support

1024 byte buffers max.
This commit is contained in:
Ed Lafargue 2024-04-18 08:30:44 -07:00
parent 1c9d12f48e
commit 173805155e
2 changed files with 6 additions and 13 deletions

View File

@ -12,7 +12,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
else()
add_subdirectory(osxaudio)
endif()
add_definitions(-DGQRX_OS_MACX)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
if(${LINUX_AUDIO_BACKEND} MATCHES "Pulseaudio")
add_subdirectory(pulseaudio)

View File

@ -59,13 +59,11 @@ udp_sink_f::udp_sink_f()
d_f2s = gr::blocks::float_to_short::make(1, 32767);
#if GNURADIO_VERSION < 0x031000
#ifdef GQRX_OS_MACX
// There seems to be excessive packet loss (even to localhost) on OS X
// unless the buffer size is limited.
d_sink = gr::blocks::udp_sink::make(sizeof(short), "localhost", 7355, 512);
#else
d_sink = gr::blocks::udp_sink::make(sizeof(short), "localhost", 7355);
#endif
// nc is used widely for receiving UDP streams and some versions of nc,
// notably on MacOS, use a 1024 byte buffer so we need to make sure we
// don't send packets that are larger than that, otherwise data will be
// lost.
d_sink = gr::blocks::udp_sink::make(sizeof(short), "localhost", 7355, 1024);
d_sink->disconnect();
#endif
@ -96,11 +94,7 @@ void udp_sink_f::start_streaming(const std::string host, int port, bool stereo)
std::cout << (stereo ? "Stereo" : "Mono") << std::endl;
#if GNURADIO_VERSION >= 0x031000
#ifdef GQRX_OS_MACX
d_sink = gr::network::udp_sink::make(sizeof(short), 1, host, port, HEADERTYPE_NONE, 512, true);
#else
d_sink = gr::network::udp_sink::make(sizeof(short), 1, host, port, HEADERTYPE_NONE, 1448, true);
#endif
d_sink = gr::network::udp_sink::make(sizeof(short), 1, host, port, HEADERTYPE_NONE, 1024, true);
#endif
if (stereo)