mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
mpdparser: Fix some memory leaks in the MPD parser and unit test
This commit is contained in:
parent
d525d9c391
commit
cd47556351
2 changed files with 10 additions and 6 deletions
|
@ -3832,7 +3832,7 @@ gst_mpd_client_get_next_fragment (GstMpdClient * client,
|
||||||
mediaURL =
|
mediaURL =
|
||||||
g_strdup (gst_mpdparser_get_mediaURL (stream,
|
g_strdup (gst_mpdparser_get_mediaURL (stream,
|
||||||
currentChunk->SegmentURL));
|
currentChunk->SegmentURL));
|
||||||
indexURL = currentChunk->SegmentURL->index;
|
indexURL = g_strdup (currentChunk->SegmentURL->index);
|
||||||
} else if (stream->cur_seg_template != NULL) {
|
} else if (stream->cur_seg_template != NULL) {
|
||||||
mediaURL =
|
mediaURL =
|
||||||
gst_mpdparser_build_URL_from_template (stream->
|
gst_mpdparser_build_URL_from_template (stream->
|
||||||
|
@ -3905,6 +3905,7 @@ gst_mpd_client_get_next_fragment (GstMpdClient * client,
|
||||||
|
|
||||||
base_url = gst_uri_from_string (stream->baseURL);
|
base_url = gst_uri_from_string (stream->baseURL);
|
||||||
frag_url = gst_uri_from_string_with_base (base_url, mediaURL);
|
frag_url = gst_uri_from_string_with_base (base_url, mediaURL);
|
||||||
|
g_free (mediaURL);
|
||||||
if (stream->queryURL) {
|
if (stream->queryURL) {
|
||||||
frag_url = gst_uri_make_writable (frag_url);
|
frag_url = gst_uri_make_writable (frag_url);
|
||||||
gst_uri_set_query_string (frag_url, stream->queryURL);
|
gst_uri_set_query_string (frag_url, stream->queryURL);
|
||||||
|
@ -3918,11 +3919,8 @@ gst_mpd_client_get_next_fragment (GstMpdClient * client,
|
||||||
gst_uri_set_query_string (frag_url, stream->queryURL);
|
gst_uri_set_query_string (frag_url, stream->queryURL);
|
||||||
fragment->index_uri = gst_uri_to_string (frag_url);
|
fragment->index_uri = gst_uri_to_string (frag_url);
|
||||||
gst_uri_unref (frag_url);
|
gst_uri_unref (frag_url);
|
||||||
}
|
g_free (indexURL);
|
||||||
|
} else if (indexURL == NULL && (fragment->index_range_start
|
||||||
gst_uri_unref (base_url);
|
|
||||||
|
|
||||||
if (indexURL == NULL && (fragment->index_range_start
|
|
||||||
|| fragment->index_range_end != -1)) {
|
|| fragment->index_range_end != -1)) {
|
||||||
/* index has no specific URL but has a range, we should only use this if
|
/* index has no specific URL but has a range, we should only use this if
|
||||||
* the media also has a range, otherwise we are serving some data twice
|
* the media also has a range, otherwise we are serving some data twice
|
||||||
|
@ -3936,6 +3934,8 @@ gst_mpd_client_get_next_fragment (GstMpdClient * client,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gst_uri_unref (base_url);
|
||||||
|
|
||||||
GST_DEBUG ("Loading chunk with URL %s", fragment->uri);
|
GST_DEBUG ("Loading chunk with URL %s", fragment->uri);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -2914,6 +2914,8 @@ GST_START_TEST (dash_mpdparser_get_audio_languages)
|
||||||
assert_equals_string ((gchar *) g_list_nth_data (languages, 0), "en");
|
assert_equals_string ((gchar *) g_list_nth_data (languages, 0), "en");
|
||||||
assert_equals_string ((gchar *) g_list_nth_data (languages, 1), "fr");
|
assert_equals_string ((gchar *) g_list_nth_data (languages, 1), "fr");
|
||||||
|
|
||||||
|
g_list_free (languages);
|
||||||
|
|
||||||
gst_mpd_client_free (mpdclient);
|
gst_mpd_client_free (mpdclient);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3266,6 +3268,7 @@ GST_START_TEST (dash_mpdparser_headers)
|
||||||
assert_equals_string (uri, "TestSourceUrl");
|
assert_equals_string (uri, "TestSourceUrl");
|
||||||
assert_equals_int64 (range_start, 100);
|
assert_equals_int64 (range_start, 100);
|
||||||
assert_equals_int64 (range_end, 200);
|
assert_equals_int64 (range_end, 200);
|
||||||
|
g_free (uri);
|
||||||
|
|
||||||
/* get segment url and range from segment indexRange */
|
/* get segment url and range from segment indexRange */
|
||||||
ret =
|
ret =
|
||||||
|
@ -3275,6 +3278,7 @@ GST_START_TEST (dash_mpdparser_headers)
|
||||||
assert_equals_string (uri, "TestSourceUrl");
|
assert_equals_string (uri, "TestSourceUrl");
|
||||||
assert_equals_int64 (range_start, 10);
|
assert_equals_int64 (range_start, 10);
|
||||||
assert_equals_int64 (range_end, 20);
|
assert_equals_int64 (range_end, 20);
|
||||||
|
g_free (uri);
|
||||||
|
|
||||||
gst_mpd_client_free (mpdclient);
|
gst_mpd_client_free (mpdclient);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue