gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog libbase/embedVideoDecoderGst.cp...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog libbase/embedVideoDecoderGst.cp...
Date: Fri, 08 Jun 2007 21:10:44 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/06/08 21:10:43

Modified files:
        .              : ChangeLog 
        libbase        : embedVideoDecoderGst.cpp embedVideoDecoderGst.h 

Log message:
                * libbase/embedVideoDecoderGst.{cpp,h}: Store decodedFrame
                  in an auto_ptr to avoid leaks. Fix the case in which
                  there's NO decoded frame (ie: no gst-ffmpeg installed)
                  previously segfaulting by simply running
                  Video-EmbedSquareTestRunner.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3500&r2=1.3501
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/embedVideoDecoderGst.cpp?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/embedVideoDecoderGst.h?cvsroot=gnash&r1=1.3&r2=1.4

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3500
retrieving revision 1.3501
diff -u -b -r1.3500 -r1.3501
--- ChangeLog   8 Jun 2007 18:10:32 -0000       1.3500
+++ ChangeLog   8 Jun 2007 21:10:43 -0000       1.3501
@@ -1,3 +1,11 @@
+2007-06-08 Sandro Santilli <address@hidden>
+
+       * libbase/embedVideoDecoderGst.{cpp,h}: Store decodedFrame
+         in an auto_ptr to avoid leaks. Fix the case in which
+         there's NO decoded frame (ie: no gst-ffmpeg installed)
+         previously segfaulting by simply running
+         Video-EmbedSquareTestRunner.
+
 2007-06-08 Tomas Groth Christensen <address@hidden>
 
        * server/asobj/NetStreamFfmpeg.cpp: Don't leave the decoding

Index: libbase/embedVideoDecoderGst.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/embedVideoDecoderGst.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- libbase/embedVideoDecoderGst.cpp    7 Jun 2007 12:10:21 -0000       1.6
+++ libbase/embedVideoDecoderGst.cpp    8 Jun 2007 21:10:43 -0000       1.7
@@ -15,7 +15,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: embedVideoDecoderGst.cpp,v 1.6 2007/06/07 12:10:21 tgc Exp $
+// $Id: embedVideoDecoderGst.cpp,v 1.7 2007/06/08 21:10:43 strk Exp $
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -43,7 +43,6 @@
 
 embedVideoDecoderGst::~embedVideoDecoderGst()
 {
-       delete decodedFrame;
 
        if (pipeline) {
                stop = true;
@@ -161,9 +160,9 @@
 
        // Determine required buffer size and allocate buffer
        if (outputFormat == YUV) {
-               decodedFrame = new image::yuv(width, height);
+               decodedFrame.reset(new image::yuv(width, height));
        } else if (outputFormat == RGB) {
-               decodedFrame = new image::rgb(width, height);
+               decodedFrame.reset(new image::rgb(width, height));
        }
 
        // Start "playing"
@@ -189,7 +188,15 @@
 
        // If there is nothing to decode in the new frame
        // we just return the lastest.
-       if (data == NULL || size == 0 || !decoder) {
+       if (data == NULL || size == 0 || !decoder)
+       {
+               // If we never decoded any frame return a NULL
+               // auto pointer ..
+               if ( ! decodedFrame.get() )
+               {
+                       ret_image.reset(NULL);
+                       return ret_image;
+               }
                ret_image->update(decodedFrame->m_data);
                return ret_image;
        }
@@ -201,6 +208,13 @@
 
        output_lock = new boost::mutex::scoped_lock(output_mutex);
 
+       // If we never decoded any frame return a NULL
+       // auto pointer ..
+       if ( ! decodedFrame.get() )
+       {
+               ret_image.reset(NULL);
+               return ret_image;
+       }
        ret_image->update(decodedFrame->m_data);
 
        return ret_image;
@@ -229,7 +243,8 @@
 
        if (decoder->stop) return;
 
-       if (decoder->decodedFrame) {
+       if (decoder->decodedFrame.get())
+       {
 
                if (decoder->outputFormat == YUV) {
                        assert(0);

Index: libbase/embedVideoDecoderGst.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/embedVideoDecoderGst.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- libbase/embedVideoDecoderGst.h      6 Jun 2007 15:41:12 -0000       1.3
+++ libbase/embedVideoDecoderGst.h      8 Jun 2007 21:10:43 -0000       1.4
@@ -15,7 +15,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: embedVideoDecoderGst.h,v 1.3 2007/06/06 15:41:12 tgc Exp $
+// $Id: embedVideoDecoderGst.h,v 1.4 2007/06/08 21:10:43 strk Exp $
 
 #ifndef __EMBEDVIDEODECODERGST_H__
 #define __EMBEDVIDEODECODERGST_H__
@@ -90,7 +90,7 @@
        int frameSize;
        
        /// Last decoded frame
-       image::image_base* decodedFrame;
+       std::auto_ptr<image::image_base> decodedFrame;
 
        /// If we should stop this will be true
        volatile bool stop;




reply via email to

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