From 084efebb2a12bb64cac752106f495299a7fdfa2c Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Tue, 4 Jul 2023 10:57:01 +0200 Subject: [PATCH] hlsdemux2: Ensure processed webvtt ends with empty new line Parsers downstream will use empty new lines to detect where an entry ends. Failure to have a newline would cause the entry to be either discarded or (wrongly) concatenated with the next entry Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2752 Part-of: --- .../gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-util.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-util.c b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-util.c index 704786a..626f2e2 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-util.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-util.c @@ -944,6 +944,10 @@ gst_hlsdemux_handle_content_webvtt (GstHLSDemux * demux, out: if (ret) { gchar *newfile; + + /* Ensure file always ends with an empty newline by adding an empty + * line. This helps downstream parsers properly detect entries */ + g_ptr_array_add (builder, g_strdup ("\n")); /* Add NULL-terminator to string list */ g_ptr_array_add (builder, NULL); newfile = g_strjoinv ("\n", (gchar **) builder->pdata); -- 2.7.4