diff --git a/doc/plugins.rst b/doc/plugins.rst index 5216a9b4d..6eeaad735 100644 --- a/doc/plugins.rst +++ b/doc/plugins.rst @@ -994,6 +994,13 @@ It is highly recommended to configure a fixed format, because a stream cannot sw - Binds the HTTP server to the specified port. * - **bind_to_address ADDR** - Binds the HTTP server to the specified address (IPv4, IPv6 or local socket). Multiple addresses in parallel are not supported. + * - **dscp_class CLASS** + - Sets a DSCP (`Differentiated Services Code Point + `__) + class for outgoing traffic. This can either be a name + (``CS*``, ``LE``, ``AF*``, ``EF``) or numeric (decimal or + hexadecimal). A reasonable choice for this setting is ``CS3`` + ("broadcast video"). * - **encoder NAME** - Chooses an encoder plugin. A list of encoder plugins can be found in the encoder plugin reference :ref:`encoder_plugins`. * - **max_clients MC** diff --git a/src/output/plugins/httpd/HttpdOutputPlugin.cxx b/src/output/plugins/httpd/HttpdOutputPlugin.cxx index e8d2d04f0..de58286ca 100644 --- a/src/output/plugins/httpd/HttpdOutputPlugin.cxx +++ b/src/output/plugins/httpd/HttpdOutputPlugin.cxx @@ -28,11 +28,13 @@ #include "Page.hxx" #include "IcyMetaDataServer.hxx" #include "event/Call.hxx" +#include "net/DscpParser.hxx" #include "util/Domain.hxx" #include "util/DeleteDisposer.hxx" #include "config/Net.hxx" #include +#include #include @@ -49,6 +51,15 @@ HttpdOutput::HttpdOutput(EventLoop &_loop, const ConfigBlock &block) website(block.GetBlockValue("website", "Set website in config")), clients_max(block.GetBlockValue("max_clients", 0U)) { + if (const auto *p = block.GetBlockParam("dscp_class")) + p->With([this](const char *s){ + const int value = ParseDscpClass(s); + if (value < 0) + throw std::runtime_error("Not a valid DSCP class"); + + ServerSocket::SetDscpClass(value); + }); + /* set up bind_to_address */ ServerSocketAddGeneric(*this, block.GetBlockValue("bind_to_address"), block.GetBlockValue("port", 8000U));