multifdsink: add first and last buffer's timestamp to the stats

This commit is contained in:
Andoni Morales Alastruey 2010-10-13 17:09:13 +02:00 committed by Wim Taymans
parent 542256fd55
commit c41a4d0df4
2 changed files with 21 additions and 1 deletions

View file

@ -846,6 +846,8 @@ gst_multi_fd_sink_add_full (GstMultiFdSink * sink, int fd,
client->bytes_sent = 0;
client->dropped_buffers = 0;
client->avg_queue_size = 0;
client->first_buffer_ts = GST_CLOCK_TIME_NONE;
client->last_buffer_ts = GST_CLOCK_TIME_NONE;
client->new_connection = TRUE;
client->burst_min_unit = min_unit;
client->burst_min_value = min_value;
@ -1036,6 +1038,8 @@ restart:
* guint64 : time the client is/was connected (in nanoseconds)
* guint64 : last activity time (in nanoseconds, since Epoch)
* guint64 : buffers dropped due to recovery
* guint64 : timestamp of the first buffer sent (in nanoseconds)
* guint64 : timestamp of the last buffer sent (in nanoseconds)
*/
GValueArray *
gst_multi_fd_sink_get_stats (GstMultiFdSink * sink, int fd)
@ -1054,7 +1058,7 @@ gst_multi_fd_sink_get_stats (GstMultiFdSink * sink, int fd)
GValue value = { 0 };
guint64 interval;
result = g_value_array_new (5);
result = g_value_array_new (7);
g_value_init (&value, G_TYPE_UINT64);
g_value_set_uint64 (&value, client->bytes_sent);
@ -1088,6 +1092,14 @@ gst_multi_fd_sink_get_stats (GstMultiFdSink * sink, int fd)
g_value_init (&value, G_TYPE_UINT64);
g_value_set_uint64 (&value, client->dropped_buffers);
result = g_value_array_append (result, &value);
g_value_unset (&value);
g_value_init (&value, G_TYPE_UINT64);
g_value_set_uint64 (&value, client->first_buffer_ts);
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_buffer_ts);
result = g_value_array_append (result, &value);
}
noclient:
@ -2065,6 +2077,12 @@ gst_multi_fd_sink_handle_client_write (GstMultiFdSink * sink,
buf = g_array_index (sink->bufqueue, GstBuffer *, client->bufpos);
client->bufpos--;
/* update stats */
if (client->first_buffer_ts == GST_CLOCK_TIME_NONE)
client->first_buffer_ts = GST_BUFFER_TIMESTAMP (buf);
client->last_buffer_ts = GST_BUFFER_TIMESTAMP (buf);
/* decrease flushcount */
if (client->flushcount != -1)
client->flushcount--;

View file

@ -176,6 +176,8 @@ typedef struct {
guint64 last_activity_time;
guint64 dropped_buffers;
guint64 avg_queue_size;
guint64 first_buffer_ts;
guint64 last_buffer_ts;
} GstTCPClient;
#define CLIENTS_LOCK_INIT(fdsink) (g_static_rec_mutex_init(&fdsink->clientslock))