mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 14:08:56 +00:00
gst/tcp/gstmultifdsink.*: More multifdsink stats. Avoid deadlock by releasing locks before sending out a signal.
Original commit message from CVS: * gst/tcp/gstmultifdsink.c: (gst_multifdsink_class_init), (gst_multifdsink_add), (gst_multifdsink_get_stats), (gst_multifdsink_client_remove), (gst_multifdsink_handle_client_write), (gst_multifdsink_queue_buffer): * gst/tcp/gstmultifdsink.h: More multifdsink stats. Avoid deadlock by releasing locks before sending out a signal.
This commit is contained in:
parent
caf652fb8a
commit
2a50750258
3 changed files with 32 additions and 3 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2004-07-20 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* gst/tcp/gstmultifdsink.c: (gst_multifdsink_class_init),
|
||||||
|
(gst_multifdsink_add), (gst_multifdsink_get_stats),
|
||||||
|
(gst_multifdsink_client_remove),
|
||||||
|
(gst_multifdsink_handle_client_write),
|
||||||
|
(gst_multifdsink_queue_buffer):
|
||||||
|
* gst/tcp/gstmultifdsink.h:
|
||||||
|
More multifdsink stats. Avoid deadlock by releasing locks
|
||||||
|
before sending out a signal.
|
||||||
|
|
||||||
2004-07-20 Thomas Vander Stichele <thomas at apestaart dot org>
|
2004-07-20 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
* po/LINGUAS:
|
* po/LINGUAS:
|
||||||
|
|
|
@ -315,6 +315,7 @@ gst_multifdsink_add (GstMultiFdSink * sink, int fd)
|
||||||
/* update start time */
|
/* update start time */
|
||||||
g_get_current_time (&now);
|
g_get_current_time (&now);
|
||||||
client->connect_time = GST_TIMEVAL_TO_TIME (now);
|
client->connect_time = GST_TIMEVAL_TO_TIME (now);
|
||||||
|
client->disconnect_time = 0;
|
||||||
/* send last activity time to connect time */
|
/* send last activity time to connect time */
|
||||||
client->last_activity_time = GST_TIMEVAL_TO_TIME (now);
|
client->last_activity_time = GST_TIMEVAL_TO_TIME (now);
|
||||||
|
|
||||||
|
@ -382,6 +383,7 @@ gst_multifdsink_get_stats (GstMultiFdSink * sink, int fd)
|
||||||
|
|
||||||
if (client->fd == fd) {
|
if (client->fd == fd) {
|
||||||
GValue value = { 0 };
|
GValue value = { 0 };
|
||||||
|
guint64 interval;
|
||||||
|
|
||||||
result = g_value_array_new (4);
|
result = g_value_array_new (4);
|
||||||
|
|
||||||
|
@ -393,12 +395,25 @@ gst_multifdsink_get_stats (GstMultiFdSink * sink, int fd)
|
||||||
g_value_set_uint64 (&value, client->connect_time);
|
g_value_set_uint64 (&value, client->connect_time);
|
||||||
result = g_value_array_append (result, &value);
|
result = g_value_array_append (result, &value);
|
||||||
g_value_unset (&value);
|
g_value_unset (&value);
|
||||||
|
if (client->disconnect_time == 0) {
|
||||||
|
GTimeVal nowtv;
|
||||||
|
|
||||||
|
g_get_current_time (&nowtv);
|
||||||
|
|
||||||
|
interval = GST_TIMEVAL_TO_TIME (nowtv) - client->connect_time;
|
||||||
|
} else {
|
||||||
|
interval = client->disconnect_time - client->connect_time;
|
||||||
|
}
|
||||||
g_value_init (&value, G_TYPE_UINT64);
|
g_value_init (&value, G_TYPE_UINT64);
|
||||||
g_value_set_uint64 (&value, client->disconnect_time);
|
g_value_set_uint64 (&value, client->disconnect_time);
|
||||||
result = g_value_array_append (result, &value);
|
result = g_value_array_append (result, &value);
|
||||||
g_value_unset (&value);
|
g_value_unset (&value);
|
||||||
g_value_init (&value, G_TYPE_UINT64);
|
g_value_init (&value, G_TYPE_UINT64);
|
||||||
g_value_set_uint64 (&value, client->connect_interval);
|
g_value_set_uint64 (&value, interval);
|
||||||
|
result = g_value_array_append (result, &value);
|
||||||
|
g_value_unset (&value);
|
||||||
|
g_value_init (&value, G_TYPE_UINT64);
|
||||||
|
g_value_set_uint64 (&value, client->last_activity_time);
|
||||||
result = g_value_array_append (result, &value);
|
result = g_value_array_append (result, &value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -413,6 +428,7 @@ gst_multifdsink_get_stats (GstMultiFdSink * sink, int fd)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* should be called with the clientslock held */
|
||||||
static void
|
static void
|
||||||
gst_multifdsink_client_remove (GstMultiFdSink * sink, GstTCPClient * client)
|
gst_multifdsink_client_remove (GstMultiFdSink * sink, GstTCPClient * client)
|
||||||
{
|
{
|
||||||
|
@ -430,11 +446,14 @@ gst_multifdsink_client_remove (GstMultiFdSink * sink, GstTCPClient * client)
|
||||||
|
|
||||||
g_get_current_time (&now);
|
g_get_current_time (&now);
|
||||||
client->disconnect_time = GST_TIMEVAL_TO_TIME (now);
|
client->disconnect_time = GST_TIMEVAL_TO_TIME (now);
|
||||||
client->connect_interval = client->disconnect_time = client->connect_time;
|
|
||||||
|
g_mutex_unlock (sink->clientslock);
|
||||||
|
|
||||||
g_signal_emit (G_OBJECT (sink),
|
g_signal_emit (G_OBJECT (sink),
|
||||||
gst_multifdsink_signals[SIGNAL_CLIENT_REMOVED], 0, fd);
|
gst_multifdsink_signals[SIGNAL_CLIENT_REMOVED], 0, fd);
|
||||||
|
|
||||||
|
g_mutex_lock (sink->clientslock);
|
||||||
|
|
||||||
sink->clients = g_list_remove (sink->clients, client);
|
sink->clients = g_list_remove (sink->clients, client);
|
||||||
|
|
||||||
g_free (client);
|
g_free (client);
|
||||||
|
|
|
@ -95,7 +95,6 @@ typedef struct {
|
||||||
guint64 bytes_sent;
|
guint64 bytes_sent;
|
||||||
guint64 connect_time;
|
guint64 connect_time;
|
||||||
guint64 disconnect_time;
|
guint64 disconnect_time;
|
||||||
guint64 connect_interval;
|
|
||||||
guint64 last_activity_time;
|
guint64 last_activity_time;
|
||||||
guint64 dropped_buffers;
|
guint64 dropped_buffers;
|
||||||
guint64 avg_queue_size;
|
guint64 avg_queue_size;
|
||||||
|
|
Loading…
Reference in a new issue