gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/asobj/NetConnection.cpp ...


From: Tomas Groth
Subject: [Gnash-commit] gnash ChangeLog server/asobj/NetConnection.cpp ...
Date: Mon, 05 Feb 2007 22:22:32 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Tomas Groth <tgc>       07/02/05 22:22:32

Modified files:
        .              : ChangeLog 
        server/asobj   : NetConnection.cpp NetStreamFfmpeg.cpp 
                         NetStreamFfmpeg.h NetStreamGst.cpp 
                         NetStreamGst.h 

Log message:
        * server/asobj/NetConnection.cpp: Make sure we don't setup a connection
          that already exists.
        * server/asobj/NetStreamFfmpeg.{cpp,h}: Fixed a potential hanging 
thread.
        * server/asobj/NetStreamGst.{cpp,h}: Switched from pthreads to boost.
          Fixed a potential hanging thread.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2252&r2=1.2253
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetConnection.cpp?cvsroot=gnash&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamFfmpeg.cpp?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamFfmpeg.h?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamGst.cpp?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamGst.h?cvsroot=gnash&r1=1.6&r2=1.7

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2252
retrieving revision 1.2253
diff -u -b -r1.2252 -r1.2253
--- ChangeLog   5 Feb 2007 20:24:54 -0000       1.2252
+++ ChangeLog   5 Feb 2007 22:22:32 -0000       1.2253
@@ -1,3 +1,11 @@
+2007-02-05 Tomas Groth Christensen <address@hidden>
+
+       * server/asobj/NetConnection.cpp: Make sure we don't setup a connection
+         that already exists.
+       * server/asobj/NetStreamFfmpeg.{cpp,h}: Fixed a potential hanging 
thread.
+       * server/asobj/NetStreamGst.{cpp,h}: Switched from pthreads to boost.
+         Fixed a potential hanging thread.
+
 2007-02-05 Sandro Santilli <address@hidden>
 
        * server/PropertyList.cpp: delete overridden properties in import();

Index: server/asobj/NetConnection.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetConnection.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- server/asobj/NetConnection.cpp      30 Jan 2007 12:49:03 -0000      1.20
+++ server/asobj/NetConnection.cpp      5 Feb 2007 22:22:32 -0000       1.21
@@ -14,7 +14,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: NetConnection.cpp,v 1.20 2007/01/30 12:49:03 strk Exp $ */
+/* $Id: NetConnection.cpp,v 1.21 2007/02/05 22:22:32 tgc Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -190,12 +190,16 @@
 /*public*/
 bool NetConnection::openConnection(const char* char_url, NetStream* ns)
 {
+
+       // if already running there is no need to setup things again
+       if (_running) return true;
+
        netStreamObj = ns;
        if (_url.size() > 0) {
                _url += "/";
        }
        _url += char_url;
-       _running = 1;
+       _running = true;
        _cache = NULL;
 
        localFile = false;

Index: server/asobj/NetStreamFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamFfmpeg.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- server/asobj/NetStreamFfmpeg.cpp    2 Feb 2007 20:41:55 -0000       1.12
+++ server/asobj/NetStreamFfmpeg.cpp    5 Feb 2007 22:22:32 -0000       1.13
@@ -14,7 +14,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: NetStreamFfmpeg.cpp,v 1.12 2007/02/02 20:41:55 tgc Exp $ */
+/* $Id: NetStreamFfmpeg.cpp,v 1.13 2007/02/05 22:22:32 tgc Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -101,17 +101,15 @@
                // terminate thread
                m_go = false;
 
+               startThread->join();
+               delete startThread;
+
                // wait till thread is complete before main continues
-               if (m_thread) {
                        m_thread->join();
                        delete m_thread;
-               }
 
        }
 
-       if (startThread) {
-               delete startThread;
-       }
 
        // When closing gnash before playback is finished, the soundhandler 
        // seems to be removed before netstream is destroyed.
@@ -406,6 +404,9 @@
 
        boost::mutex::scoped_lock  lock(ns->start_mutex);
 
+       // This should only happen if close() is called before setup is complete
+       if (!ns->m_go) return;
+
        ns->set_status("NetStream.Play.Start");
 
        raw_videodata_t* video = NULL;

Index: server/asobj/NetStreamFfmpeg.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamFfmpeg.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- server/asobj/NetStreamFfmpeg.h      2 Feb 2007 15:01:17 -0000       1.9
+++ server/asobj/NetStreamFfmpeg.h      5 Feb 2007 22:22:32 -0000       1.10
@@ -14,7 +14,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: NetStreamFfmpeg.h,v 1.9 2007/02/02 15:01:17 bjacques Exp $ */
+/* $Id: NetStreamFfmpeg.h,v 1.10 2007/02/05 22:22:32 tgc Exp $ */
 
 #ifndef __NETSTREAMFFMPEG_H__
 #define __NETSTREAMFFMPEG_H__
@@ -26,7 +26,6 @@
 #ifdef USE_FFMPEG
 
 #include <queue>
-//#include <pthread.h>
 #include <boost/thread/thread.hpp>
 #include <boost/bind.hpp> 
 #include <boost/thread/mutex.hpp>

Index: server/asobj/NetStreamGst.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamGst.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- server/asobj/NetStreamGst.cpp       30 Jan 2007 12:49:03 -0000      1.9
+++ server/asobj/NetStreamGst.cpp       5 Feb 2007 22:22:32 -0000       1.10
@@ -53,6 +53,7 @@
        audioconv(NULL),
        m_go(false),
        m_imageframe(NULL),
+       startThread(NULL),
        m_pause(false),
        inputPos(0),
        videowidth(0),
@@ -95,6 +96,8 @@
        if (m_go)
        {
                m_go = false;
+               startThread->join();
+               delete startThread;
        }
 
        gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
@@ -127,10 +130,7 @@
        m_go = true;
 
        // To avoid blocking while connecting, we use a thread.
-       if (pthread_create(&startThread, NULL, NetStreamGst::startPlayback, 
this) != 0)
-       {
-               return 0;
-       };
+       startThread = new 
boost::thread(boost::bind(NetStreamGst::startPlayback, this));
        return 0;
 }
 
@@ -236,17 +236,17 @@
 }
 
 
-void*
-NetStreamGst::startPlayback(void* arg)
+void
+NetStreamGst::startPlayback(NetStreamGst* ns)
 {
-       NetStreamGst* ns = static_cast<NetStreamGst*>(arg);
        NetConnection* nc = ns->_netCon;
+       assert(nc);
 
        // Pass stuff from/to the NetConnection object.
        assert(ns); // ns->_parent being null seems ok
        if ( !nc->openConnection(ns->url.c_str(), ns->_parent) ) {
                log_warning("Gnash could not open movie url: %s", 
ns->url.c_str());
-               return 0;
+               return;
        }
 
        ns->inputPos = 0;
@@ -274,11 +274,11 @@
        // Check if the creation of the gstreamer pipeline and audiosink was a 
succes
        if (!ns->pipeline) {
                gnash::log_error("The gstreamer pipeline element could not be 
created\n");
-               return 0;
+               return;
        }
        if (!ns->audiosink) {
                gnash::log_error("The gstreamer audiosink element could not be 
created\n");
-               return 0;
+               return;
        }
 
        // setup gnashnc source (our homegrown source element)
@@ -322,7 +322,7 @@
 
        if (!ns->source || !ns->audioconv || !ns->volume || !ns->decoder || 
!ns->colorspace || !ns->videocaps || !ns->videorate || !ns->videosink) {
                gnash::log_error("Gstreamer element(s) for movie handling could 
not be created\n");
-               return 0;
+               return;
        }
 
        // put it all in the pipeline
@@ -335,7 +335,7 @@
        
        // start playing        
        gst_element_set_state (ns->pipeline, GST_STATE_PLAYING);
-       return 0;
+       return;
 }
 
 image::image_base* NetStreamGst::get_video()

Index: server/asobj/NetStreamGst.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamGst.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/asobj/NetStreamGst.h 30 Jan 2007 12:49:03 -0000      1.6
+++ server/asobj/NetStreamGst.h 5 Feb 2007 22:22:32 -0000       1.7
@@ -25,7 +25,9 @@
 
 #ifdef SOUND_GST
 
-#include <pthread.h>
+#include <boost/thread/thread.hpp>
+#include <boost/bind.hpp> 
+#include <boost/thread/mutex.hpp>
 #include "impl.h"
 #include "video_stream_instance.h"
 #include <gst/gst.h>
@@ -58,7 +60,7 @@
                return m_go;
        }
 
-       static void* startPlayback(void* arg);
+       static void startPlayback(NetStreamGst* ns);
        static void callback_output (GstElement* /*c*/, GstBuffer *buffer, 
GstPad* /*pad*/, gpointer user_data);
        static void callback_newpad (GstElement *decodebin, GstPad *pad, 
gboolean last, gpointer data);
 private:
@@ -88,7 +90,7 @@
 
        image::image_base* m_imageframe;
 
-       pthread_t startThread;
+       boost::thread *startThread;
        bool m_pause;
 
        long inputPos;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]