mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-08 15:32:32 +00:00
- Added dispose handler
Original commit message from CVS: - Added dispose handler - remove unused mutex/cond - use trace API
This commit is contained in:
parent
fb663a408f
commit
3521cec843
1 changed files with 23 additions and 9 deletions
|
@ -22,13 +22,14 @@
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
/* #define GST_DEBUG_ENABLED */
|
|
||||||
#include "gst_private.h"
|
#include "gst_private.h"
|
||||||
|
|
||||||
#include "gstclock.h"
|
#include "gstclock.h"
|
||||||
#include "gstlog.h"
|
#include "gstlog.h"
|
||||||
#include "gstmemchunk.h"
|
#include "gstmemchunk.h"
|
||||||
|
|
||||||
|
/* #define GST_WITH_ALLOC_TRACE */
|
||||||
|
#include "gstmemchunk.h"
|
||||||
|
|
||||||
#define DEFAULT_MAX_DIFF (2 * GST_SECOND)
|
#define DEFAULT_MAX_DIFF (2 * GST_SECOND)
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -37,10 +38,13 @@ enum {
|
||||||
ARG_MAX_DIFF,
|
ARG_MAX_DIFF,
|
||||||
};
|
};
|
||||||
|
|
||||||
static GstMemChunk *_gst_clock_entries_chunk;
|
static GstMemChunk *_gst_clock_entries_chunk;
|
||||||
|
static GstAllocTrace *_gst_clock_entry_trace;
|
||||||
|
|
||||||
static void gst_clock_class_init (GstClockClass *klass);
|
static void gst_clock_class_init (GstClockClass *klass);
|
||||||
static void gst_clock_init (GstClock *clock);
|
static void gst_clock_init (GstClock *clock);
|
||||||
|
static void gst_clock_dispose (GObject *object);
|
||||||
|
|
||||||
static void gst_clock_set_property (GObject *object, guint prop_id,
|
static void gst_clock_set_property (GObject *object, guint prop_id,
|
||||||
const GValue *value, GParamSpec *pspec);
|
const GValue *value, GParamSpec *pspec);
|
||||||
static void gst_clock_get_property (GObject *object, guint prop_id,
|
static void gst_clock_get_property (GObject *object, guint prop_id,
|
||||||
|
@ -51,9 +55,6 @@ static void gst_clock_update_stats (GstClock *clock);
|
||||||
static GstObjectClass *parent_class = NULL;
|
static GstObjectClass *parent_class = NULL;
|
||||||
/* static guint gst_clock_signals[LAST_SIGNAL] = { 0 }; */
|
/* static guint gst_clock_signals[LAST_SIGNAL] = { 0 }; */
|
||||||
|
|
||||||
static GMutex *_gst_clock_mutex;
|
|
||||||
static GCond *_gst_clock_cond;
|
|
||||||
|
|
||||||
static GstClockID
|
static GstClockID
|
||||||
gst_clock_entry_new (GstClock *clock, GstClockTime time,
|
gst_clock_entry_new (GstClock *clock, GstClockTime time,
|
||||||
GstClockTime interval, GstClockEntryType type)
|
GstClockTime interval, GstClockEntryType type)
|
||||||
|
@ -61,6 +62,7 @@ gst_clock_entry_new (GstClock *clock, GstClockTime time,
|
||||||
GstClockEntry *entry;
|
GstClockEntry *entry;
|
||||||
|
|
||||||
entry = gst_mem_chunk_alloc (_gst_clock_entries_chunk);
|
entry = gst_mem_chunk_alloc (_gst_clock_entries_chunk);
|
||||||
|
gst_alloc_trace_new (_gst_clock_entry_trace, entry);
|
||||||
|
|
||||||
entry->clock = clock;
|
entry->clock = clock;
|
||||||
entry->time = time;
|
entry->time = time;
|
||||||
|
@ -281,6 +283,7 @@ gst_clock_id_free (GstClockID id)
|
||||||
{
|
{
|
||||||
g_return_if_fail (id != NULL);
|
g_return_if_fail (id != NULL);
|
||||||
|
|
||||||
|
gst_alloc_trace_free (_gst_clock_entry_trace, id);
|
||||||
gst_mem_chunk_free (_gst_clock_entries_chunk, id);
|
gst_mem_chunk_free (_gst_clock_entries_chunk, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,9 +357,9 @@ gst_clock_class_init (GstClockClass *klass)
|
||||||
sizeof (GstClockEntry), sizeof (GstClockEntry) * 32,
|
sizeof (GstClockEntry), sizeof (GstClockEntry) * 32,
|
||||||
G_ALLOC_AND_FREE);
|
G_ALLOC_AND_FREE);
|
||||||
|
|
||||||
_gst_clock_mutex = g_mutex_new ();
|
_gst_clock_entry_trace = gst_alloc_trace_register (GST_CLOCK_ENTRY_TRACE_NAME);
|
||||||
_gst_clock_cond = g_cond_new ();
|
|
||||||
|
|
||||||
|
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_clock_dispose);
|
||||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_clock_set_property);
|
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_clock_set_property);
|
||||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_clock_get_property);
|
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_clock_get_property);
|
||||||
|
|
||||||
|
@ -385,6 +388,17 @@ gst_clock_init (GstClock *clock)
|
||||||
clock->active_cond = g_cond_new ();
|
clock->active_cond = g_cond_new ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_clock_dispose (GObject *object)
|
||||||
|
{
|
||||||
|
GstClock *clock = GST_CLOCK (object);
|
||||||
|
|
||||||
|
g_mutex_free (clock->active_mutex);
|
||||||
|
g_cond_free (clock->active_cond);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_clock_set_speed
|
* gst_clock_set_speed
|
||||||
* @clock: a #GstClock to modify
|
* @clock: a #GstClock to modify
|
||||||
|
@ -633,7 +647,7 @@ gst_clock_get_time (GstClock *clock)
|
||||||
g_return_val_if_fail (GST_IS_CLOCK (clock), 0LL);
|
g_return_val_if_fail (GST_IS_CLOCK (clock), 0LL);
|
||||||
|
|
||||||
if (!clock->active) {
|
if (!clock->active) {
|
||||||
/* clock is not activen return previous time */
|
/* clock is not active return previous time */
|
||||||
ret = clock->last_time;
|
ret = clock->last_time;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in a new issue