gst/tcp/gstmultifdsink.*: Added option to send a keyframe to clients as the first buffer.

Original commit message from CVS:
* gst/tcp/gstmultifdsink.c: (gst_multifdsink_class_init),
(gst_multifdsink_init), (gst_multifdsink_add),
(gst_multifdsink_client_queue_buffer),
(gst_multifdsink_set_property), (gst_multifdsink_get_property):
* gst/tcp/gstmultifdsink.h:
Added option to send a keyframe to clients as the first buffer.
Make timeout property writable.
This commit is contained in:
Wim Taymans 2004-08-17 10:30:17 +00:00
parent bda2761348
commit 0efee1eb17
3 changed files with 35 additions and 1 deletions

View file

@ -1,3 +1,13 @@
2004-08-17 Wim Taymans <wim@fluendo.com>
* gst/tcp/gstmultifdsink.c: (gst_multifdsink_class_init),
(gst_multifdsink_init), (gst_multifdsink_add),
(gst_multifdsink_client_queue_buffer),
(gst_multifdsink_set_property), (gst_multifdsink_get_property):
* gst/tcp/gstmultifdsink.h:
Added option to send a keyframe to clients as the first buffer.
Make timeout property writable.
2004-08-17 Thomas Vander Stichele <thomas at apestaart dot org> 2004-08-17 Thomas Vander Stichele <thomas at apestaart dot org>
patch by: Wim Taymans patch by: Wim Taymans

View file

@ -94,6 +94,7 @@ enum
#define DEFAULT_UNITS_SOFT_MAX -1 #define DEFAULT_UNITS_SOFT_MAX -1
#define DEFAULT_RECOVER_POLICY GST_RECOVER_POLICY_NONE #define DEFAULT_RECOVER_POLICY GST_RECOVER_POLICY_NONE
#define DEFAULT_TIMEOUT 0 #define DEFAULT_TIMEOUT 0
#define DEFAULT_SYNC_CLIENTS FALSE
enum enum
{ {
@ -113,6 +114,7 @@ enum
ARG_RECOVER_POLICY, ARG_RECOVER_POLICY,
ARG_TIMEOUT, ARG_TIMEOUT,
ARG_SYNC_CLIENTS,
ARG_BYTES_TO_SERVE, ARG_BYTES_TO_SERVE,
ARG_BYTES_SERVED, ARG_BYTES_SERVED,
}; };
@ -303,7 +305,11 @@ gst_multifdsink_class_init (GstMultiFdSinkClass * klass)
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TIMEOUT, g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TIMEOUT,
g_param_spec_uint64 ("timeout", "Timeout", g_param_spec_uint64 ("timeout", "Timeout",
"Maximum inactivity timeout in nanoseconds for a client (0 = no limit)", "Maximum inactivity timeout in nanoseconds for a client (0 = no limit)",
0, G_MAXUINT64, DEFAULT_TIMEOUT, G_PARAM_READABLE)); 0, G_MAXUINT64, DEFAULT_TIMEOUT, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC_CLIENTS,
g_param_spec_boolean ("sync-clients", "Sync clients",
"Sync clients to a keyframe",
DEFAULT_SYNC_CLIENTS, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BYTES_TO_SERVE, g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BYTES_TO_SERVE,
g_param_spec_uint64 ("bytes-to-serve", "Bytes to serve", g_param_spec_uint64 ("bytes-to-serve", "Bytes to serve",
"Number of bytes received to serve to clients", 0, G_MAXUINT64, 0, "Number of bytes received to serve to clients", 0, G_MAXUINT64, 0,
@ -377,6 +383,7 @@ gst_multifdsink_init (GstMultiFdSink * this)
this->recover_policy = DEFAULT_RECOVER_POLICY; this->recover_policy = DEFAULT_RECOVER_POLICY;
this->timeout = DEFAULT_TIMEOUT; this->timeout = DEFAULT_TIMEOUT;
this->sync_clients = DEFAULT_SYNC_CLIENTS;
} }
void void
@ -397,6 +404,7 @@ gst_multifdsink_add (GstMultiFdSink * sink, int fd)
client->bytes_sent = 0; client->bytes_sent = 0;
client->dropped_buffers = 0; client->dropped_buffers = 0;
client->avg_queue_size = 0; client->avg_queue_size = 0;
client->need_keyunit = sink->sync_clients;
/* update start time */ /* update start time */
g_get_current_time (&now); g_get_current_time (&now);
@ -708,6 +716,14 @@ static gboolean
gst_multifdsink_client_queue_buffer (GstMultiFdSink * sink, gst_multifdsink_client_queue_buffer (GstMultiFdSink * sink,
GstTCPClient * client, GstBuffer * buffer) GstTCPClient * client, GstBuffer * buffer)
{ {
if (client->need_keyunit) {
if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_DELTA_UNIT)) {
return TRUE;
} else if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_IN_CAPS)) {
client->need_keyunit = FALSE;
}
}
if (sink->protocol == GST_TCP_PROTOCOL_TYPE_GDP) { if (sink->protocol == GST_TCP_PROTOCOL_TYPE_GDP) {
guint8 *header; guint8 *header;
guint len; guint len;
@ -1270,6 +1286,9 @@ gst_multifdsink_set_property (GObject * object, guint prop_id,
case ARG_TIMEOUT: case ARG_TIMEOUT:
multifdsink->timeout = g_value_get_uint64 (value); multifdsink->timeout = g_value_get_uint64 (value);
break; break;
case ARG_SYNC_CLIENTS:
multifdsink->sync_clients = g_value_get_boolean (value);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -1323,6 +1342,9 @@ gst_multifdsink_get_property (GObject * object, guint prop_id, GValue * value,
case ARG_TIMEOUT: case ARG_TIMEOUT:
g_value_set_uint64 (value, multifdsink->timeout); g_value_set_uint64 (value, multifdsink->timeout);
break; break;
case ARG_SYNC_CLIENTS:
g_value_set_boolean (value, multifdsink->sync_clients);
break;
case ARG_BYTES_TO_SERVE: case ARG_BYTES_TO_SERVE:
g_value_set_uint64 (value, multifdsink->bytes_to_serve); g_value_set_uint64 (value, multifdsink->bytes_to_serve);
break; break;

View file

@ -97,6 +97,7 @@ typedef struct {
gboolean caps_sent; gboolean caps_sent;
gboolean streamheader_sent; gboolean streamheader_sent;
gboolean need_keyunit;
/* stats */ /* stats */
guint64 bytes_sent; guint64 bytes_sent;
@ -142,6 +143,7 @@ struct _GstMultiFdSink {
gint units_soft_max; /* max units a client can lag before recovery starts */ gint units_soft_max; /* max units a client can lag before recovery starts */
GstRecoverPolicy recover_policy; GstRecoverPolicy recover_policy;
GstClockTime timeout; /* max amount of nanoseconds to remain idle */ GstClockTime timeout; /* max amount of nanoseconds to remain idle */
gboolean sync_clients;/* sync clients to keyframe */
/* stats */ /* stats */
gint buffers_queued; /* number of queued buffers */ gint buffers_queued; /* number of queued buffers */