mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-07 03:02:17 +00:00
sys/winks/gstksclock.c (gst_ks_clock_worker_thread_func, gst_ks_clock_start):
Original commit message from CVS: * sys/winks/gstksclock.c (gst_ks_clock_worker_thread_func, gst_ks_clock_start): Synchronize KS clock as a single-shot operation for now, there's not much point in doing it periodically until we're actually using the KS timestamps for anything else than just discarding old frames. * sys/winks/gstksvideosrc.c (gst_ks_video_src_open_device): Provide the GstClock when opening the device if we already have one.
This commit is contained in:
parent
0ff4dc306f
commit
61dee51291
3 changed files with 24 additions and 13 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2008-09-10 Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.com>
|
||||||
|
|
||||||
|
* sys/winks/gstksclock.c (gst_ks_clock_worker_thread_func,
|
||||||
|
gst_ks_clock_start):
|
||||||
|
Synchronize KS clock as a single-shot operation for now, there's not
|
||||||
|
much point in doing it periodically until we're actually using the
|
||||||
|
KS timestamps for anything else than just discarding old frames.
|
||||||
|
* sys/winks/gstksvideosrc.c (gst_ks_video_src_open_device):
|
||||||
|
Provide the GstClock when opening the device if we already have one.
|
||||||
|
|
||||||
2008-09-10 Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.com>
|
2008-09-10 Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.com>
|
||||||
|
|
||||||
* sys/winks/gstksvideodevice.c (GST_DEBUG_IS_ENABLED, last_timestamp,
|
* sys/winks/gstksvideodevice.c (GST_DEBUG_IS_ENABLED, last_timestamp,
|
||||||
|
|
|
@ -289,15 +289,17 @@ gst_ks_clock_worker_thread_func (gpointer data)
|
||||||
gst_ks_clock_set_state_unlocked (self, KSSTATE_RUN);
|
gst_ks_clock_set_state_unlocked (self, KSSTATE_RUN);
|
||||||
|
|
||||||
while (priv->worker_running) {
|
while (priv->worker_running) {
|
||||||
GTimeVal next_wakeup;
|
|
||||||
|
|
||||||
if (priv->master_clock != NULL) {
|
if (priv->master_clock != NULL) {
|
||||||
GstClockTime now = gst_clock_get_time (priv->master_clock);
|
GstClockTime now = gst_clock_get_time (priv->master_clock);
|
||||||
now /= 100;
|
now /= 100;
|
||||||
|
|
||||||
if (!ks_object_set_property (priv->clock_handle, KSPROPSETID_Clock,
|
if (ks_object_set_property (priv->clock_handle, KSPROPSETID_Clock,
|
||||||
KSPROPERTY_CLOCK_TIME, &now, sizeof (now))) {
|
KSPROPERTY_CLOCK_TIME, &now, sizeof (now))) {
|
||||||
GST_WARNING ("Failed to sync clock");
|
GST_DEBUG ("clock synchronized");
|
||||||
|
gst_object_unref (priv->master_clock);
|
||||||
|
priv->master_clock = NULL;
|
||||||
|
} else {
|
||||||
|
GST_WARNING ("failed to synchronize clock");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,9 +308,7 @@ gst_ks_clock_worker_thread_func (gpointer data)
|
||||||
g_cond_signal (priv->client_cond);
|
g_cond_signal (priv->client_cond);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_get_current_time (&next_wakeup);
|
g_cond_wait (priv->worker_cond, priv->mutex);
|
||||||
next_wakeup.tv_sec += 1;
|
|
||||||
g_cond_timed_wait (priv->worker_cond, priv->mutex, &next_wakeup);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->worker_initialized = FALSE;
|
priv->worker_initialized = FALSE;
|
||||||
|
@ -329,8 +329,7 @@ gst_ks_clock_start (GstKsClock * self)
|
||||||
priv->worker_initialized = FALSE;
|
priv->worker_initialized = FALSE;
|
||||||
|
|
||||||
priv->worker_thread =
|
priv->worker_thread =
|
||||||
g_thread_create_full (gst_ks_clock_worker_thread_func, self, 0, TRUE,
|
g_thread_create (gst_ks_clock_worker_thread_func, self, TRUE, NULL);
|
||||||
TRUE, G_THREAD_PRIORITY_HIGH, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!priv->worker_initialized)
|
while (!priv->worker_initialized)
|
||||||
|
|
|
@ -414,14 +414,16 @@ gst_ks_video_src_open_device (GstKsVideoSrc * self)
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
priv->ksclock = g_object_new (GST_TYPE_KS_CLOCK, NULL);
|
priv->ksclock = g_object_new (GST_TYPE_KS_CLOCK, NULL);
|
||||||
if (priv->ksclock != NULL && !gst_ks_clock_open (priv->ksclock)) {
|
if (priv->ksclock != NULL && gst_ks_clock_open (priv->ksclock)) {
|
||||||
|
GstClock *clock = GST_ELEMENT_CLOCK (self);
|
||||||
|
if (clock != NULL)
|
||||||
|
gst_ks_clock_provide_master_clock (priv->ksclock, clock);
|
||||||
|
} else {
|
||||||
|
GST_WARNING_OBJECT (self, "failed to create/open KsClock");
|
||||||
g_object_unref (priv->ksclock);
|
g_object_unref (priv->ksclock);
|
||||||
priv->ksclock = NULL;
|
priv->ksclock = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->ksclock == NULL)
|
|
||||||
GST_WARNING_OBJECT (self, "Failed to create/open KsClock");
|
|
||||||
|
|
||||||
device = g_object_new (GST_TYPE_KS_VIDEO_DEVICE,
|
device = g_object_new (GST_TYPE_KS_VIDEO_DEVICE,
|
||||||
"clock", priv->ksclock, "device-path", entry->path, NULL);
|
"clock", priv->ksclock, "device-path", entry->path, NULL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue