gstreamer playback: fix possible race condition

Origin commit data
------------------
Branch: master
Commit: 5059eaa75b
Author: TangoCash <eric@loxat.de>
Date: 2017-11-10 (Fri, 10 Nov 2017)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
TangoCash
2017-11-10 12:02:55 +01:00
parent 8fc449b5ed
commit 9d8a2ee268

View File

@@ -1016,22 +1016,28 @@ void cPlayback::GetMetadata(std::vector<std::string> &keys, std::vector<std::str
{
keys.clear();
values.clear();
if (gst_tag_list_is_empty (m_stream_tags))
GstTagList *meta_list = gst_tag_list_copy(m_stream_tags);
if (meta_list == NULL)
return;
for (guint i = 0, icnt = gst_tag_list_n_tags(m_stream_tags); i < icnt; i++)
if (gst_tag_list_is_empty(meta_list))
return;
for (guint i = 0, icnt = gst_tag_list_n_tags(meta_list); i < icnt; i++)
{
const gchar *name = gst_tag_list_nth_tag_name(m_stream_tags, i);
const gchar *name = gst_tag_list_nth_tag_name(meta_list, i);
if (!name)
{
continue;
}
for (guint j = 0, jcnt = gst_tag_list_get_tag_size(m_stream_tags, name); j < jcnt; j++)
for (guint j = 0, jcnt = gst_tag_list_get_tag_size(meta_list, name); j < jcnt; j++)
{
const GValue *val;
val = gst_tag_list_get_value_index(m_stream_tags, name, j);
val = gst_tag_list_get_value_index(meta_list, name, j);
if (val == NULL)
continue;
@@ -1074,6 +1080,7 @@ void cPlayback::GetMetadata(std::vector<std::string> &keys, std::vector<std::str
}
}
gst_tag_list_unref(meta_list);
printf("%s:%s %d tags found\n", FILENAME, __func__, (int)keys.size());
}