mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-27 01:28:34 +00:00
tests/check: improve rtpcollision::test_master_ssrc_collision to ensure that a collision does not BYE the whole session
Conflicts: tests/check/elements/rtpcollision.c
This commit is contained in:
parent
7b001e35ed
commit
d562263852
1 changed files with 19 additions and 16 deletions
|
@ -109,8 +109,8 @@ create_rtcp_app (guint32 ssrc)
|
||||||
return rtcp_buffer;
|
return rtcp_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint ssrc_before;
|
static guint nb_ssrc_changes;
|
||||||
static guint ssrc_after;
|
static guint ssrc_prev;
|
||||||
|
|
||||||
static GstPadProbeReturn
|
static GstPadProbeReturn
|
||||||
rtpsession_sinkpad_probe (GstPad * pad, GstPadProbeInfo * info,
|
rtpsession_sinkpad_probe (GstPad * pad, GstPadProbeInfo * info,
|
||||||
|
@ -121,31 +121,31 @@ rtpsession_sinkpad_probe (GstPad * pad, GstPadProbeInfo * info,
|
||||||
if (info->type == (GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_PUSH)) {
|
if (info->type == (GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_PUSH)) {
|
||||||
GstBuffer *buffer = GST_BUFFER (info->data);
|
GstBuffer *buffer = GST_BUFFER (info->data);
|
||||||
GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
|
GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
|
||||||
|
GstBuffer *rtcp_buffer = 0;
|
||||||
static gint i = 0;
|
guint ssrc = 0;
|
||||||
|
|
||||||
/* retrieve current ssrc */
|
/* retrieve current ssrc */
|
||||||
gst_rtp_buffer_map (buffer, GST_MAP_READ, &rtp);
|
gst_rtp_buffer_map (buffer, GST_MAP_READ, &rtp);
|
||||||
if (i < 3)
|
ssrc = gst_rtp_buffer_get_ssrc (&rtp);
|
||||||
ssrc_before = gst_rtp_buffer_get_ssrc (&rtp);
|
|
||||||
else
|
|
||||||
ssrc_after = gst_rtp_buffer_get_ssrc (&rtp);
|
|
||||||
gst_rtp_buffer_unmap (&rtp);
|
gst_rtp_buffer_unmap (&rtp);
|
||||||
|
|
||||||
|
/* if not first buffer, check that our ssrc has changed */
|
||||||
|
if (ssrc_prev != -1 && ssrc != ssrc_prev)
|
||||||
|
++nb_ssrc_changes;
|
||||||
|
|
||||||
|
/* update prev ssrc */
|
||||||
|
ssrc_prev = ssrc;
|
||||||
|
|
||||||
/* feint a collision on recv_rtcp_sink pad of gstrtpsession
|
/* feint a collision on recv_rtcp_sink pad of gstrtpsession
|
||||||
* (note that after being marked as collied the rtpsession ignores
|
* (note that after being marked as collied the rtpsession ignores
|
||||||
* all non bye packets)
|
* all non bye packets)
|
||||||
*/
|
*/
|
||||||
if (i == 2) {
|
rtcp_buffer = create_rtcp_app (ssrc);
|
||||||
GstBuffer *rtcp_buffer = create_rtcp_app (ssrc_before);
|
|
||||||
|
|
||||||
/* push collied packet on recv_rtcp_sink */
|
/* push collied packet on recv_rtcp_sink */
|
||||||
gst_pad_push (srcpad, rtcp_buffer);
|
gst_pad_push (srcpad, rtcp_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,6 +175,9 @@ GST_START_TEST (test_master_ssrc_collision)
|
||||||
|
|
||||||
GST_INFO ("preparing test");
|
GST_INFO ("preparing test");
|
||||||
|
|
||||||
|
nb_ssrc_changes = 0;
|
||||||
|
ssrc_prev = -1;
|
||||||
|
|
||||||
/* build pipeline */
|
/* build pipeline */
|
||||||
bin = gst_pipeline_new ("pipeline");
|
bin = gst_pipeline_new ("pipeline");
|
||||||
bus = gst_element_get_bus (bin);
|
bus = gst_element_get_bus (bin);
|
||||||
|
@ -256,7 +259,7 @@ GST_START_TEST (test_master_ssrc_collision)
|
||||||
gst_object_unref (bin);
|
gst_object_unref (bin);
|
||||||
|
|
||||||
/* check results */
|
/* check results */
|
||||||
fail_if (ssrc_before == ssrc_after);
|
fail_unless_equals_int (nb_ssrc_changes, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
Loading…
Reference in a new issue