mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-23 06:26:23 +00:00
tests: jitterbuffer: Demacroify some helpers
There is no reason for these to be macros anymore. This makes the test helper much more readable.
This commit is contained in:
parent
c917f11ae8
commit
a53ffb6e11
1 changed files with 65 additions and 51 deletions
|
@ -540,59 +540,73 @@ get_rtp_seq_num (GstBuffer * buf)
|
||||||
return seq;
|
return seq;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define verify_lost_event(h, exp_seq, exp_ts, exp_dur) \
|
static void
|
||||||
G_STMT_START { \
|
verify_lost_event (GstHarness * h, guint exp_seq, GstClockTime exp_ts,
|
||||||
GstEvent *_event; \
|
GstClockTime exp_dur)
|
||||||
const GstStructure *_s; \
|
{
|
||||||
const GValue *_value; \
|
GstEvent *event;
|
||||||
guint _seq; \
|
const GstStructure *s;
|
||||||
GstClockTime _ts; \
|
const GValue *value;
|
||||||
GstClockTime _dur; \
|
guint seq;
|
||||||
_event = gst_harness_pull_event (h); \
|
GstClockTime ts;
|
||||||
fail_unless (_event != NULL); \
|
GstClockTime dur;
|
||||||
_s = gst_event_get_structure (_event); \
|
|
||||||
fail_unless (_s != NULL); \
|
|
||||||
fail_unless (gst_structure_get_uint (_s, "seqnum", &_seq)); \
|
|
||||||
_value = gst_structure_get_value (_s, "timestamp"); \
|
|
||||||
fail_unless (_value && G_VALUE_HOLDS_UINT64 (_value)); \
|
|
||||||
_ts = g_value_get_uint64 (_value); \
|
|
||||||
_value = gst_structure_get_value (_s, "duration"); \
|
|
||||||
fail_unless (_value && G_VALUE_HOLDS_UINT64 (_value)); \
|
|
||||||
_dur = g_value_get_uint64 (_value); \
|
|
||||||
fail_unless_equals_int ((guint16)(exp_seq), _seq); \
|
|
||||||
fail_unless_equals_uint64 (exp_ts, _ts); \
|
|
||||||
fail_unless_equals_uint64 (exp_dur, _dur); \
|
|
||||||
gst_event_unref (_event); \
|
|
||||||
} G_STMT_END
|
|
||||||
|
|
||||||
|
event = gst_harness_pull_event (h);
|
||||||
|
fail_unless (event != NULL);
|
||||||
|
|
||||||
#define verify_rtx_event(h, exp_seq, exp_ts, exp_delay, exp_spacing) \
|
s = gst_event_get_structure (event);
|
||||||
G_STMT_START { \
|
fail_unless (s != NULL);
|
||||||
GstEvent *_event; \
|
fail_unless (gst_structure_get_uint (s, "seqnum", &seq));
|
||||||
const GstStructure *_s; \
|
|
||||||
const GValue *_value; \
|
value = gst_structure_get_value (s, "timestamp");
|
||||||
guint _seq; \
|
fail_unless (value && G_VALUE_HOLDS_UINT64 (value));
|
||||||
GstClockTime _ts; \
|
|
||||||
guint _delay; \
|
ts = g_value_get_uint64 (value);
|
||||||
GstClockTime _spacing; \
|
value = gst_structure_get_value (s, "duration");
|
||||||
_event = gst_harness_pull_upstream_event (h); \
|
fail_unless (value && G_VALUE_HOLDS_UINT64 (value));
|
||||||
fail_unless (_event != NULL); \
|
|
||||||
_s = gst_event_get_structure (_event); \
|
dur = g_value_get_uint64 (value);
|
||||||
fail_unless (_s != NULL); \
|
fail_unless_equals_int ((guint16) exp_seq, seq);
|
||||||
fail_unless (gst_structure_get_uint (_s, "seqnum", &_seq)); \
|
fail_unless_equals_uint64 (exp_ts, ts);
|
||||||
_value = gst_structure_get_value (_s, "running-time"); \
|
fail_unless_equals_uint64 (exp_dur, dur);
|
||||||
fail_unless (_value && G_VALUE_HOLDS_UINT64 (_value)); \
|
|
||||||
_ts = g_value_get_uint64 (_value); \
|
gst_event_unref (event);
|
||||||
fail_unless (gst_structure_get_uint (_s, "delay", &_delay)); \
|
}
|
||||||
_value = gst_structure_get_value (_s, "packet-spacing"); \
|
|
||||||
fail_unless (_value && G_VALUE_HOLDS_UINT64 (_value)); \
|
static void
|
||||||
_spacing = g_value_get_uint64 (_value); \
|
verify_rtx_event (GstHarness * h, guint exp_seq, GstClockTime exp_ts,
|
||||||
fail_unless_equals_int ((guint16)(exp_seq), _seq); \
|
gint exp_delay, GstClockTime exp_spacing)
|
||||||
fail_unless_equals_uint64 (exp_ts, _ts); \
|
{
|
||||||
fail_unless_equals_int (exp_delay, _delay); \
|
GstEvent *event;
|
||||||
fail_unless_equals_uint64 (exp_spacing, _spacing); \
|
const GstStructure *s;
|
||||||
gst_event_unref (_event); \
|
const GValue *value;
|
||||||
} G_STMT_END
|
guint seq;
|
||||||
|
GstClockTime ts;
|
||||||
|
guint delay;
|
||||||
|
GstClockTime spacing;
|
||||||
|
|
||||||
|
event = gst_harness_pull_upstream_event (h);
|
||||||
|
fail_unless (event != NULL);
|
||||||
|
|
||||||
|
s = gst_event_get_structure (event);
|
||||||
|
fail_unless (s != NULL);
|
||||||
|
fail_unless (gst_structure_get_uint (s, "seqnum", &seq));
|
||||||
|
|
||||||
|
value = gst_structure_get_value (s, "running-time");
|
||||||
|
fail_unless (value && G_VALUE_HOLDS_UINT64 (value));
|
||||||
|
|
||||||
|
ts = g_value_get_uint64 (value);
|
||||||
|
fail_unless (gst_structure_get_uint (s, "delay", &delay));
|
||||||
|
value = gst_structure_get_value (s, "packet-spacing");
|
||||||
|
fail_unless (value && G_VALUE_HOLDS_UINT64 (value));
|
||||||
|
spacing = g_value_get_uint64 (value);
|
||||||
|
fail_unless_equals_int ((guint16) exp_seq, seq);
|
||||||
|
fail_unless_equals_uint64 (exp_ts, ts);
|
||||||
|
fail_unless_equals_int (exp_delay, delay);
|
||||||
|
fail_unless_equals_uint64 (exp_spacing, spacing);
|
||||||
|
|
||||||
|
gst_event_unref (event);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
verify_jb_stats (GstElement * jb, GstStructure * expected)
|
verify_jb_stats (GstElement * jb, GstStructure * expected)
|
||||||
|
|
Loading…
Reference in a new issue