Commit e3f9e854 authored by Stian Selnes's avatar Stian Selnes Committed by Tim-Philipp Müller

netsim: Add netsim element

Resurrected from the Farstream repository and given an
overhaul to fix races, deadlocks etc.

https://bugzilla.gnome.org/show_bug.cgi?id=756252
parent 88e21e60
......@@ -501,6 +501,7 @@ AG_GST_CHECK_PLUGIN(mpegtsmux)
AG_GST_CHECK_PLUGIN(mpegpsmux)
AG_GST_CHECK_PLUGIN(mve)
AG_GST_CHECK_PLUGIN(mxf)
AG_GST_CHECK_PLUGIN(netsim)
AG_GST_CHECK_PLUGIN(nuvdemux)
AG_GST_CHECK_PLUGIN(onvif)
AG_GST_CHECK_PLUGIN(patchdetect)
......@@ -3474,6 +3475,7 @@ gst/mpegtsmux/tsmux/Makefile
gst/mpegpsmux/Makefile
gst/mve/Makefile
gst/mxf/Makefile
gst/netsim/Makefile
gst/nuvdemux/Makefile
gst/onvif/Makefile
gst/patchdetect/Makefile
......
plugin_LTLIBRARIES = libgstnetsim.la
libgstnetsim_la_SOURCES = gstnetsim.c
libgstnetsim_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
libgstnetsim_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS)
libgstnetsim_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstnetsim_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
noinst_HEADERS = gstnetsim.h
This diff is collapsed.
/*
* Farsight Voice+Video library
*
* Copyright 2006 Collabora Ltd,
* Copyright 2006 Nokia Corporation
* @author: Philippe Kalaf <philippe.kalaf@collabora.co.uk>.
*
* 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.
*
*/
#ifndef __GST_NET_SIM_H__
#define __GST_NET_SIM_H__
#include <gst/gst.h>
G_BEGIN_DECLS
/* #define's don't like whitespacey bits */
#define GST_TYPE_NET_SIM \
(gst_net_sim_get_type())
#define GST_NET_SIM(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
GST_TYPE_NET_SIM,GstNetSim))
#define GST_NET_SIM_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
GST_TYPE_NET_SIM,GstNetSimClass))
#define GST_IS_NET_SIM(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_NET_SIM))
#define GST_IS_NET_SIM_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_NET_SIM))
typedef struct _GstNetSim GstNetSim;
typedef struct _GstNetSimClass GstNetSimClass;
typedef struct _GstNetSimPrivate GstNetSimPrivate;
struct _GstNetSim
{
GstElement parent;
GstNetSimPrivate *priv;
/*< private > */
gpointer _gst_reserved[GST_PADDING];
};
struct _GstNetSimClass
{
GstElementClass parent_class;
/*< private > */
gpointer _gst_reserved[GST_PADDING];
};
GType gst_net_sim_get_type (void);
G_END_DECLS
#endif /* __GST_NET_SIM_H__ */
......@@ -284,6 +284,7 @@ check_PROGRAMS = \
$(check_mpg123) \
elements/mxfdemux \
elements/mxfmux \
elements/netsim \
elements/pcapparse \
elements/rtponvifparse \
elements/rtponviftimestamp \
......
#include <gst/check/gstharness.h>
#include <gst/check/gstcheck.h>
GST_START_TEST (netsim_stress)
{
GstHarness *h = gst_harness_new ("netsim");
GstCaps *caps = gst_caps_from_string ("mycaps");
GstBuffer *buf = gst_harness_create_buffer (h, 100);
GstHarnessThread *state, *push;
GstSegment segment;
gst_segment_init (&segment, GST_FORMAT_TIME);
state = gst_harness_stress_statechange_start (h);
push = gst_harness_stress_push_buffer_start (h, caps, &segment, buf);
g_usleep (G_USEC_PER_SEC * 1);
gst_harness_stress_thread_stop (state);
gst_harness_stress_thread_stop (push);
gst_caps_unref (caps);
gst_buffer_unref (buf);
gst_harness_teardown (h);
}
GST_END_TEST;
GST_START_TEST (netsim_stress_delayed)
{
GstHarness *h = gst_harness_new_parse ("netsim delay-probability=0.5");
GstCaps *caps = gst_caps_from_string ("mycaps");
GstBuffer *buf = gst_harness_create_buffer (h, 100);
GstHarnessThread *state, *push;
GstSegment segment;
gst_segment_init (&segment, GST_FORMAT_TIME);
state = gst_harness_stress_statechange_start (h);
push = gst_harness_stress_push_buffer_start (h, caps, &segment, buf);
g_usleep (G_USEC_PER_SEC * 1);
gst_harness_stress_thread_stop (state);
gst_harness_stress_thread_stop (push);
gst_caps_unref (caps);
gst_buffer_unref (buf);
gst_harness_teardown (h);
}
GST_END_TEST;
static Suite *
netsim_suite (void)
{
Suite *s = suite_create ("netsim");
TCase *tc_chain;
suite_add_tcase (s, (tc_chain = tcase_create ("general")));
tcase_add_test (tc_chain, netsim_stress);
tcase_add_test (tc_chain, netsim_stress_delayed);
return s;
}
GST_CHECK_MAIN (netsim)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment