mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 11:32:38 +00:00
rtsp-stream: explicitly set caps on udpsrc elements
This causes them to send caps events before data flow, which is usually a pretty correct thing to do! Not doing so manifested in a bug where ssrcdemux wouldn't forward the caps it had received with an extra ssrc field, as it hadn't received any caps event. Fixes #85 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/141>
This commit is contained in:
parent
60d8ed7d4f
commit
34590b342e
1 changed files with 53 additions and 8 deletions
|
@ -3635,13 +3635,17 @@ static gboolean
|
||||||
create_receiver_part (GstRTSPStream * stream, const GstRTSPTransport *
|
create_receiver_part (GstRTSPStream * stream, const GstRTSPTransport *
|
||||||
transport)
|
transport)
|
||||||
{
|
{
|
||||||
|
gboolean ret = FALSE;
|
||||||
GstRTSPStreamPrivate *priv;
|
GstRTSPStreamPrivate *priv;
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
GstBin *bin;
|
GstBin *bin;
|
||||||
gboolean tcp;
|
gboolean tcp;
|
||||||
gboolean udp;
|
gboolean udp;
|
||||||
gboolean mcast;
|
gboolean mcast;
|
||||||
|
gboolean secure;
|
||||||
gint i;
|
gint i;
|
||||||
|
GstCaps *rtp_caps;
|
||||||
|
GstCaps *rtcp_caps;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (stream, "create receiver part");
|
GST_DEBUG_OBJECT (stream, "create receiver part");
|
||||||
priv = stream->priv;
|
priv = stream->priv;
|
||||||
|
@ -3650,6 +3654,20 @@ create_receiver_part (GstRTSPStream * stream, const GstRTSPTransport *
|
||||||
tcp = transport->lower_transport == GST_RTSP_LOWER_TRANS_TCP;
|
tcp = transport->lower_transport == GST_RTSP_LOWER_TRANS_TCP;
|
||||||
udp = transport->lower_transport == GST_RTSP_LOWER_TRANS_UDP;
|
udp = transport->lower_transport == GST_RTSP_LOWER_TRANS_UDP;
|
||||||
mcast = transport->lower_transport == GST_RTSP_LOWER_TRANS_UDP_MCAST;
|
mcast = transport->lower_transport == GST_RTSP_LOWER_TRANS_UDP_MCAST;
|
||||||
|
secure = (priv->profiles & GST_RTSP_PROFILE_SAVP)
|
||||||
|
|| (priv->profiles & GST_RTSP_PROFILE_SAVPF);
|
||||||
|
|
||||||
|
if (secure) {
|
||||||
|
rtp_caps = gst_caps_new_empty_simple ("application/x-srtp");
|
||||||
|
rtcp_caps = gst_caps_new_empty_simple ("application/x-srtcp");
|
||||||
|
} else {
|
||||||
|
rtp_caps = gst_caps_new_empty_simple ("application/x-rtp");
|
||||||
|
rtcp_caps = gst_caps_new_empty_simple ("application/x-rtcp");
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (stream,
|
||||||
|
"RTP caps: %" GST_PTR_FORMAT " RTCP caps: %" GST_PTR_FORMAT, rtp_caps,
|
||||||
|
rtcp_caps);
|
||||||
|
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
/* For the receiver we create this bit of pipeline for both
|
/* For the receiver we create this bit of pipeline for both
|
||||||
|
@ -3696,7 +3714,13 @@ create_receiver_part (GstRTSPStream * stream, const GstRTSPTransport *
|
||||||
GST_DEBUG_OBJECT (stream, "udp IPv4, create and configure udpsources");
|
GST_DEBUG_OBJECT (stream, "udp IPv4, create and configure udpsources");
|
||||||
if (!create_and_configure_udpsource (&priv->udpsrc_v4[i],
|
if (!create_and_configure_udpsource (&priv->udpsrc_v4[i],
|
||||||
priv->socket_v4[i]))
|
priv->socket_v4[i]))
|
||||||
goto udpsrc_error;
|
goto done;
|
||||||
|
|
||||||
|
if (i == 0) {
|
||||||
|
g_object_set (priv->udpsrc_v4[i], "caps", rtp_caps, NULL);
|
||||||
|
} else {
|
||||||
|
g_object_set (priv->udpsrc_v4[i], "caps", rtcp_caps, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
plug_src (stream, bin, priv->udpsrc_v4[i], priv->funnel[i]);
|
plug_src (stream, bin, priv->udpsrc_v4[i], priv->funnel[i]);
|
||||||
}
|
}
|
||||||
|
@ -3705,7 +3729,13 @@ create_receiver_part (GstRTSPStream * stream, const GstRTSPTransport *
|
||||||
GST_DEBUG_OBJECT (stream, "udp IPv6, create and configure udpsources");
|
GST_DEBUG_OBJECT (stream, "udp IPv6, create and configure udpsources");
|
||||||
if (!create_and_configure_udpsource (&priv->udpsrc_v6[i],
|
if (!create_and_configure_udpsource (&priv->udpsrc_v6[i],
|
||||||
priv->socket_v6[i]))
|
priv->socket_v6[i]))
|
||||||
goto udpsrc_error;
|
goto done;
|
||||||
|
|
||||||
|
if (i == 0) {
|
||||||
|
g_object_set (priv->udpsrc_v6[i], "caps", rtp_caps, NULL);
|
||||||
|
} else {
|
||||||
|
g_object_set (priv->udpsrc_v6[i], "caps", rtcp_caps, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
plug_src (stream, bin, priv->udpsrc_v6[i], priv->funnel[i]);
|
plug_src (stream, bin, priv->udpsrc_v6[i], priv->funnel[i]);
|
||||||
}
|
}
|
||||||
|
@ -3714,7 +3744,14 @@ create_receiver_part (GstRTSPStream * stream, const GstRTSPTransport *
|
||||||
GST_DEBUG_OBJECT (stream, "mcast IPv4, create and configure udpsources");
|
GST_DEBUG_OBJECT (stream, "mcast IPv4, create and configure udpsources");
|
||||||
if (!create_and_configure_udpsource (&priv->mcast_udpsrc_v4[i],
|
if (!create_and_configure_udpsource (&priv->mcast_udpsrc_v4[i],
|
||||||
priv->mcast_socket_v4[i]))
|
priv->mcast_socket_v4[i]))
|
||||||
goto mcast_udpsrc_error;
|
goto done;
|
||||||
|
|
||||||
|
if (i == 0) {
|
||||||
|
g_object_set (priv->mcast_udpsrc_v4[i], "caps", rtp_caps, NULL);
|
||||||
|
} else {
|
||||||
|
g_object_set (priv->mcast_udpsrc_v4[i], "caps", rtcp_caps, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
plug_src (stream, bin, priv->mcast_udpsrc_v4[i], priv->funnel[i]);
|
plug_src (stream, bin, priv->mcast_udpsrc_v4[i], priv->funnel[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3722,7 +3759,14 @@ create_receiver_part (GstRTSPStream * stream, const GstRTSPTransport *
|
||||||
GST_DEBUG_OBJECT (stream, "mcast IPv6, create and configure udpsources");
|
GST_DEBUG_OBJECT (stream, "mcast IPv6, create and configure udpsources");
|
||||||
if (!create_and_configure_udpsource (&priv->mcast_udpsrc_v6[i],
|
if (!create_and_configure_udpsource (&priv->mcast_udpsrc_v6[i],
|
||||||
priv->mcast_socket_v6[i]))
|
priv->mcast_socket_v6[i]))
|
||||||
goto mcast_udpsrc_error;
|
goto done;
|
||||||
|
|
||||||
|
if (i == 0) {
|
||||||
|
g_object_set (priv->mcast_udpsrc_v6[i], "caps", rtp_caps, NULL);
|
||||||
|
} else {
|
||||||
|
g_object_set (priv->mcast_udpsrc_v6[i], "caps", rtcp_caps, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
plug_src (stream, bin, priv->mcast_udpsrc_v6[i], priv->funnel[i]);
|
plug_src (stream, bin, priv->mcast_udpsrc_v6[i], priv->funnel[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3738,11 +3782,12 @@ create_receiver_part (GstRTSPStream * stream, const GstRTSPTransport *
|
||||||
gst_element_sync_state_with_parent (priv->funnel[i]);
|
gst_element_sync_state_with_parent (priv->funnel[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
ret = TRUE;
|
||||||
|
|
||||||
mcast_udpsrc_error:
|
done:
|
||||||
udpsrc_error:
|
gst_caps_unref (rtp_caps);
|
||||||
return FALSE;
|
gst_caps_unref (rtcp_caps);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
Loading…
Reference in a new issue