static void lose_and_recover_test (GstHarness * h, guint16 lost_seq, gconstpointer recbuf, gsize recbuf_size) { guint64 duration = 222222; guint64 timestamp = 111111; GstBuffer *bufout; push_lost_event (h, lost_seq, timestamp, duration, FALSE); bufout = gst_harness_pull (h); fail_unless_equals_int (gst_buffer_get_size (bufout), recbuf_size); fail_unless_equals_int (GST_BUFFER_PTS (bufout), timestamp); fail_unless (gst_buffer_memcmp (bufout, 0, recbuf, recbuf_size) == 0); fail_unless (!GST_BUFFER_FLAG_IS_SET (bufout, GST_RTP_BUFFER_FLAG_REDUNDANT)); gst_buffer_unref (bufout); /* Pushing the next buffer with discont flag set */ bufout = gst_buffer_new (); GST_BUFFER_FLAG_SET (bufout, GST_BUFFER_FLAG_DISCONT); bufout = gst_harness_push_and_pull (h, bufout); /* Checking the flag was unset */ fail_unless (!GST_BUFFER_IS_DISCONT (bufout)); gst_buffer_unref (bufout); }
static void rtp_jpeg_do_packet_loss (gdouble prob, gint num_expected) { GstHarness *h; gboolean eos = FALSE; gchar *s; guint i, buffer_count; s = g_strdup_printf ("videotestsrc pattern=ball num-buffers=100 ! " "jpegenc quality=50 ! rtpjpegpay ! identity drop-probability=%g ! " "rtpjpegdepay", prob); GST_INFO ("running pipeline %s", s); h = gst_harness_new_parse (s); g_free (s); gst_harness_play (h); do { GstEvent *event; event = gst_harness_pull_event (h); eos = (GST_EVENT_TYPE (event) == GST_EVENT_EOS); gst_event_unref (event); } while (!eos); buffer_count = gst_harness_buffers_received (h); GST_INFO ("Got %u buffers", buffer_count); if (num_expected >= 0) { fail_unless_equals_int (num_expected, buffer_count); } for (i = 0; i < buffer_count; ++i) { GstBuffer *buf; GstMapInfo map; guint16 soi, eoi; buf = gst_harness_pull (h); fail_unless (buf != NULL); fail_unless (gst_buffer_map (buf, &map, GST_MAP_READ)); GST_MEMDUMP ("jpeg frame", map.data, map.size); fail_unless (map.size > 4); soi = GST_READ_UINT16_BE (map.data); fail_unless (soi == 0xffd8, "expected JPEG frame start FFD8 not %02X", soi); eoi = GST_READ_UINT16_BE (map.data + map.size - 2); fail_unless (eoi == 0xffd9, "expected JPEG frame end FFD9 not %02X", eoi); gst_buffer_unmap (buf, &map); gst_buffer_unref (buf); } gst_harness_teardown (h); }
static GstBuffer * session_harness_pull_rtcp (SessionHarness * h) { return gst_harness_pull (h->rtcp_h); }