[gstreamer-bugs] [Bug 625597] gst-rtsp-server needs to send EOS on client session end so that elements such as 'filesink' are satisfied

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Wed Sep 22 12:25:22 PDT 2010


https://bugzilla.gnome.org/show_bug.cgi?id=625597
  GStreamer | gst-rtsp-server | git

Robert Krakora <rob.krakora> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |INCOMPLETE

--- Comment #10 from Robert Krakora <rob.krakora at messagenetsystems.com> 2010-09-22 19:25:18 UTC ---
Hi Wim,

I tested your fix for EOS and it worked great with one client.  However, with
two clients it sent the EOS when one client was exited and killed the pipe line
for the other client.

I hacked on the code a bit and was able to get the behavior that I was
expecting with more than one client.  Let me know if I am just misusing the
RTSP server or if this is a legitimate problem.  The hack is not meant to be a
permanent fix, just to show you where there may be a problem.

Here is the hack-patch:

diff --git a/gst/rtsp-server/rtsp-media.c b/gst/rtsp-server/rtsp-media.c
old mode 100644
new mode 100755
index c6a45ac..4ccd172
--- a/gst/rtsp-server/rtsp-media.c
+++ b/gst/rtsp-server/rtsp-media.c
@@ -27,7 +27,7 @@

 #define DEFAULT_SHARED         FALSE
 #define DEFAULT_REUSABLE       FALSE
-#define DEFAULT_PROTOCOLS      GST_RTSP_LOWER_TRANS_UDP |
GST_RTSP_LOWER_TRANS_TCP
+#define DEFAULT_PROTOCOLS      GST_RTSP_LOWER_TRANS_UDP |
GST_RTSP_LOWER_TRANS_TCP
 //#define DEFAULT_PROTOCOLS      GST_RTSP_LOWER_TRANS_UDP_MCAST
 #define DEFAULT_EOS_SHUTDOWN   FALSE

@@ -129,6 +129,7 @@ gst_rtsp_media_init (GstRTSPMedia * media)
   media->cond = g_cond_new ();

   media->shared = DEFAULT_SHARED;
+  media->shared_cnt = 0;
   media->reusable = DEFAULT_REUSABLE;
   media->protocols = DEFAULT_PROTOCOLS;
   media->eos_shutdown = DEFAULT_EOS_SHUTDOWN;
@@ -1496,7 +1497,11 @@ gst_rtsp_media_prepare (GstRTSPMedia * media)
   GList *walk;

   if (media->status == GST_RTSP_MEDIA_STATUS_PREPARED)
+  {
+    if (media->shared)
+      media->shared_cnt++;
     goto was_prepared;
+  }

   if (!media->reusable && media->reused)
     goto is_reused;
@@ -1643,7 +1648,10 @@ gst_rtsp_media_unprepare (GstRTSPMedia * media)
 static gboolean
 default_unprepare (GstRTSPMedia * media)
 {
-  if (media->eos_shutdown) {
+  if (media->shared && media->shared_cnt > 0)
+    media->shared_cnt--;
+
+  if (media->eos_shutdown && media->shared_cnt == 0) {
     GST_DEBUG ("sending EOS for shutdown");
     /* ref so that we don't disappear */
     g_object_ref (media);
@@ -1656,6 +1664,7 @@ default_unprepare (GstRTSPMedia * media)
     GST_DEBUG ("shutting down");
     gst_element_set_state (media->pipeline, GST_STATE_NULL);
   }
+
   return TRUE;
 }

@@ -1664,11 +1673,11 @@ add_udp_destination (GstRTSPMedia *media,
GstRTSPMediaStream *stream,
     gchar *dest, gint min, gint max)
 {
   gboolean do_add = TRUE;
-  RTSPDestination *ndest;
+  RTSPDestination *ndest = NULL;

   if (stream->filter_duplicates) {
     RTSPDestination fdest;
-    GList *find;
+    GList *find = NULL;

     fdest.dest = dest;
     fdest.min = min;
@@ -1702,8 +1711,8 @@ remove_udp_destination (GstRTSPMedia *media,
GstRTSPMediaStream *stream,
     gchar *dest, gint min, gint max)
 {
   gboolean do_remove = TRUE;
-  RTSPDestination *ndest;
-  GList *find;
+  RTSPDestination *ndest = NULL;
+  GList *find = NULL;

   if (stream->filter_duplicates) {
     RTSPDestination fdest;
diff --git a/gst/rtsp-server/rtsp-media.h b/gst/rtsp-server/rtsp-media.h
old mode 100644
new mode 100755
index 211e2c0..081436b
--- a/gst/rtsp-server/rtsp-media.h
+++ b/gst/rtsp-server/rtsp-media.h
@@ -196,6 +196,7 @@ struct _GstRTSPMedia {
   GCond             *cond;

   gboolean           shared;
+  gint               shared_cnt;
   gboolean           reusable;
   GstRTSPLowerTrans  protocols;
   gboolean           reused;

Best Regards,

Rob Krakora

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.




More information about the Gstreamer-bugs mailing list