gnash-commit
[Top][All Lists]
Advanced

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

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


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/asobj/NetStream.cpp serv...
Date: Tue, 22 Jan 2008 14:37:11 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/01/22 14:37:10

Modified files:
        .              : ChangeLog 
        server/asobj   : NetStream.cpp NetStream.h 
        testsuite/actionscript.all: NetStream.as 
        testsuite/misc-ming.all: NetStream-SquareTest.c 

Log message:
        Add the concept of a "connected" or "unconnected" NetStream.
        Use this to decide whether to return undefined for bytesLoaded/Total
        and currentFPS. Also, use that to avoid segfaulting in NetStream::play
        against an unconnected stream...

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5465&r2=1.5466
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStream.cpp?cvsroot=gnash&r1=1.82&r2=1.83
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStream.h?cvsroot=gnash&r1=1.56&r2=1.57
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/NetStream.as?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/NetStream-SquareTest.c?cvsroot=gnash&r1=1.22&r2=1.23

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5465
retrieving revision 1.5466
diff -u -b -r1.5465 -r1.5466
--- ChangeLog   22 Jan 2008 14:23:56 -0000      1.5465
+++ ChangeLog   22 Jan 2008 14:37:10 -0000      1.5466
@@ -1,5 +1,16 @@
 2008-01-22 Sandro Santilli <address@hidden>
 
+       * server/asobj/NetStream.{h,cpp}: add an isConnected
+         method and use it from AS methods.
+       * testsuite/actionscript.all/NetStream.as: bytesLoaded/bytesTotal
+         are undefined if the NetStream doesn't have an associated
+         NetConnection (fixed).
+       * testsuite/misc-ming.all/NetStream-SquareTest.c: currentFPS is
+         undefined if the NetStream doesn't have an associated NetConnection,
+         a number otherwise (fixed).
+
+2008-01-22 Sandro Santilli <address@hidden>
+
        * testsuite/misc-ming.all/NetStream-SquareTest.c: add a test
          segfaulting Gnash. See bug #22039.
 

Index: server/asobj/NetStream.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStream.cpp,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -b -r1.82 -r1.83
--- server/asobj/NetStream.cpp  22 Jan 2008 08:25:32 -0000      1.82
+++ server/asobj/NetStream.cpp  22 Jan 2008 14:37:10 -0000      1.83
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: NetStream.cpp,v 1.82 2008/01/22 08:25:32 strk Exp $ */
+/* $Id: NetStream.cpp,v 1.83 2008/01/22 14:37:10 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "gnashconfig.h"
@@ -152,6 +152,14 @@
                return as_value();
        }
 
+       if ( ! ns->isConnected() )
+       {
+               IF_VERBOSE_ASCODING_ERRORS(
+               log_aserror(_("NetStream.play(%s): stream is not connected"), 
fn.arg(0).to_debug_string().c_str());
+               );
+               return as_value();
+       }
+
        ns->play(fn.arg(0).to_string());
 
        return as_value();
@@ -291,6 +299,10 @@
 {
        boost::intrusive_ptr<NetStream> ns = ensureType<NetStream>(fn.this_ptr);
 
+       if ( ! ns->isConnected() )
+       {
+               return as_value();
+       }
        long ret = ns->bytesLoaded();
        return as_value(ret);
 }
@@ -301,6 +313,10 @@
 {
        boost::intrusive_ptr<NetStream> ns = ensureType<NetStream>(fn.this_ptr);
 
+       if ( ! ns->isConnected() )
+       {
+               return as_value();
+       }
        long ret = ns->bytesTotal();
        return as_value(ret);
 }
@@ -311,13 +327,20 @@
 {
        boost::intrusive_ptr<NetStream> ns = ensureType<NetStream>(fn.this_ptr);
 
+       if ( ! ns->isConnected() )
+       {
+               return as_value();
+       }
+
        double fps = ns->getCurrentFPS();
 
+#if 0
        if (fps <= 0) {
                return as_value(); // undef
        }
+#endif
 
-       return as_value(ns->getCurrentFPS());
+       return as_value(fps);
 }
 
 // read-only property bufferLength: amount of time buffered before playback

Index: server/asobj/NetStream.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStream.h,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -b -r1.56 -r1.57
--- server/asobj/NetStream.h    21 Jan 2008 20:55:57 -0000      1.56
+++ server/asobj/NetStream.h    22 Jan 2008 14:37:10 -0000      1.57
@@ -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: NetStream.h,v 1.56 2008/01/21 20:55:57 rsavoye Exp $ */
+/*  $Id: NetStream.h,v 1.57 2008/01/22 14:37:10 strk Exp $ */
 
 #ifndef __NETSTREAM_H__
 #define __NETSTREAM_H__
@@ -246,6 +246,9 @@
                _netCon = nc;
        }
 
+       /// Return true if the NetStream has an associated NetConnection
+       bool isConnected() const { return _netCon != 0; }
+
        /// Sets the AS Enviroment needed for eventhandlers
        //
        /// @param enviroment

Index: testsuite/actionscript.all/NetStream.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/NetStream.as,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- testsuite/actionscript.all/NetStream.as     21 Jan 2008 18:57:28 -0000      
1.18
+++ testsuite/actionscript.all/NetStream.as     22 Jan 2008 14:37:10 -0000      
1.19
@@ -20,7 +20,7 @@
 // compile this test case with Ming makeswf, and then
 // execute it like this gnash -1 -r 0 -v out.swf
 
-rcsid="$Id: NetStream.as,v 1.18 2008/01/21 18:57:28 bjacques Exp $";
+rcsid="$Id: NetStream.as,v 1.19 2008/01/22 14:37:10 strk Exp $";
 
 #include "check.as"
 
@@ -192,9 +192,9 @@
 /* Two properties added in SWF7 */
 
 // bytesLoaded (read-only)
-xcheck_equals ( typeof(netstreamObj.bytesLoaded), 'undefined' );
+check_equals ( typeof(netstreamObj.bytesLoaded), 'undefined' );
 // bytesLoaded (read-only)
-xcheck_equals ( typeof(netstreamObj.bytesTotal), 'undefined' );
+check_equals ( typeof(netstreamObj.bytesTotal), 'undefined' );
 
 #endif // OUTPUT_VERSION >= 6
 

Index: testsuite/misc-ming.all/NetStream-SquareTest.c
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/NetStream-SquareTest.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- testsuite/misc-ming.all/NetStream-SquareTest.c      22 Jan 2008 14:23:57 
-0000      1.22
+++ testsuite/misc-ming.all/NetStream-SquareTest.c      22 Jan 2008 14:37:10 
-0000      1.23
@@ -142,11 +142,11 @@
   add_actions(mo, "video.attachVideo(stream);"); 
   
   // currentFps (read-only)
-  xcheck_equals (mo, "typeof(stream.currentFps)", "'number'" );
+  check_equals (mo, "typeof(stream.currentFps)", "'number'" );
   add_actions(mo, "stream.currentFps = 'string';");
-  xcheck_equals (mo, "typeof(stream.currentFps)", "'number'" );
+  check_equals (mo, "typeof(stream.currentFps)", "'number'" );
   add_actions(mo, "stream.currentFps = false;");
-  xcheck_equals (mo, "typeof(stream.currentFps)", "'number'" );
+  check_equals (mo, "typeof(stream.currentFps)", "'number'" );
 
   // bufferLength (read-only)
   check_equals (mo, "typeof(stream.bufferLength)", "'number'" );
@@ -187,14 +187,14 @@
   add_actions(mo, "stream.bytesLoaded = 'string';");
   check_equals (mo, "typeof(stream.bytesLoaded)", "'number'" ); 
 
-  xcheck_equals (mo, "stream.currentFps", "0" );
+  check_equals (mo, "stream.currentFps", "0" );
 
   /* Play video */
   b = newSWFAction(buffer_b);
   if(b == NULL) return -1;
   SWFMovie_add(mo, (SWFBlock)b);
  
-  xcheck_equals (mo, "stream.currentFps", "0" );
+  check_equals (mo, "stream.currentFps", "0" );
  
   /* Publisher Methods */
 




reply via email to

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