[aravis/resend] gv_stream: resend request parameters.



commit 3e306971cc45e9b4ca0908b380844b05f665180a
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Sun Feb 20 22:35:29 2011 +0100

    gv_stream: resend request parameters.

 src/arvgvstream.c |   76 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 src/arvgvstream.h |    6 ++--
 2 files changed, 77 insertions(+), 5 deletions(-)
---
diff --git a/src/arvgvstream.c b/src/arvgvstream.c
index b51d647..586cd5f 100644
--- a/src/arvgvstream.c
+++ b/src/arvgvstream.c
@@ -35,13 +35,22 @@
 #include <string.h>
 #include <sys/socket.h>
 
-#define ARV_GV_STREAM_INCOMING_BUFFER_SIZE	65536
+#define ARV_GV_STREAM_INCOMING_BUFFER_SIZE			65536
+#define ARV_GV_STREAM_RESEND_REQUEST_THRESHOLD_DEFAULT		10
+#define ARV_GV_STREAM_RESEND_REQUEST_BATCHING_THRESHOLD_DEFAULT 1
+#define ARV_GV_STREAM_N_RESEND_REQUESTS_DEFAULT			3
+#define ARV_GV_STREAM_RESEND_RESPONSE_TIMEOUT_DEFAULT		10
+#define ARV_GV_STREAM_PACKET_TIMEOUT_DEFAULT			10
 
 enum {
 	ARV_GV_STREAM_PROPERTY_0,
 	ARV_GV_STREAM_PROPERTY_SOCKET_BUFFER,
 	ARV_GV_STREAM_PROPERTY_SOCKET_BUFFER_SIZE,
-	ARV_GV_STREAM_PROPERTY_PACKET_RESEND
+	ARV_GV_STREAM_PROPERTY_PACKET_RESEND,
+	ARV_GV_STREAM_PROPERTY_RESEND_REQUEST_THRESHOLD,
+	ARV_GV_STREAM_PROPERTY_RESEND_REQUEST_BATCHING_THRESHOLD,
+	ARV_GV_STREAM_PROPERTY_RESEND_RESPONSE_TIMEOUT,
+	ARV_GV_STREAM_PROPERTY_PACKET_TIMEOUT
 } ArvGvStreamProperties;
 
 static GObjectClass *parent_class = NULL;
@@ -59,6 +68,12 @@ typedef struct {
 
 	ArvGvStreamPacketResend packet_resend;
 
+	guint n_resend_requests;
+	guint resend_request_threshold;
+	guint resend_request_batching_threshold;
+	guint resend_response_timeout;
+	guint packet_timeout;
+
 	guint64 timestamp_tick_frequency;
 
 	gboolean cancel;
@@ -443,6 +458,11 @@ arv_gv_stream_new (GInetAddress *device_address, guint16 port,
 	thread_data->socket = gv_stream->socket;
 	thread_data->device_address = g_inet_socket_address_new (device_address, ARV_GVCP_PORT);
 	thread_data->packet_resend = ARV_GV_STREAM_PACKET_RESEND_BOTH;
+	thread_data->resend_request_threshold = ARV_GV_STREAM_RESEND_REQUEST_THRESHOLD_DEFAULT;
+	thread_data->resend_request_batching_threshold = ARV_GV_STREAM_RESEND_REQUEST_BATCHING_THRESHOLD_DEFAULT;
+	thread_data->n_resend_requests = ARV_GV_STREAM_N_RESEND_REQUESTS_DEFAULT;
+	thread_data->resend_response_timeout = ARV_GV_STREAM_RESEND_RESPONSE_TIMEOUT_DEFAULT;
+	thread_data->packet_timeout = ARV_GV_STREAM_PACKET_TIMEOUT_DEFAULT;
 	thread_data->timestamp_tick_frequency = timestamp_tick_frequency;
 	thread_data->cancel = FALSE;
 
@@ -532,6 +552,18 @@ arv_gv_stream_set_property (GObject * object, guint prop_id,
 		case ARV_GV_STREAM_PROPERTY_PACKET_RESEND:
 			thread_data->packet_resend = g_value_get_enum (value);
 			break;
+		case ARV_GV_STREAM_PROPERTY_RESEND_REQUEST_THRESHOLD:
+			thread_data->resend_request_threshold = g_value_get_int (value);
+			break;
+		case ARV_GV_STREAM_PROPERTY_RESEND_REQUEST_BATCHING_THRESHOLD:
+			thread_data->resend_request_batching_threshold = g_value_get_int (value);
+			break;
+		case ARV_GV_STREAM_PROPERTY_RESEND_RESPONSE_TIMEOUT:
+			thread_data->resend_response_timeout = g_value_get_int (value);
+			break;
+		case ARV_GV_STREAM_PROPERTY_PACKET_TIMEOUT:
+			thread_data->packet_timeout = g_value_get_int (value);
+			break;
 		default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 			break;
@@ -557,6 +589,18 @@ arv_gv_stream_get_property (GObject * object, guint prop_id,
 		case ARV_GV_STREAM_PROPERTY_PACKET_RESEND:
 			g_value_set_enum (value, thread_data->packet_resend);
 			break;
+		case ARV_GV_STREAM_PROPERTY_RESEND_REQUEST_THRESHOLD:
+			g_value_set_int (value, thread_data->resend_request_threshold);
+			break;
+		case ARV_GV_STREAM_PROPERTY_RESEND_REQUEST_BATCHING_THRESHOLD:
+			g_value_set_int (value, thread_data->resend_request_batching_threshold);
+			break;
+		case ARV_GV_STREAM_PROPERTY_RESEND_RESPONSE_TIMEOUT:
+			g_value_set_int (value, thread_data->resend_response_timeout);
+			break;
+		case ARV_GV_STREAM_PROPERTY_PACKET_TIMEOUT:
+			g_value_set_int (value, thread_data->packet_timeout);
+			break;
 		default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 			break;
@@ -656,6 +700,34 @@ arv_gv_stream_class_init (ArvGvStreamClass *gv_stream_class)
 				   ARV_GV_STREAM_PACKET_RESEND_BOTH,
 				   G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
 		);
+	g_object_class_install_property (
+		object_class, ARV_GV_STREAM_PROPERTY_RESEND_REQUEST_THRESHOLD,
+		g_param_spec_int ("resend-request-threshold", "Resend request threshold",
+				  "Resend request threshold",
+				  0, G_MAXINT, 0,
+				  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
+		);
+	g_object_class_install_property (
+		object_class, ARV_GV_STREAM_PROPERTY_RESEND_REQUEST_BATCHING_THRESHOLD,
+		g_param_spec_int ("resend-request-batching-threshold", "Resend request batching threshold",
+				  "Resend request batching threshold",
+				  0, G_MAXINT, 0,
+				  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
+		);
+	g_object_class_install_property (
+		object_class, ARV_GV_STREAM_PROPERTY_RESEND_RESPONSE_TIMEOUT,
+		g_param_spec_int ("resend-response-timeout", "Resend response timeout",
+				  "Resend response timeout, in ms",
+				  0, G_MAXINT, 0,
+				  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
+		);
+	g_object_class_install_property (
+		object_class, ARV_GV_STREAM_PROPERTY_PACKET_TIMEOUT,
+		g_param_spec_int ("packet-timeout", "Packet timeout",
+				  "Packet timeout, in ms",
+				  0, G_MAXINT, 0,
+				  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
+		);
 }
 
 G_DEFINE_TYPE (ArvGvStream, arv_gv_stream, ARV_TYPE_STREAM)
diff --git a/src/arvgvstream.h b/src/arvgvstream.h
index a02bf30..15617ef 100644
--- a/src/arvgvstream.h
+++ b/src/arvgvstream.h
@@ -43,14 +43,14 @@ typedef enum {
 /**
  * ArvGvStreamPacketResend:
  * @ARV_GV_STREAM_PACKET_RESEND_NEVER: never request a packet resend
- * @ARV_GV_STREAM_PACKET_RESEND_WINDOW: packet resend request based on receive window
+ * @ARV_GV_STREAM_PACKET_RESEND_THRESHOLD: packet resend request based on threshold
  * @ARV_GV_STREAM_PACKET_RESEND_TIMEOUT: packet resend request based on timeout
- * @ARV_GV_STREAM_PACKET_RESEND_BOTH: packet resend request based on receive window and timeout
+ * @ARV_GV_STREAM_PACKET_RESEND_BOTH: packet resend request based on threshold and timeout
  */
 
 typedef enum {
 	ARV_GV_STREAM_PACKET_RESEND_NEVER,
-	ARV_GV_STREAM_PACKET_RESEND_WINDOW	= 1,
+	ARV_GV_STREAM_PACKET_RESEND_THRESHOLD	= 1,
 	ARV_GV_STREAM_PACKET_RESEND_TIMEOUT	= 2,
 	ARV_GV_STREAM_PACKET_RESEND_BOTH	= 3,
 } ArvGvStreamPacketResend;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]