[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gstreamer-cvs
Subject:    gst-plugins-base: rtspconnection: Protect readsrc, writesrc and controllsrc with a mutex
From:       slomo () kemper ! freedesktop ! org (Sebastian Dröge)
Date:       2014-08-29 8:29:30
Message-ID: 20140829082930.11361761F1 () kemper ! freedesktop ! org
[Download RAW message or body]

Module: gst-plugins-base
Branch: master
Commit: acdb7feacf5253b661b0c0e5ce5283cb85483849
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=acdb7feacf5253b661b0c0e5ce5283cb85483849


Author: Göran Jönsson <goranjn@axis.com>
Date:   Wed Aug 27 13:45:57 2014 +0200

rtspconnection: Protect readsrc, writesrc and controllsrc with a mutex

Fixes a crash when controlsrc, readsrc or writesrc are modified from
gst_rtsp_source_dispatch_read/write and gst_rtsp_watch_reset at the
same time.

https://bugzilla.gnome.org/show_bug.cgi?id=735569

---

 gst-libs/gst/rtsp/gstrtspconnection.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gst-libs/gst/rtsp/gstrtspconnection.c \
b/gst-libs/gst/rtsp/gstrtspconnection.c index 2218921..da969f0 100644
--- a/gst-libs/gst/rtsp/gstrtspconnection.c
+++ b/gst-libs/gst/rtsp/gstrtspconnection.c
@@ -3127,6 +3127,7 @@ gst_rtsp_source_dispatch_read (GPollableInputStream * stream,
   if (res == GST_RTSP_EINTR)
     goto done;
   else if (G_UNLIKELY (res == GST_RTSP_EEOF)) {
+    g_mutex_lock (&watch->mutex);
     if (watch->readsrc) {
       g_source_remove_child_source ((GSource *) watch, watch->readsrc);
       g_source_unref (watch->readsrc);
@@ -3139,6 +3140,7 @@ gst_rtsp_source_dispatch_read (GPollableInputStream * stream,
       conn->socket1 = NULL;
       conn->input_stream = NULL;
     }
+    g_mutex_unlock (&watch->mutex);
 
     /* When we are in tunnelled mode, the read socket can be closed and we
      * should be prepared for a new POST method to reopen it */
@@ -3150,6 +3152,7 @@ gst_rtsp_source_dispatch_read (GPollableInputStream * stream,
       if (watch->funcs.tunnel_lost)
         res = watch->funcs.tunnel_lost (watch, watch->user_data);
       /* we add read source on the write socket able to detect when client closes \
get channel in tunneled mode */ +      g_mutex_lock (&watch->mutex);
       if (watch->conn->control_stream && !watch->controlsrc) {
         watch->controlsrc =
             g_pollable_input_stream_create_source (G_POLLABLE_INPUT_STREAM
@@ -3159,6 +3162,7 @@ gst_rtsp_source_dispatch_read (GPollableInputStream * stream,
             NULL);
         g_source_add_child_source ((GSource *) watch, watch->controlsrc);
       }
+      g_mutex_unlock (&watch->mutex);
       goto read_done;
     } else
       goto eof;
@@ -3471,6 +3475,7 @@ gst_rtsp_watch_new (GstRTSPConnection * conn,
 void
 gst_rtsp_watch_reset (GstRTSPWatch * watch)
 {
+  g_mutex_lock (&watch->mutex);
   if (watch->readsrc) {
     g_source_remove_child_source ((GSource *) watch, watch->readsrc);
     g_source_unref (watch->readsrc);
@@ -3513,6 +3518,7 @@ gst_rtsp_watch_reset (GstRTSPWatch * watch)
   } else {
     watch->controlsrc = NULL;
   }
+  g_mutex_unlock (&watch->mutex);
 }
 
 /**



_______________________________________________
gstreamer-commits mailing list
gstreamer-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/gstreamer-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic