mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-27 15:32:43 +02:00
try to fix possible race condition
Origin commit data
------------------
Branch: master
Commit: 64828627ac
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2017-11-13 (Mon, 13 Nov 2017)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -72,6 +72,8 @@ GstElement * audioSink = NULL;
|
|||||||
GstElement * videoSink = NULL;
|
GstElement * videoSink = NULL;
|
||||||
gchar * uri = NULL;
|
gchar * uri = NULL;
|
||||||
GstTagList * m_stream_tags = NULL;
|
GstTagList * m_stream_tags = NULL;
|
||||||
|
pthread_mutex_t mutex_tag_ist;
|
||||||
|
|
||||||
static int end_eof = 0;
|
static int end_eof = 0;
|
||||||
#define HTTP_TIMEOUT 30
|
#define HTTP_TIMEOUT 30
|
||||||
// taken from record.h
|
// taken from record.h
|
||||||
@@ -261,6 +263,8 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data)
|
|||||||
if(!GST_IS_TAG_LIST(tags))
|
if(!GST_IS_TAG_LIST(tags))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
pthread_mutex_lock (&mutex_tag_ist);
|
||||||
|
|
||||||
result = gst_tag_list_merge(m_stream_tags, tags, GST_TAG_MERGE_REPLACE);
|
result = gst_tag_list_merge(m_stream_tags, tags, GST_TAG_MERGE_REPLACE);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
@@ -268,6 +272,8 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data)
|
|||||||
{
|
{
|
||||||
gst_tag_list_unref(tags);
|
gst_tag_list_unref(tags);
|
||||||
gst_tag_list_unref(result);
|
gst_tag_list_unref(result);
|
||||||
|
|
||||||
|
pthread_mutex_unlock (&mutex_tag_ist);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (m_stream_tags)
|
if (m_stream_tags)
|
||||||
@@ -276,6 +282,8 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data)
|
|||||||
gst_tag_list_unref(result);
|
gst_tag_list_unref(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pthread_mutex_unlock (&mutex_tag_ist);
|
||||||
|
|
||||||
const GValue *gv_image = gst_tag_list_get_value_index(tags, GST_TAG_IMAGE, 0);
|
const GValue *gv_image = gst_tag_list_get_value_index(tags, GST_TAG_IMAGE, 0);
|
||||||
if ( gv_image )
|
if ( gv_image )
|
||||||
{
|
{
|
||||||
@@ -413,6 +421,8 @@ cPlayback::cPlayback(int num)
|
|||||||
|
|
||||||
gst_mpegts_initialize();
|
gst_mpegts_initialize();
|
||||||
|
|
||||||
|
pthread_mutex_init (&mutex_tag_ist, NULL);
|
||||||
|
|
||||||
if (nano == 1)
|
if (nano == 1)
|
||||||
nano_str = "(CVS)";
|
nano_str = "(CVS)";
|
||||||
else if (nano == 2)
|
else if (nano == 2)
|
||||||
@@ -437,8 +447,10 @@ cPlayback::~cPlayback()
|
|||||||
{
|
{
|
||||||
lt_info( "%s:%s\n", FILENAME, __FUNCTION__);
|
lt_info( "%s:%s\n", FILENAME, __FUNCTION__);
|
||||||
//FIXME: all deleting stuff is done in Close()
|
//FIXME: all deleting stuff is done in Close()
|
||||||
|
pthread_mutex_lock (&mutex_tag_ist);
|
||||||
if (m_stream_tags)
|
if (m_stream_tags)
|
||||||
gst_tag_list_free(m_stream_tags);
|
gst_tag_list_free(m_stream_tags);
|
||||||
|
pthread_mutex_unlock (&mutex_tag_ist);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Used by Fileplay
|
//Used by Fileplay
|
||||||
@@ -530,9 +542,11 @@ bool cPlayback::Start(char *filename, int /*vpid*/, int /*vtype*/, int /*apid*/,
|
|||||||
mAudioStream = 0;
|
mAudioStream = 0;
|
||||||
init_jump = -1;
|
init_jump = -1;
|
||||||
|
|
||||||
|
pthread_mutex_lock (&mutex_tag_ist);
|
||||||
if (m_stream_tags)
|
if (m_stream_tags)
|
||||||
gst_tag_list_unref(m_stream_tags);
|
gst_tag_list_unref(m_stream_tags);
|
||||||
m_stream_tags = NULL;
|
m_stream_tags = NULL;
|
||||||
|
pthread_mutex_unlock (&mutex_tag_ist);
|
||||||
|
|
||||||
unlink("/tmp/.id3coverart");
|
unlink("/tmp/.id3coverart");
|
||||||
|
|
||||||
@@ -1025,14 +1039,21 @@ void cPlayback::GetMetadata(std::vector<std::string> &keys, std::vector<std::str
|
|||||||
values.clear();
|
values.clear();
|
||||||
|
|
||||||
GstTagList *meta_list = NULL;
|
GstTagList *meta_list = NULL;
|
||||||
if(m_stream_tags)
|
pthread_mutex_lock (&mutex_tag_ist);
|
||||||
|
|
||||||
|
if(m_stream_tags){
|
||||||
meta_list = gst_tag_list_copy(m_stream_tags);
|
meta_list = gst_tag_list_copy(m_stream_tags);
|
||||||
|
}
|
||||||
|
|
||||||
|
pthread_mutex_unlock (&mutex_tag_ist);
|
||||||
|
|
||||||
if (meta_list == NULL)
|
if (meta_list == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gst_tag_list_is_empty(meta_list))
|
if (gst_tag_list_is_empty(meta_list)){
|
||||||
|
gst_tag_list_unref(meta_list);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (guint i = 0, icnt = gst_tag_list_n_tags(meta_list); i < icnt; i++)
|
for (guint i = 0, icnt = gst_tag_list_n_tags(meta_list); i < icnt; i++)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user