2005-11-17 17:55:17 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2005 Wim Taymans <wim@fluendo.com>
|
|
|
|
* 2005 Andy Wingo <wingo@pobox.com>
|
|
|
|
*
|
|
|
|
* gstnetclientclock.h: clock that synchronizes itself to a time provider over
|
|
|
|
* the network
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
2005-11-24 09:44:07 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gstnetclientclock
|
|
|
|
* @short_description: Special clock that synchronizes to a remote time
|
|
|
|
* provider.
|
|
|
|
* @see_also: #GstClock, #GstNetTimeProvider, #GstPipeline
|
|
|
|
*
|
|
|
|
* This object implements a custom #GstClock that synchronizes its time
|
|
|
|
* to a remote time provider such as #GstNetTimeProvider.
|
|
|
|
*
|
|
|
|
* A new clock is created with gst_net_client_clock_new() which takes the
|
|
|
|
* address and port of the remote time provider along with a name and
|
|
|
|
* an initial time.
|
|
|
|
*
|
|
|
|
* This clock will poll the time provider and will update its calibration
|
|
|
|
* parameters based on the local and remote observations.
|
|
|
|
*
|
|
|
|
* Various parameters of the clock can be configured with the parent #GstClock
|
|
|
|
* "timeout", "window-size" and "window-threshold" object properties.
|
|
|
|
*
|
|
|
|
* A #GstNetClientClock is typically set on a #GstPipeline with
|
|
|
|
* gst_pipeline_use_clock().
|
|
|
|
*
|
|
|
|
* Last reviewed on 2005-11-23 (0.9.5)
|
|
|
|
*/
|
2005-11-17 17:55:17 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "gstnettimepacket.h"
|
|
|
|
#include "gstnetclientclock.h"
|
|
|
|
|
2007-10-31 22:01:03 +00:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined (_MSC_VER) && _MSC_VER >= 1400
|
|
|
|
#include <io.h>
|
|
|
|
#endif
|
|
|
|
|
2006-06-23 13:16:46 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (ncc_debug);
|
2005-11-17 17:55:17 +00:00
|
|
|
#define GST_CAT_DEFAULT (ncc_debug)
|
|
|
|
|
2005-12-06 19:29:15 +00:00
|
|
|
#define DEFAULT_ADDRESS "127.0.0.1"
|
|
|
|
#define DEFAULT_PORT 5637
|
|
|
|
#define DEFAULT_TIMEOUT GST_SECOND
|
2005-11-17 17:55:17 +00:00
|
|
|
|
2006-09-05 08:35:20 +00:00
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
#define getsockname(sock,addr,len) getsockname(sock,addr,(int *)len)
|
|
|
|
#endif
|
|
|
|
|
2005-11-17 17:55:17 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_ADDRESS,
|
|
|
|
PROP_PORT,
|
|
|
|
};
|
|
|
|
|
Use a private stuct to not break ABI.
Original commit message from CVS:
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/net/gstnetclientclock.c:
(gst_net_client_clock_class_init), (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_class_init), (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Use a private stuct to not break ABI.
2008-02-27 19:01:12 +00:00
|
|
|
#define GST_NET_CLIENT_CLOCK_GET_PRIVATE(obj) \
|
|
|
|
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_NET_CLIENT_CLOCK, GstNetClientClockPrivate))
|
|
|
|
|
|
|
|
struct _GstNetClientClockPrivate
|
|
|
|
{
|
|
|
|
GstPollFD sock;
|
|
|
|
GstPoll *fdset;
|
|
|
|
};
|
|
|
|
|
2005-11-17 17:55:17 +00:00
|
|
|
#define _do_init(type) \
|
|
|
|
GST_DEBUG_CATEGORY_INIT (ncc_debug, "netclock", 0, "Network client clock");
|
|
|
|
|
|
|
|
GST_BOILERPLATE_FULL (GstNetClientClock, gst_net_client_clock,
|
|
|
|
GstSystemClock, GST_TYPE_SYSTEM_CLOCK, _do_init);
|
|
|
|
|
|
|
|
static void gst_net_client_clock_finalize (GObject * object);
|
|
|
|
static void gst_net_client_clock_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_net_client_clock_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
|
|
|
|
|
|
|
static void gst_net_client_clock_stop (GstNetClientClock * self);
|
|
|
|
|
2006-09-05 08:35:20 +00:00
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
static int
|
|
|
|
inet_aton (const char *c, struct in_addr *paddr)
|
|
|
|
{
|
|
|
|
/* note that inet_addr is deprecated on unix because
|
|
|
|
* inet_addr returns -1 (INADDR_NONE) for the valid 255.255.255.255
|
|
|
|
* address. */
|
|
|
|
paddr->s_addr = inet_addr (c);
|
|
|
|
if (paddr->s_addr == INADDR_NONE)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-11-17 17:55:17 +00:00
|
|
|
static void
|
|
|
|
gst_net_client_clock_base_init (gpointer g_class)
|
|
|
|
{
|
|
|
|
/* nop */
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_net_client_clock_class_init (GstNetClientClockClass * klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
|
2006-05-11 18:10:34 +00:00
|
|
|
gobject_class = G_OBJECT_CLASS (klass);
|
2005-11-17 17:55:17 +00:00
|
|
|
|
Use a private stuct to not break ABI.
Original commit message from CVS:
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/net/gstnetclientclock.c:
(gst_net_client_clock_class_init), (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_class_init), (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Use a private stuct to not break ABI.
2008-02-27 19:01:12 +00:00
|
|
|
g_type_class_add_private (klass, sizeof (GstNetClientClockPrivate));
|
|
|
|
|
2005-11-17 17:55:17 +00:00
|
|
|
gobject_class->finalize = gst_net_client_clock_finalize;
|
|
|
|
gobject_class->get_property = gst_net_client_clock_get_property;
|
|
|
|
gobject_class->set_property = gst_net_client_clock_set_property;
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_ADDRESS,
|
|
|
|
g_param_spec_string ("address", "address",
|
|
|
|
"The address of the machine providing a time server, "
|
2008-03-22 14:56:17 +00:00
|
|
|
"as a dotted quad (x.x.x.x)", DEFAULT_ADDRESS,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2006-05-11 18:10:34 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_PORT,
|
2005-11-17 17:55:17 +00:00
|
|
|
g_param_spec_int ("port", "port",
|
2005-11-18 11:57:30 +00:00
|
|
|
"The port on which the remote server is listening", 0, G_MAXUINT16,
|
2008-03-22 14:56:17 +00:00
|
|
|
DEFAULT_PORT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2005-11-17 17:55:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_net_client_clock_init (GstNetClientClock * self,
|
|
|
|
GstNetClientClockClass * g_class)
|
|
|
|
{
|
gst/base/gstbasesink.*: No need to store the clock, the parent element class already has it.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_wait), (gst_base_sink_do_sync),
(gst_base_sink_handle_event):
* gst/base/gstbasesink.h:
No need to store the clock, the parent element class already
has it.
* gst/gstbin.c: (gst_bin_set_clock_func), (gst_bin_add_func):
Updates for clock_set returning a gboolean
* gst/gstclock.c: (gst_clock_entry_new), (gst_clock_id_wait),
(gst_clock_id_wait_async), (gst_clock_class_init),
(gst_clock_init), (gst_clock_finalize),
(gst_clock_get_internal_time), (gst_clock_get_time),
(gst_clock_slave_callback), (gst_clock_set_master),
(gst_clock_get_master), (do_linear_regression),
(gst_clock_add_observation), (gst_clock_set_property),
(gst_clock_get_property):
* gst/gstclock.h:
Implement master/slave. When setting a clock as a slave, a
periodic timeout is scheduled to sample master and slave times.
Then the slave clock is recalibrated to match offset and rate
of the master clock.
Update logging a bit.
Add flag so that a clock can state that is cannot be slaved to
another clock.
* gst/gstelement.c: (gst_element_set_clock):
* gst/gstelement.h:
The set_clock returns a gboolean for when an element cannot
deal with the selected clock in the pipeline.
* gst/gstpipeline.c: (gst_pipeline_change_state),
(gst_pipeline_set_clock):
* gst/gstpipeline.h:
Handle the case where the selected clock cannot be set on
the pipeline.
* gst/net/gstnetclientclock.c: (gst_net_client_clock_class_init),
(gst_net_client_clock_init), (gst_net_client_clock_finalize),
(gst_net_client_clock_set_property),
(gst_net_client_clock_get_property),
(gst_net_client_clock_observe_times):
* gst/net/gstnetclientclock.h:
Use regression code in GstClock parent, remove duplicated
functionality.
2005-11-22 18:28:44 +00:00
|
|
|
GstClock *clock = GST_CLOCK_CAST (self);
|
|
|
|
|
2006-09-05 08:35:20 +00:00
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
WSADATA w;
|
|
|
|
int error = WSAStartup (0x0202, &w);
|
|
|
|
|
|
|
|
if (error) {
|
|
|
|
GST_DEBUG_OBJECT (self, "Error on WSAStartup");
|
|
|
|
}
|
|
|
|
if (w.wVersion != 0x0202) {
|
|
|
|
WSACleanup ();
|
|
|
|
}
|
|
|
|
#endif
|
Use a private stuct to not break ABI.
Original commit message from CVS:
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/net/gstnetclientclock.c:
(gst_net_client_clock_class_init), (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_class_init), (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Use a private stuct to not break ABI.
2008-02-27 19:01:12 +00:00
|
|
|
self->priv = GST_NET_CLIENT_CLOCK_GET_PRIVATE (self);
|
2006-09-05 08:35:20 +00:00
|
|
|
|
2005-11-17 17:55:17 +00:00
|
|
|
self->port = DEFAULT_PORT;
|
|
|
|
self->address = g_strdup (DEFAULT_ADDRESS);
|
gst/base/gstbasesink.*: No need to store the clock, the parent element class already has it.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_wait), (gst_base_sink_do_sync),
(gst_base_sink_handle_event):
* gst/base/gstbasesink.h:
No need to store the clock, the parent element class already
has it.
* gst/gstbin.c: (gst_bin_set_clock_func), (gst_bin_add_func):
Updates for clock_set returning a gboolean
* gst/gstclock.c: (gst_clock_entry_new), (gst_clock_id_wait),
(gst_clock_id_wait_async), (gst_clock_class_init),
(gst_clock_init), (gst_clock_finalize),
(gst_clock_get_internal_time), (gst_clock_get_time),
(gst_clock_slave_callback), (gst_clock_set_master),
(gst_clock_get_master), (do_linear_regression),
(gst_clock_add_observation), (gst_clock_set_property),
(gst_clock_get_property):
* gst/gstclock.h:
Implement master/slave. When setting a clock as a slave, a
periodic timeout is scheduled to sample master and slave times.
Then the slave clock is recalibrated to match offset and rate
of the master clock.
Update logging a bit.
Add flag so that a clock can state that is cannot be slaved to
another clock.
* gst/gstelement.c: (gst_element_set_clock):
* gst/gstelement.h:
The set_clock returns a gboolean for when an element cannot
deal with the selected clock in the pipeline.
* gst/gstpipeline.c: (gst_pipeline_change_state),
(gst_pipeline_set_clock):
* gst/gstpipeline.h:
Handle the case where the selected clock cannot be set on
the pipeline.
* gst/net/gstnetclientclock.c: (gst_net_client_clock_class_init),
(gst_net_client_clock_init), (gst_net_client_clock_finalize),
(gst_net_client_clock_set_property),
(gst_net_client_clock_get_property),
(gst_net_client_clock_observe_times):
* gst/net/gstnetclientclock.h:
Use regression code in GstClock parent, remove duplicated
functionality.
2005-11-22 18:28:44 +00:00
|
|
|
|
|
|
|
clock->timeout = DEFAULT_TIMEOUT;
|
2005-11-17 17:55:17 +00:00
|
|
|
|
Use a private stuct to not break ABI.
Original commit message from CVS:
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/net/gstnetclientclock.c:
(gst_net_client_clock_class_init), (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_class_init), (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Use a private stuct to not break ABI.
2008-02-27 19:01:12 +00:00
|
|
|
self->priv->sock.fd = -1;
|
2005-11-17 17:55:17 +00:00
|
|
|
self->thread = NULL;
|
|
|
|
|
|
|
|
self->servaddr = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_net_client_clock_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GstNetClientClock *self = GST_NET_CLIENT_CLOCK (object);
|
|
|
|
|
|
|
|
if (self->thread) {
|
|
|
|
gst_net_client_clock_stop (self);
|
|
|
|
g_assert (self->thread == NULL);
|
|
|
|
}
|
|
|
|
|
Use a private stuct to not break ABI.
Original commit message from CVS:
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/net/gstnetclientclock.c:
(gst_net_client_clock_class_init), (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_class_init), (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Use a private stuct to not break ABI.
2008-02-27 19:01:12 +00:00
|
|
|
if (self->priv->fdset) {
|
|
|
|
gst_poll_free (self->priv->fdset);
|
|
|
|
self->priv->fdset = NULL;
|
2005-11-17 17:55:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_free (self->address);
|
|
|
|
self->address = NULL;
|
|
|
|
|
|
|
|
g_free (self->servaddr);
|
|
|
|
self->servaddr = NULL;
|
|
|
|
|
2006-09-05 08:35:20 +00:00
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
WSACleanup ();
|
|
|
|
#endif
|
|
|
|
|
2005-11-17 17:55:17 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_net_client_clock_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstNetClientClock *self = GST_NET_CLIENT_CLOCK (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_ADDRESS:
|
|
|
|
g_free (self->address);
|
|
|
|
if (g_value_get_string (value) == NULL)
|
|
|
|
self->address = g_strdup (DEFAULT_ADDRESS);
|
|
|
|
else
|
|
|
|
self->address = g_strdup (g_value_get_string (value));
|
|
|
|
break;
|
|
|
|
case PROP_PORT:
|
|
|
|
self->port = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_net_client_clock_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstNetClientClock *self = GST_NET_CLIENT_CLOCK (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_ADDRESS:
|
|
|
|
g_value_set_string (value, self->address);
|
|
|
|
break;
|
|
|
|
case PROP_PORT:
|
|
|
|
g_value_set_int (value, self->port);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_net_client_clock_observe_times (GstNetClientClock * self,
|
|
|
|
GstClockTime local_1, GstClockTime remote, GstClockTime local_2)
|
|
|
|
{
|
|
|
|
GstClockTime local_avg;
|
gst/base/gstbasesink.*: No need to store the clock, the parent element class already has it.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_wait), (gst_base_sink_do_sync),
(gst_base_sink_handle_event):
* gst/base/gstbasesink.h:
No need to store the clock, the parent element class already
has it.
* gst/gstbin.c: (gst_bin_set_clock_func), (gst_bin_add_func):
Updates for clock_set returning a gboolean
* gst/gstclock.c: (gst_clock_entry_new), (gst_clock_id_wait),
(gst_clock_id_wait_async), (gst_clock_class_init),
(gst_clock_init), (gst_clock_finalize),
(gst_clock_get_internal_time), (gst_clock_get_time),
(gst_clock_slave_callback), (gst_clock_set_master),
(gst_clock_get_master), (do_linear_regression),
(gst_clock_add_observation), (gst_clock_set_property),
(gst_clock_get_property):
* gst/gstclock.h:
Implement master/slave. When setting a clock as a slave, a
periodic timeout is scheduled to sample master and slave times.
Then the slave clock is recalibrated to match offset and rate
of the master clock.
Update logging a bit.
Add flag so that a clock can state that is cannot be slaved to
another clock.
* gst/gstelement.c: (gst_element_set_clock):
* gst/gstelement.h:
The set_clock returns a gboolean for when an element cannot
deal with the selected clock in the pipeline.
* gst/gstpipeline.c: (gst_pipeline_change_state),
(gst_pipeline_set_clock):
* gst/gstpipeline.h:
Handle the case where the selected clock cannot be set on
the pipeline.
* gst/net/gstnetclientclock.c: (gst_net_client_clock_class_init),
(gst_net_client_clock_init), (gst_net_client_clock_finalize),
(gst_net_client_clock_set_property),
(gst_net_client_clock_get_property),
(gst_net_client_clock_observe_times):
* gst/net/gstnetclientclock.h:
Use regression code in GstClock parent, remove duplicated
functionality.
2005-11-22 18:28:44 +00:00
|
|
|
gdouble r_squared;
|
|
|
|
GstClock *clock;
|
2005-11-17 17:55:17 +00:00
|
|
|
|
|
|
|
if (local_2 < local_1)
|
|
|
|
goto bogus_observation;
|
|
|
|
|
2005-11-18 14:13:28 +00:00
|
|
|
local_avg = (local_2 + local_1) / 2;
|
2005-11-17 17:55:17 +00:00
|
|
|
|
gst/base/gstbasesink.*: No need to store the clock, the parent element class already has it.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_wait), (gst_base_sink_do_sync),
(gst_base_sink_handle_event):
* gst/base/gstbasesink.h:
No need to store the clock, the parent element class already
has it.
* gst/gstbin.c: (gst_bin_set_clock_func), (gst_bin_add_func):
Updates for clock_set returning a gboolean
* gst/gstclock.c: (gst_clock_entry_new), (gst_clock_id_wait),
(gst_clock_id_wait_async), (gst_clock_class_init),
(gst_clock_init), (gst_clock_finalize),
(gst_clock_get_internal_time), (gst_clock_get_time),
(gst_clock_slave_callback), (gst_clock_set_master),
(gst_clock_get_master), (do_linear_regression),
(gst_clock_add_observation), (gst_clock_set_property),
(gst_clock_get_property):
* gst/gstclock.h:
Implement master/slave. When setting a clock as a slave, a
periodic timeout is scheduled to sample master and slave times.
Then the slave clock is recalibrated to match offset and rate
of the master clock.
Update logging a bit.
Add flag so that a clock can state that is cannot be slaved to
another clock.
* gst/gstelement.c: (gst_element_set_clock):
* gst/gstelement.h:
The set_clock returns a gboolean for when an element cannot
deal with the selected clock in the pipeline.
* gst/gstpipeline.c: (gst_pipeline_change_state),
(gst_pipeline_set_clock):
* gst/gstpipeline.h:
Handle the case where the selected clock cannot be set on
the pipeline.
* gst/net/gstnetclientclock.c: (gst_net_client_clock_class_init),
(gst_net_client_clock_init), (gst_net_client_clock_finalize),
(gst_net_client_clock_set_property),
(gst_net_client_clock_get_property),
(gst_net_client_clock_observe_times):
* gst/net/gstnetclientclock.h:
Use regression code in GstClock parent, remove duplicated
functionality.
2005-11-22 18:28:44 +00:00
|
|
|
clock = GST_CLOCK_CAST (self);
|
2005-11-17 17:55:17 +00:00
|
|
|
|
gst/base/gstbasesink.*: No need to store the clock, the parent element class already has it.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_wait), (gst_base_sink_do_sync),
(gst_base_sink_handle_event):
* gst/base/gstbasesink.h:
No need to store the clock, the parent element class already
has it.
* gst/gstbin.c: (gst_bin_set_clock_func), (gst_bin_add_func):
Updates for clock_set returning a gboolean
* gst/gstclock.c: (gst_clock_entry_new), (gst_clock_id_wait),
(gst_clock_id_wait_async), (gst_clock_class_init),
(gst_clock_init), (gst_clock_finalize),
(gst_clock_get_internal_time), (gst_clock_get_time),
(gst_clock_slave_callback), (gst_clock_set_master),
(gst_clock_get_master), (do_linear_regression),
(gst_clock_add_observation), (gst_clock_set_property),
(gst_clock_get_property):
* gst/gstclock.h:
Implement master/slave. When setting a clock as a slave, a
periodic timeout is scheduled to sample master and slave times.
Then the slave clock is recalibrated to match offset and rate
of the master clock.
Update logging a bit.
Add flag so that a clock can state that is cannot be slaved to
another clock.
* gst/gstelement.c: (gst_element_set_clock):
* gst/gstelement.h:
The set_clock returns a gboolean for when an element cannot
deal with the selected clock in the pipeline.
* gst/gstpipeline.c: (gst_pipeline_change_state),
(gst_pipeline_set_clock):
* gst/gstpipeline.h:
Handle the case where the selected clock cannot be set on
the pipeline.
* gst/net/gstnetclientclock.c: (gst_net_client_clock_class_init),
(gst_net_client_clock_init), (gst_net_client_clock_finalize),
(gst_net_client_clock_set_property),
(gst_net_client_clock_get_property),
(gst_net_client_clock_observe_times):
* gst/net/gstnetclientclock.h:
Use regression code in GstClock parent, remove duplicated
functionality.
2005-11-22 18:28:44 +00:00
|
|
|
gst_clock_add_observation (GST_CLOCK (self), local_avg, remote, &r_squared);
|
2005-11-17 17:55:17 +00:00
|
|
|
|
2005-11-23 12:36:00 +00:00
|
|
|
GST_CLOCK_SLAVE_LOCK (self);
|
gst/base/gstbasesink.*: No need to store the clock, the parent element class already has it.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_wait), (gst_base_sink_do_sync),
(gst_base_sink_handle_event):
* gst/base/gstbasesink.h:
No need to store the clock, the parent element class already
has it.
* gst/gstbin.c: (gst_bin_set_clock_func), (gst_bin_add_func):
Updates for clock_set returning a gboolean
* gst/gstclock.c: (gst_clock_entry_new), (gst_clock_id_wait),
(gst_clock_id_wait_async), (gst_clock_class_init),
(gst_clock_init), (gst_clock_finalize),
(gst_clock_get_internal_time), (gst_clock_get_time),
(gst_clock_slave_callback), (gst_clock_set_master),
(gst_clock_get_master), (do_linear_regression),
(gst_clock_add_observation), (gst_clock_set_property),
(gst_clock_get_property):
* gst/gstclock.h:
Implement master/slave. When setting a clock as a slave, a
periodic timeout is scheduled to sample master and slave times.
Then the slave clock is recalibrated to match offset and rate
of the master clock.
Update logging a bit.
Add flag so that a clock can state that is cannot be slaved to
another clock.
* gst/gstelement.c: (gst_element_set_clock):
* gst/gstelement.h:
The set_clock returns a gboolean for when an element cannot
deal with the selected clock in the pipeline.
* gst/gstpipeline.c: (gst_pipeline_change_state),
(gst_pipeline_set_clock):
* gst/gstpipeline.h:
Handle the case where the selected clock cannot be set on
the pipeline.
* gst/net/gstnetclientclock.c: (gst_net_client_clock_class_init),
(gst_net_client_clock_init), (gst_net_client_clock_finalize),
(gst_net_client_clock_set_property),
(gst_net_client_clock_get_property),
(gst_net_client_clock_observe_times):
* gst/net/gstnetclientclock.h:
Use regression code in GstClock parent, remove duplicated
functionality.
2005-11-22 18:28:44 +00:00
|
|
|
if (clock->filling) {
|
2005-11-17 17:55:17 +00:00
|
|
|
self->current_timeout = 0;
|
|
|
|
} else {
|
|
|
|
/* geto formula */
|
|
|
|
self->current_timeout =
|
|
|
|
(1e-3 / (1 - MIN (r_squared, 0.99999))) * GST_SECOND;
|
gst/base/gstbasesink.*: No need to store the clock, the parent element class already has it.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_wait), (gst_base_sink_do_sync),
(gst_base_sink_handle_event):
* gst/base/gstbasesink.h:
No need to store the clock, the parent element class already
has it.
* gst/gstbin.c: (gst_bin_set_clock_func), (gst_bin_add_func):
Updates for clock_set returning a gboolean
* gst/gstclock.c: (gst_clock_entry_new), (gst_clock_id_wait),
(gst_clock_id_wait_async), (gst_clock_class_init),
(gst_clock_init), (gst_clock_finalize),
(gst_clock_get_internal_time), (gst_clock_get_time),
(gst_clock_slave_callback), (gst_clock_set_master),
(gst_clock_get_master), (do_linear_regression),
(gst_clock_add_observation), (gst_clock_set_property),
(gst_clock_get_property):
* gst/gstclock.h:
Implement master/slave. When setting a clock as a slave, a
periodic timeout is scheduled to sample master and slave times.
Then the slave clock is recalibrated to match offset and rate
of the master clock.
Update logging a bit.
Add flag so that a clock can state that is cannot be slaved to
another clock.
* gst/gstelement.c: (gst_element_set_clock):
* gst/gstelement.h:
The set_clock returns a gboolean for when an element cannot
deal with the selected clock in the pipeline.
* gst/gstpipeline.c: (gst_pipeline_change_state),
(gst_pipeline_set_clock):
* gst/gstpipeline.h:
Handle the case where the selected clock cannot be set on
the pipeline.
* gst/net/gstnetclientclock.c: (gst_net_client_clock_class_init),
(gst_net_client_clock_init), (gst_net_client_clock_finalize),
(gst_net_client_clock_set_property),
(gst_net_client_clock_get_property),
(gst_net_client_clock_observe_times):
* gst/net/gstnetclientclock.h:
Use regression code in GstClock parent, remove duplicated
functionality.
2005-11-22 18:28:44 +00:00
|
|
|
self->current_timeout = MIN (self->current_timeout, clock->timeout);
|
2005-11-17 17:55:17 +00:00
|
|
|
}
|
2005-11-23 12:36:00 +00:00
|
|
|
GST_CLOCK_SLAVE_UNLOCK (clock);
|
2005-11-17 17:55:17 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
bogus_observation:
|
|
|
|
{
|
2006-10-05 14:26:08 +00:00
|
|
|
GST_WARNING_OBJECT (self, "time packet receive time < send time (%"
|
|
|
|
GST_TIME_FORMAT " < %" GST_TIME_FORMAT ")", GST_TIME_ARGS (local_1),
|
2005-11-17 17:55:17 +00:00
|
|
|
GST_TIME_ARGS (local_2));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
libs/gst/net/: Massive code removal and cleanups because of GstPoll.
Original commit message from CVS:
Patch by: Peter Kjellerstedt <pkj at axis dot com>
* libs/gst/net/gstnetclientclock.c: (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c: (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Massive code removal and cleanups because of GstPoll.
Fixes #505417.
2008-02-27 18:27:59 +00:00
|
|
|
gst_net_client_clock_do_select (GstNetClientClock * self)
|
2005-11-17 17:55:17 +00:00
|
|
|
{
|
|
|
|
while (TRUE) {
|
libs/gst/net/: Massive code removal and cleanups because of GstPoll.
Original commit message from CVS:
Patch by: Peter Kjellerstedt <pkj at axis dot com>
* libs/gst/net/gstnetclientclock.c: (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c: (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Massive code removal and cleanups because of GstPoll.
Fixes #505417.
2008-02-27 18:27:59 +00:00
|
|
|
GstClockTime diff;
|
|
|
|
gint ret;
|
2005-11-17 17:55:17 +00:00
|
|
|
|
|
|
|
GST_LOG_OBJECT (self, "doing select");
|
|
|
|
|
libs/gst/net/: Massive code removal and cleanups because of GstPoll.
Original commit message from CVS:
Patch by: Peter Kjellerstedt <pkj at axis dot com>
* libs/gst/net/gstnetclientclock.c: (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c: (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Massive code removal and cleanups because of GstPoll.
Fixes #505417.
2008-02-27 18:27:59 +00:00
|
|
|
diff = gst_clock_get_internal_time (GST_CLOCK (self));
|
Use a private stuct to not break ABI.
Original commit message from CVS:
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/net/gstnetclientclock.c:
(gst_net_client_clock_class_init), (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_class_init), (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Use a private stuct to not break ABI.
2008-02-27 19:01:12 +00:00
|
|
|
ret = gst_poll_wait (self->priv->fdset, self->current_timeout);
|
libs/gst/net/: Massive code removal and cleanups because of GstPoll.
Original commit message from CVS:
Patch by: Peter Kjellerstedt <pkj at axis dot com>
* libs/gst/net/gstnetclientclock.c: (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c: (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Massive code removal and cleanups because of GstPoll.
Fixes #505417.
2008-02-27 18:27:59 +00:00
|
|
|
diff = gst_clock_get_internal_time (GST_CLOCK (self)) - diff;
|
2005-11-17 17:55:17 +00:00
|
|
|
|
libs/gst/net/: Massive code removal and cleanups because of GstPoll.
Original commit message from CVS:
Patch by: Peter Kjellerstedt <pkj at axis dot com>
* libs/gst/net/gstnetclientclock.c: (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c: (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Massive code removal and cleanups because of GstPoll.
Fixes #505417.
2008-02-27 18:27:59 +00:00
|
|
|
if (diff > self->current_timeout)
|
|
|
|
self->current_timeout = 0;
|
|
|
|
else
|
|
|
|
self->current_timeout -= diff;
|
2005-11-17 17:55:17 +00:00
|
|
|
|
|
|
|
GST_LOG_OBJECT (self, "select returned %d", ret);
|
|
|
|
|
libs/gst/net/: Massive code removal and cleanups because of GstPoll.
Original commit message from CVS:
Patch by: Peter Kjellerstedt <pkj at axis dot com>
* libs/gst/net/gstnetclientclock.c: (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c: (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Massive code removal and cleanups because of GstPoll.
Fixes #505417.
2008-02-27 18:27:59 +00:00
|
|
|
if (ret < 0 && errno != EBUSY) {
|
2005-11-17 17:55:17 +00:00
|
|
|
if (errno != EAGAIN && errno != EINTR)
|
|
|
|
goto select_error;
|
|
|
|
else
|
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
|
|
|
/* log errors and keep going */
|
|
|
|
select_error:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (self, "select error %d: %s (%d)", ret,
|
|
|
|
g_strerror (errno), errno);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gpointer
|
|
|
|
gst_net_client_clock_thread (gpointer data)
|
|
|
|
{
|
|
|
|
GstNetClientClock *self = data;
|
|
|
|
struct sockaddr_in tmpaddr;
|
|
|
|
socklen_t len;
|
|
|
|
GstNetTimePacket *packet;
|
|
|
|
gint ret;
|
2005-11-23 13:14:46 +00:00
|
|
|
GstClock *clock = data;
|
2005-11-17 17:55:17 +00:00
|
|
|
|
|
|
|
while (TRUE) {
|
libs/gst/net/: Massive code removal and cleanups because of GstPoll.
Original commit message from CVS:
Patch by: Peter Kjellerstedt <pkj at axis dot com>
* libs/gst/net/gstnetclientclock.c: (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c: (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Massive code removal and cleanups because of GstPoll.
Fixes #505417.
2008-02-27 18:27:59 +00:00
|
|
|
ret = gst_net_client_clock_do_select (self);
|
2005-11-17 17:55:17 +00:00
|
|
|
|
libs/gst/net/: Massive code removal and cleanups because of GstPoll.
Original commit message from CVS:
Patch by: Peter Kjellerstedt <pkj at axis dot com>
* libs/gst/net/gstnetclientclock.c: (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c: (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Massive code removal and cleanups because of GstPoll.
Fixes #505417.
2008-02-27 18:27:59 +00:00
|
|
|
if (ret < 0 && errno == EBUSY) {
|
|
|
|
GST_LOG_OBJECT (self, "stop");
|
|
|
|
goto stopped;
|
2005-11-17 17:55:17 +00:00
|
|
|
} else if (ret == 0) {
|
|
|
|
/* timed out, let's send another packet */
|
2006-10-09 10:14:28 +00:00
|
|
|
GST_DEBUG_OBJECT (self, "timed out");
|
2005-11-18 14:13:28 +00:00
|
|
|
|
2005-11-17 17:55:17 +00:00
|
|
|
packet = gst_net_time_packet_new (NULL);
|
|
|
|
|
|
|
|
packet->local_time = gst_clock_get_internal_time (GST_CLOCK (self));
|
|
|
|
|
2006-10-09 10:14:28 +00:00
|
|
|
GST_DEBUG_OBJECT (self, "sending packet, local time = %" GST_TIME_FORMAT,
|
2005-11-18 14:13:28 +00:00
|
|
|
GST_TIME_ARGS (packet->local_time));
|
Use a private stuct to not break ABI.
Original commit message from CVS:
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/net/gstnetclientclock.c:
(gst_net_client_clock_class_init), (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_class_init), (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Use a private stuct to not break ABI.
2008-02-27 19:01:12 +00:00
|
|
|
gst_net_time_packet_send (packet, self->priv->sock.fd,
|
2005-11-17 17:55:17 +00:00
|
|
|
(struct sockaddr *) self->servaddr, sizeof (struct sockaddr_in));
|
|
|
|
|
|
|
|
g_free (packet);
|
|
|
|
|
|
|
|
/* reset timeout */
|
2005-11-23 13:14:46 +00:00
|
|
|
self->current_timeout = clock->timeout;
|
2005-11-17 18:18:41 +00:00
|
|
|
continue;
|
Use a private stuct to not break ABI.
Original commit message from CVS:
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/net/gstnetclientclock.c:
(gst_net_client_clock_class_init), (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_class_init), (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Use a private stuct to not break ABI.
2008-02-27 19:01:12 +00:00
|
|
|
} else if (gst_poll_fd_can_read (self->priv->fdset, &self->priv->sock)) {
|
2005-11-17 17:55:17 +00:00
|
|
|
/* got data in */
|
|
|
|
GstClockTime new_local = gst_clock_get_internal_time (GST_CLOCK (self));
|
|
|
|
|
|
|
|
len = sizeof (struct sockaddr);
|
Use a private stuct to not break ABI.
Original commit message from CVS:
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/net/gstnetclientclock.c:
(gst_net_client_clock_class_init), (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_class_init), (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Use a private stuct to not break ABI.
2008-02-27 19:01:12 +00:00
|
|
|
packet = gst_net_time_packet_receive (self->priv->sock.fd,
|
2005-11-17 17:55:17 +00:00
|
|
|
(struct sockaddr *) &tmpaddr, &len);
|
|
|
|
|
|
|
|
if (!packet)
|
|
|
|
goto receive_error;
|
|
|
|
|
2006-10-09 10:14:28 +00:00
|
|
|
GST_LOG_OBJECT (self, "got packet back");
|
|
|
|
GST_LOG_OBJECT (self, "local_1 = %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (packet->local_time));
|
|
|
|
GST_LOG_OBJECT (self, "remote = %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (packet->remote_time));
|
|
|
|
GST_LOG_OBJECT (self, "local_2 = %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (new_local));
|
2005-11-18 14:13:28 +00:00
|
|
|
|
2005-11-17 17:55:17 +00:00
|
|
|
/* observe_times will reset the timeout */
|
|
|
|
gst_net_client_clock_observe_times (self, packet->local_time,
|
|
|
|
packet->remote_time, new_local);
|
|
|
|
|
|
|
|
g_free (packet);
|
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (self, "unhandled select return state?");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
|
|
|
stopped:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (self, "shutting down");
|
2005-11-18 10:54:55 +00:00
|
|
|
/* socket gets closed in _stop() */
|
2005-11-17 17:55:17 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
receive_error:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (self, "receive error");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_net_client_clock_start (GstNetClientClock * self)
|
|
|
|
{
|
|
|
|
struct sockaddr_in servaddr, myaddr;
|
|
|
|
socklen_t len;
|
|
|
|
gint ret;
|
|
|
|
GError *error;
|
|
|
|
|
|
|
|
g_return_val_if_fail (self->address != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (self->servaddr == NULL, FALSE);
|
|
|
|
|
|
|
|
if ((ret = socket (AF_INET, SOCK_DGRAM, 0)) < 0)
|
|
|
|
goto no_socket;
|
|
|
|
|
Use a private stuct to not break ABI.
Original commit message from CVS:
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/net/gstnetclientclock.c:
(gst_net_client_clock_class_init), (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_class_init), (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Use a private stuct to not break ABI.
2008-02-27 19:01:12 +00:00
|
|
|
self->priv->sock.fd = ret;
|
2005-11-17 17:55:17 +00:00
|
|
|
|
|
|
|
len = sizeof (myaddr);
|
Use a private stuct to not break ABI.
Original commit message from CVS:
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/net/gstnetclientclock.c:
(gst_net_client_clock_class_init), (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_class_init), (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Use a private stuct to not break ABI.
2008-02-27 19:01:12 +00:00
|
|
|
ret = getsockname (self->priv->sock.fd, (struct sockaddr *) &myaddr, &len);
|
2005-11-17 17:55:17 +00:00
|
|
|
if (ret < 0)
|
|
|
|
goto getsockname_error;
|
|
|
|
|
|
|
|
memset (&servaddr, 0, sizeof (servaddr));
|
|
|
|
servaddr.sin_family = AF_INET; /* host byte order */
|
|
|
|
servaddr.sin_port = htons (self->port); /* short, network byte order */
|
2006-05-25 15:52:19 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (self, "socket opened on UDP port %hd",
|
|
|
|
ntohs (servaddr.sin_port));
|
|
|
|
|
2005-11-17 17:55:17 +00:00
|
|
|
if (!inet_aton (self->address, &servaddr.sin_addr))
|
|
|
|
goto bad_address;
|
|
|
|
|
|
|
|
self->servaddr = g_malloc (sizeof (struct sockaddr_in));
|
|
|
|
memcpy (self->servaddr, &servaddr, sizeof (servaddr));
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (self, "will communicate with %s:%d", self->address,
|
|
|
|
self->port);
|
|
|
|
|
Use a private stuct to not break ABI.
Original commit message from CVS:
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/net/gstnetclientclock.c:
(gst_net_client_clock_class_init), (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_class_init), (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Use a private stuct to not break ABI.
2008-02-27 19:01:12 +00:00
|
|
|
gst_poll_add_fd (self->priv->fdset, &self->priv->sock);
|
|
|
|
gst_poll_fd_ctl_read (self->priv->fdset, &self->priv->sock, TRUE);
|
libs/gst/net/: Massive code removal and cleanups because of GstPoll.
Original commit message from CVS:
Patch by: Peter Kjellerstedt <pkj at axis dot com>
* libs/gst/net/gstnetclientclock.c: (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c: (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Massive code removal and cleanups because of GstPoll.
Fixes #505417.
2008-02-27 18:27:59 +00:00
|
|
|
|
2005-11-17 17:55:17 +00:00
|
|
|
self->thread = g_thread_create (gst_net_client_clock_thread, self, TRUE,
|
|
|
|
&error);
|
|
|
|
if (!self->thread)
|
|
|
|
goto no_thread;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
no_socket:
|
|
|
|
{
|
|
|
|
GST_ERROR_OBJECT (self, "socket failed %d: %s (%d)", ret,
|
|
|
|
g_strerror (errno), errno);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
getsockname_error:
|
|
|
|
{
|
|
|
|
GST_ERROR_OBJECT (self, "getsockname failed %d: %s (%d)", ret,
|
|
|
|
g_strerror (errno), errno);
|
Use a private stuct to not break ABI.
Original commit message from CVS:
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/net/gstnetclientclock.c:
(gst_net_client_clock_class_init), (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_class_init), (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Use a private stuct to not break ABI.
2008-02-27 19:01:12 +00:00
|
|
|
close (self->priv->sock.fd);
|
|
|
|
self->priv->sock.fd = -1;
|
2005-11-17 17:55:17 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
bad_address:
|
|
|
|
{
|
|
|
|
GST_ERROR_OBJECT (self, "inet_aton failed %d: %s (%d)", ret,
|
|
|
|
g_strerror (errno), errno);
|
Use a private stuct to not break ABI.
Original commit message from CVS:
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/net/gstnetclientclock.c:
(gst_net_client_clock_class_init), (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_class_init), (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Use a private stuct to not break ABI.
2008-02-27 19:01:12 +00:00
|
|
|
close (self->priv->sock.fd);
|
|
|
|
self->priv->sock.fd = -1;
|
2005-11-17 17:55:17 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
no_thread:
|
|
|
|
{
|
|
|
|
GST_ERROR_OBJECT (self, "could not create thread: %s", error->message);
|
Use a private stuct to not break ABI.
Original commit message from CVS:
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/net/gstnetclientclock.c:
(gst_net_client_clock_class_init), (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_class_init), (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Use a private stuct to not break ABI.
2008-02-27 19:01:12 +00:00
|
|
|
gst_poll_remove_fd (self->priv->fdset, &self->priv->sock);
|
|
|
|
close (self->priv->sock.fd);
|
|
|
|
self->priv->sock.fd = -1;
|
2005-11-17 17:55:17 +00:00
|
|
|
g_free (self->servaddr);
|
|
|
|
self->servaddr = NULL;
|
|
|
|
g_error_free (error);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_net_client_clock_stop (GstNetClientClock * self)
|
|
|
|
{
|
Use a private stuct to not break ABI.
Original commit message from CVS:
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/net/gstnetclientclock.c:
(gst_net_client_clock_class_init), (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_class_init), (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Use a private stuct to not break ABI.
2008-02-27 19:01:12 +00:00
|
|
|
gst_poll_set_flushing (self->priv->fdset, TRUE);
|
2005-11-17 17:55:17 +00:00
|
|
|
g_thread_join (self->thread);
|
|
|
|
self->thread = NULL;
|
|
|
|
|
Use a private stuct to not break ABI.
Original commit message from CVS:
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/net/gstnetclientclock.c:
(gst_net_client_clock_class_init), (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_class_init), (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Use a private stuct to not break ABI.
2008-02-27 19:01:12 +00:00
|
|
|
if (self->priv->sock.fd != -1) {
|
|
|
|
gst_poll_remove_fd (self->priv->fdset, &self->priv->sock);
|
|
|
|
close (self->priv->sock.fd);
|
|
|
|
self->priv->sock.fd = -1;
|
2005-11-17 17:55:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-23 16:10:38 +00:00
|
|
|
/**
|
|
|
|
* gst_net_client_clock_new:
|
|
|
|
* @name: a name for the clock
|
|
|
|
* @remote_address: the address of the remote clock provider
|
|
|
|
* @remote_port: the port of the remote clock provider
|
|
|
|
* @base_time: initial time of the clock
|
|
|
|
*
|
|
|
|
* Create a new #GstNetClientClock that will report the time
|
2009-11-27 14:39:37 +00:00
|
|
|
* provided by the #GstNetTimeProvider on @remote_address and
|
2005-11-23 16:10:38 +00:00
|
|
|
* @remote_port.
|
|
|
|
*
|
|
|
|
* Returns: a new #GstClock that receives a time from the remote
|
|
|
|
* clock.
|
|
|
|
*/
|
2005-11-17 17:55:17 +00:00
|
|
|
GstClock *
|
|
|
|
gst_net_client_clock_new (gchar * name, const gchar * remote_address,
|
|
|
|
gint remote_port, GstClockTime base_time)
|
|
|
|
{
|
|
|
|
GstNetClientClock *ret;
|
2005-11-18 10:54:55 +00:00
|
|
|
GstClockTime internal;
|
2005-11-17 17:55:17 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (remote_address != NULL, NULL);
|
|
|
|
g_return_val_if_fail (remote_port > 0, NULL);
|
2005-11-18 11:57:30 +00:00
|
|
|
g_return_val_if_fail (remote_port <= G_MAXUINT16, NULL);
|
2005-11-17 17:55:17 +00:00
|
|
|
g_return_val_if_fail (base_time != GST_CLOCK_TIME_NONE, NULL);
|
|
|
|
|
|
|
|
ret = g_object_new (GST_TYPE_NET_CLIENT_CLOCK, "address", remote_address,
|
|
|
|
"port", remote_port, NULL);
|
|
|
|
|
2005-11-18 10:54:55 +00:00
|
|
|
/* gst_clock_get_time() values are guaranteed to be increasing. because no one
|
|
|
|
* has called get_time on this clock yet we are free to adjust to any value
|
|
|
|
* without worrying about worrying about MAX() issues with the clock's
|
|
|
|
* internal time.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* update our internal time so get_time() give something around base_time.
|
|
|
|
assume that the rate is 1 in the beginning. */
|
|
|
|
internal = gst_clock_get_internal_time (GST_CLOCK (ret));
|
2005-11-23 12:36:00 +00:00
|
|
|
gst_clock_set_calibration (GST_CLOCK (ret), internal, base_time, 1, 1);
|
2005-11-18 10:54:55 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
GstClockTime now = gst_clock_get_time (GST_CLOCK (ret));
|
|
|
|
|
2009-10-13 16:12:50 +00:00
|
|
|
if (GST_CLOCK_DIFF (now, base_time) > 0 ||
|
|
|
|
GST_CLOCK_DIFF (now, base_time + GST_SECOND) < 0) {
|
2005-11-18 10:54:55 +00:00
|
|
|
g_warning ("unable to set the base time, expect sync problems!");
|
2009-10-13 16:12:50 +00:00
|
|
|
}
|
2005-11-18 10:54:55 +00:00
|
|
|
}
|
|
|
|
|
Remove GstPollMode from the API, it does not make sense to let the application control this.
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås
<ole dot andre dot ravnas at tandberg dot com>
* docs/gst/gstreamer-sections.txt:
* gst/gstpoll.c: (find_index), (gst_poll_free_winsock_event),
(gst_poll_update_winsock_event_mask), (gst_poll_new),
(gst_poll_free), (gst_poll_fd_init), (gst_poll_add_fd_unlocked),
(gst_poll_remove_fd), (gst_poll_fd_ctl_write),
(gst_poll_fd_ctl_read_unlocked), (gst_poll_fd_has_closed),
(gst_poll_fd_has_error), (gst_poll_fd_can_read_unlocked),
(gst_poll_fd_can_write), (gst_poll_wait),
(gst_poll_set_controllable), (gst_poll_restart),
(gst_poll_set_flushing):
* gst/gstpoll.h:
* libs/gst/net/gstnetclientclock.c: (gst_net_client_clock_new):
* libs/gst/net/gstnettimeprovider.c: (gst_net_time_provider_start),
(gst_net_time_provider_new):
* plugins/elements/gstfdsink.c: (gst_fd_sink_start):
* plugins/elements/gstfdsrc.c: (gst_fd_src_start):
* tests/benchmarks/gstpollstress.c: (main):
* tests/check/gst/gstpoll.c: (GST_START_TEST), (gst_poll_suite):
Remove GstPollMode from the API, it does not make sense to let the
application control this.
Add support for Win32.
Fix the testsuite. Fixes #520671.
2008-03-07 15:39:45 +00:00
|
|
|
if ((ret->priv->fdset = gst_poll_new (TRUE)) == NULL)
|
libs/gst/net/: Massive code removal and cleanups because of GstPoll.
Original commit message from CVS:
Patch by: Peter Kjellerstedt <pkj at axis dot com>
* libs/gst/net/gstnetclientclock.c: (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c: (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Massive code removal and cleanups because of GstPoll.
Fixes #505417.
2008-02-27 18:27:59 +00:00
|
|
|
goto no_fdset;
|
2005-11-17 17:55:17 +00:00
|
|
|
|
|
|
|
if (!gst_net_client_clock_start (ret))
|
|
|
|
goto failed_start;
|
|
|
|
|
|
|
|
/* all systems go, cap'n */
|
|
|
|
return (GstClock *) ret;
|
|
|
|
|
libs/gst/net/: Massive code removal and cleanups because of GstPoll.
Original commit message from CVS:
Patch by: Peter Kjellerstedt <pkj at axis dot com>
* libs/gst/net/gstnetclientclock.c: (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c: (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Massive code removal and cleanups because of GstPoll.
Fixes #505417.
2008-02-27 18:27:59 +00:00
|
|
|
no_fdset:
|
2005-11-17 17:55:17 +00:00
|
|
|
{
|
libs/gst/net/: Massive code removal and cleanups because of GstPoll.
Original commit message from CVS:
Patch by: Peter Kjellerstedt <pkj at axis dot com>
* libs/gst/net/gstnetclientclock.c: (gst_net_client_clock_init),
(gst_net_client_clock_finalize), (gst_net_client_clock_do_select),
(gst_net_client_clock_thread), (gst_net_client_clock_start),
(gst_net_client_clock_stop), (gst_net_client_clock_new):
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.c: (gst_net_time_provider_init),
(gst_net_time_provider_finalize), (gst_net_time_provider_thread),
(gst_net_time_provider_start), (gst_net_time_provider_stop),
(gst_net_time_provider_new):
* libs/gst/net/gstnettimeprovider.h:
Massive code removal and cleanups because of GstPoll.
Fixes #505417.
2008-02-27 18:27:59 +00:00
|
|
|
GST_ERROR_OBJECT (ret, "could not create an fdset: %s (%d)",
|
2005-11-17 17:55:17 +00:00
|
|
|
g_strerror (errno), errno);
|
|
|
|
gst_object_unref (ret);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
failed_start:
|
|
|
|
{
|
|
|
|
/* already printed a nice error */
|
|
|
|
gst_object_unref (ret);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|