summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gst/rtsp-server/rtsp-media.c29
-rw-r--r--gst/rtsp-server/rtsp-stream.c48
-rw-r--r--gst/rtsp-server/rtsp-stream.h6
3 files changed, 78 insertions, 5 deletions
diff --git a/gst/rtsp-server/rtsp-media.c b/gst/rtsp-server/rtsp-media.c
index 4b1e76a..93db2b7 100644
--- a/gst/rtsp-server/rtsp-media.c
+++ b/gst/rtsp-server/rtsp-media.c
@@ -672,6 +672,25 @@ default_create_rtpbin (GstRTSPMedia * media)
return rtpbin;
}
+static gboolean
+is_receive_only (GstRTSPMedia * media)
+{
+ GstRTSPMediaPrivate *priv = media->priv;
+ gboolean recive_only = TRUE;
+ guint i;
+
+ for (i = 0; i < priv->streams->len; i++) {
+ GstRTSPStream *stream = g_ptr_array_index (priv->streams, i);
+ if (gst_rtsp_stream_is_sender (stream) ||
+ !gst_rtsp_stream_is_receiver (stream)) {
+ recive_only = FALSE;
+ break;
+ }
+ }
+
+ return recive_only;
+}
+
/* must be called with state lock */
static void
check_seekable (GstRTSPMedia * media)
@@ -680,8 +699,8 @@ check_seekable (GstRTSPMedia * media)
GstRTSPMediaPrivate *priv = media->priv;
/* Update the seekable state of the pipeline in case it changed */
- if ((priv->transport_mode & GST_RTSP_TRANSPORT_MODE_RECORD)) {
- /* TODO: Seeking for RECORD? */
+ if (is_receive_only (media)) {
+ /* TODO: Seeking for "receive-only"? */
priv->seekable = -1;
} else {
guint i, n = priv->streams->len;
@@ -2640,8 +2659,8 @@ default_handle_message (GstRTSPMedia * media, GstMessage * message)
GST_DEBUG ("%p: went from %s to %s (pending %s)", media,
gst_element_state_get_name (old), gst_element_state_get_name (new),
gst_element_state_get_name (pending));
- if ((priv->transport_mode & GST_RTSP_TRANSPORT_MODE_RECORD)
- && old == GST_STATE_READY && new == GST_STATE_PAUSED) {
+ if (priv->no_more_pads_pending == 0 && is_receive_only (media) &&
+ old == GST_STATE_READY && new == GST_STATE_PAUSED) {
GST_INFO ("%p: went to PAUSED, prepared now", media);
collect_media_stats (media);
@@ -3851,7 +3870,7 @@ default_unsuspend (GstRTSPMedia * media)
switch (priv->suspend_mode) {
case GST_RTSP_SUSPEND_MODE_NONE:
- if ((priv->transport_mode & GST_RTSP_TRANSPORT_MODE_RECORD))
+ if (is_receive_only (media))
break;
if (media_streams_blocking (media)) {
gst_rtsp_media_set_status (media, GST_RTSP_MEDIA_STATUS_PREPARING);
diff --git a/gst/rtsp-server/rtsp-stream.c b/gst/rtsp-server/rtsp-stream.c
index 4a3d44c..941cf4a 100644
--- a/gst/rtsp-server/rtsp-stream.c
+++ b/gst/rtsp-server/rtsp-stream.c
@@ -4586,3 +4586,51 @@ gst_rtsp_stream_is_complete (GstRTSPStream * stream)
return ret;
}
+
+/**
+ * gst_rtsp_stream_is_sender:
+ * @stream: a #GstRTSPStream
+ *
+ * Checks whether the stream is a sender.
+ *
+ * Returns: %TRUE if the stream is a sender and %FALSE otherwise.
+ */
+gboolean
+gst_rtsp_stream_is_sender (GstRTSPStream * stream)
+{
+ GstRTSPStreamPrivate *priv;
+ gboolean ret = FALSE;
+
+ g_return_val_if_fail (GST_IS_RTSP_STREAM (stream), FALSE);
+
+ priv = stream->priv;
+ g_mutex_lock (&priv->lock);
+ ret = (priv->srcpad != NULL);
+ g_mutex_unlock (&priv->lock);
+
+ return ret;
+}
+
+/**
+ * gst_rtsp_stream_is_receiver:
+ * @stream: a #GstRTSPStream
+ *
+ * Checks whether the stream is a receiver.
+ *
+ * Returns: %TRUE if the stream is a receiver and %FALSE otherwise.
+ */
+gboolean
+gst_rtsp_stream_is_receiver (GstRTSPStream * stream)
+{
+ GstRTSPStreamPrivate *priv;
+ gboolean ret = FALSE;
+
+ g_return_val_if_fail (GST_IS_RTSP_STREAM (stream), FALSE);
+
+ priv = stream->priv;
+ g_mutex_lock (&priv->lock);
+ ret = (priv->sinkpad != NULL);
+ g_mutex_unlock (&priv->lock);
+
+ return ret;
+}
diff --git a/gst/rtsp-server/rtsp-stream.h b/gst/rtsp-server/rtsp-stream.h
index 3583d4a..dc248d1 100644
--- a/gst/rtsp-server/rtsp-stream.h
+++ b/gst/rtsp-server/rtsp-stream.h
@@ -293,6 +293,12 @@ gboolean gst_rtsp_stream_complete_stream (GstRTSPStream * stream, const
GST_EXPORT
gboolean gst_rtsp_stream_is_complete (GstRTSPStream * stream);
+GST_EXPORT
+gboolean gst_rtsp_stream_is_sender (GstRTSPStream * stream);
+
+GST_EXPORT
+gboolean gst_rtsp_stream_is_receiver (GstRTSPStream * stream);
+
/**
* GstRTSPStreamTransportFilterFunc:
* @stream: a #GstRTSPStream object