From 014f8cd693a1a5b5c3b0ebeeb6b799701a5132f1 Mon Sep 17 00:00:00 2001 From: Max Kellermann <max@musicpd.org> Date: Tue, 14 Nov 2017 12:00:14 +0100 Subject: [PATCH] output/httpd: flush encoder after tag Without the flush, ReadPage() may not return any data, or not all data. This may result in incomplete ddata the new "header" page, corrupting streams with some encoders such as Vorbis. Fixes #145 --- NEWS | 1 + src/output/plugins/httpd/HttpdOutputPlugin.cxx | 1 + 2 files changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 04b7da8d4..3f70c64b8 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,7 @@ ver 0.20.12 (not yet released) - vorbis: default to quality 3 * output - fix hanging playback with soxr resampler + - httpd: flush encoder after tag; fixes corrupt Vorbis stream ver 0.20.11 (2017/10/18) * storage diff --git a/src/output/plugins/httpd/HttpdOutputPlugin.cxx b/src/output/plugins/httpd/HttpdOutputPlugin.cxx index 966669b1e..0a811b706 100644 --- a/src/output/plugins/httpd/HttpdOutputPlugin.cxx +++ b/src/output/plugins/httpd/HttpdOutputPlugin.cxx @@ -468,6 +468,7 @@ HttpdOutput::SendTag(const Tag &tag) try { encoder->SendTag(tag); + encoder->Flush(); } catch (const std::runtime_error &) { /* ignore */ }