mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
rtspsrc: skip streams with same control url
Keep track of what streams we did the SETUP for. We only need to configure caps, wait for pads and push events on setup streams. We can remove the disabled state of the stream and simplify some checks. After we setup a stream, skip the other streams that have the same control url. Use a skipped flag to mark streams that should be skipped.
This commit is contained in:
parent
3b27fc2f0f
commit
224239096d
2 changed files with 42 additions and 11 deletions
|
@ -1415,7 +1415,8 @@ gst_rtspsrc_create_stream (GstRTSPSrc * src, GstSDPMessage * sdp, gint idx)
|
||||||
* the element. */
|
* the element. */
|
||||||
stream->last_ret = GST_FLOW_NOT_LINKED;
|
stream->last_ret = GST_FLOW_NOT_LINKED;
|
||||||
stream->added = FALSE;
|
stream->added = FALSE;
|
||||||
stream->disabled = FALSE;
|
stream->setup = FALSE;
|
||||||
|
stream->skipped = FALSE;
|
||||||
stream->id = idx;
|
stream->id = idx;
|
||||||
stream->eos = FALSE;
|
stream->eos = FALSE;
|
||||||
stream->discont = TRUE;
|
stream->discont = TRUE;
|
||||||
|
@ -2614,12 +2615,12 @@ new_manager_pad (GstElement * manager, GstPad * pad, GstRTSPSrc * src)
|
||||||
for (ostreams = src->streams; ostreams; ostreams = g_list_next (ostreams)) {
|
for (ostreams = src->streams; ostreams; ostreams = g_list_next (ostreams)) {
|
||||||
GstRTSPStream *ostream = (GstRTSPStream *) ostreams->data;
|
GstRTSPStream *ostream = (GstRTSPStream *) ostreams->data;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (src, "stream %p, container %d, disabled %d, added %d",
|
GST_DEBUG_OBJECT (src, "stream %p, container %d, added %d, setup %d",
|
||||||
ostream, ostream->container, ostream->disabled, ostream->added);
|
ostream, ostream->container, ostream->added, ostream->setup);
|
||||||
|
|
||||||
/* a container stream only needs one pad added. Also disabled streams don't
|
/* if we find a stream for which we did a setup that is not added, we
|
||||||
* count */
|
* need to wait some more */
|
||||||
if (!ostream->container && !ostream->disabled && !ostream->added) {
|
if (ostream->setup && !ostream->added) {
|
||||||
all_added = FALSE;
|
all_added = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3681,6 +3682,9 @@ gst_rtspsrc_configure_caps (GstRTSPSrc * src, GstSegment * segment,
|
||||||
GstRTSPStream *stream = (GstRTSPStream *) walk->data;
|
GstRTSPStream *stream = (GstRTSPStream *) walk->data;
|
||||||
guint j, len;
|
guint j, len;
|
||||||
|
|
||||||
|
if (!stream->setup)
|
||||||
|
continue;
|
||||||
|
|
||||||
len = stream->ptmap->len;
|
len = stream->ptmap->len;
|
||||||
for (j = 0; j < len; j++) {
|
for (j = 0; j < len; j++) {
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
@ -3755,7 +3759,7 @@ gst_rtspsrc_stream_push_event (GstRTSPSrc * src, GstRTSPStream * stream,
|
||||||
gboolean res = TRUE;
|
gboolean res = TRUE;
|
||||||
|
|
||||||
/* only streams that have a connection to the outside world */
|
/* only streams that have a connection to the outside world */
|
||||||
if (stream->container || stream->disabled)
|
if (!stream->setup)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
if (stream->udpsrc[0]) {
|
if (stream->udpsrc[0]) {
|
||||||
|
@ -5637,17 +5641,22 @@ gst_rtspsrc_setup_streams (GstRTSPSrc * src, gboolean async)
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
|
||||||
stream = (GstRTSPStream *) walk->data;
|
stream = (GstRTSPStream *) walk->data;
|
||||||
|
|
||||||
caps = stream_get_caps_for_pt (stream, stream->default_pt);
|
caps = stream_get_caps_for_pt (stream, stream->default_pt);
|
||||||
if (caps == NULL) {
|
if (caps == NULL) {
|
||||||
GST_DEBUG_OBJECT (src, "skipping stream %p, no caps", stream);
|
GST_DEBUG_OBJECT (src, "skipping stream %p, no caps", stream);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (stream->skipped) {
|
||||||
|
GST_DEBUG_OBJECT (src, "skipping stream %p", stream);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* see if we need to configure this stream */
|
/* see if we need to configure this stream */
|
||||||
if (!gst_rtsp_ext_list_configure_stream (src->extensions, caps)) {
|
if (!gst_rtsp_ext_list_configure_stream (src->extensions, caps)) {
|
||||||
GST_DEBUG_OBJECT (src, "skipping stream %p, disabled by extension",
|
GST_DEBUG_OBJECT (src, "skipping stream %p, disabled by extension",
|
||||||
stream);
|
stream);
|
||||||
stream->disabled = TRUE;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5655,10 +5664,8 @@ gst_rtspsrc_setup_streams (GstRTSPSrc * src, gboolean async)
|
||||||
stream->id, caps, &selected);
|
stream->id, caps, &selected);
|
||||||
if (!selected) {
|
if (!selected) {
|
||||||
GST_DEBUG_OBJECT (src, "skipping stream %p, disabled by signal", stream);
|
GST_DEBUG_OBJECT (src, "skipping stream %p, disabled by signal", stream);
|
||||||
stream->disabled = TRUE;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
stream->disabled = FALSE;
|
|
||||||
|
|
||||||
/* merge/overwrite global caps */
|
/* merge/overwrite global caps */
|
||||||
if (caps) {
|
if (caps) {
|
||||||
|
@ -5872,6 +5879,29 @@ gst_rtspsrc_setup_streams (GstRTSPSrc * src, gboolean async)
|
||||||
}
|
}
|
||||||
/* we need to activate at least one streams when we detect activity */
|
/* we need to activate at least one streams when we detect activity */
|
||||||
src->need_activate = TRUE;
|
src->need_activate = TRUE;
|
||||||
|
|
||||||
|
/* stream is setup now */
|
||||||
|
stream->setup = TRUE;
|
||||||
|
{
|
||||||
|
GList *skip = walk;
|
||||||
|
|
||||||
|
while (TRUE) {
|
||||||
|
GstRTSPStream *sskip;
|
||||||
|
|
||||||
|
skip = g_list_next (skip);
|
||||||
|
if (skip == NULL)
|
||||||
|
break;
|
||||||
|
|
||||||
|
sskip = (GstRTSPStream *) skip->data;
|
||||||
|
|
||||||
|
/* skip all streams with the same control url */
|
||||||
|
if (g_str_equal (stream->conninfo.location, sskip->conninfo.location)) {
|
||||||
|
GST_DEBUG_OBJECT (src, "found stream %p with same control %s",
|
||||||
|
sskip, sskip->conninfo.location);
|
||||||
|
sskip->skipped = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
next:
|
next:
|
||||||
/* clean up our transport struct */
|
/* clean up our transport struct */
|
||||||
gst_rtsp_transport_init (&transport);
|
gst_rtsp_transport_init (&transport);
|
||||||
|
|
|
@ -102,7 +102,8 @@ struct _GstRTSPStream {
|
||||||
GstPad *srcpad;
|
GstPad *srcpad;
|
||||||
GstFlowReturn last_ret;
|
GstFlowReturn last_ret;
|
||||||
gboolean added;
|
gboolean added;
|
||||||
gboolean disabled;
|
gboolean setup;
|
||||||
|
gboolean skipped;
|
||||||
gboolean eos;
|
gboolean eos;
|
||||||
gboolean discont;
|
gboolean discont;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue