From e2d112639145b8a1e2a9611667d106b13d270f7e Mon Sep 17 00:00:00 2001 From: Florin Apostol Date: Mon, 29 Jun 2015 22:18:38 +0100 Subject: [PATCH] dashdemux: corrected recognition of $$$ in segment templates fixed recognition of $$ after a $ that ends an identifier, eg $Time$$$ https://bugzilla.gnome.org/show_bug.cgi?id=751682 --- ext/dash/gstmpdparser.c | 2 ++ tests/check/elements/dash_mpd.c | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/ext/dash/gstmpdparser.c b/ext/dash/gstmpdparser.c index 03fd66c278..38bb24e589 100644 --- a/ext/dash/gstmpdparser.c +++ b/ext/dash/gstmpdparser.c @@ -2681,6 +2681,8 @@ gst_mpdparser_build_URL_from_template (const gchar * url_template, tokens[i] = g_strdup_printf ("%s", "$"); g_free (token); last_token_par = TRUE; + } else { + last_token_par = FALSE; } } else { last_token_par = FALSE; diff --git a/tests/check/elements/dash_mpd.c b/tests/check/elements/dash_mpd.c index 696c46cad6..373802f992 100644 --- a/tests/check/elements/dash_mpd.c +++ b/tests/check/elements/dash_mpd.c @@ -2125,6 +2125,30 @@ GST_START_TEST (dash_mpdparser_type_dynamic) GST_END_TEST; +/* + * Validate gst_mpdparser_build_URL_from_template function + * + */ +GST_START_TEST (dash_mpdparser_template_parsing) +{ + const gchar *url_template; + const gchar *id = "TestId"; + guint number = 7; + guint bandwidth = 2500; + guint64 time = 100; + gchar *result; + + url_template = "TestMedia$Bandwidth$$$test"; + result = + gst_mpdparser_build_URL_from_template (url_template, id, number, + bandwidth, time); + assert_equals_string (result, "TestMedia2500$test"); + g_free (result); + +} + +GST_END_TEST; + /* * Test handling Representation selection * @@ -2468,6 +2492,7 @@ dash_suite (void) /* tests checking other possible values for attributes */ tcase_add_test (tc_simpleMPD, dash_mpdparser_type_dynamic); + tcase_add_test (tc_simpleMPD, dash_mpdparser_template_parsing); tcase_add_test (tc_complexMPD, dash_mpdparser_representation_selection); /* tests checking the parsing of missing/incomplete attributes of xml */