gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog libbase/LoadThread.cpp


From: Bastiaan Jacques
Subject: [Gnash-commit] gnash ChangeLog libbase/LoadThread.cpp
Date: Tue, 10 Apr 2007 23:11:31 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Bastiaan Jacques <bjacques>     07/04/10 23:11:31

Modified files:
        .              : ChangeLog 
        libbase        : LoadThread.cpp 

Log message:
        Handle the case where the cache is filled up and we have yet more data
        to load. Patch by tgc.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2836&r2=1.2837
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/LoadThread.cpp?cvsroot=gnash&r1=1.5&r2=1.6

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2836
retrieving revision 1.2837
diff -u -b -r1.2836 -r1.2837
--- ChangeLog   10 Apr 2007 22:55:20 -0000      1.2836
+++ ChangeLog   10 Apr 2007 23:11:30 -0000      1.2837
@@ -12,6 +12,8 @@
 
        * server/asobj/NetStreamFfmpeg.h: Fixed a bug in the 
          AudioResampler, which made it only resample the first time.
+       * libbase/LoadThread.cpp: Handle the case where the cache is
+       filled and we have yet more data to load.
 
 2007-04-10 Markus Gothe <address@hidden>
 

Index: libbase/LoadThread.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/LoadThread.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- libbase/LoadThread.cpp      3 Apr 2007 16:45:02 -0000       1.5
+++ libbase/LoadThread.cpp      10 Apr 2007 23:11:31 -0000      1.6
@@ -16,7 +16,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-// $Id: LoadThread.cpp,v 1.5 2007/04/03 16:45:02 strk Exp $
+// $Id: LoadThread.cpp,v 1.6 2007/04/10 23:11:31 bjacques Exp $
 
 #include "LoadThread.h"
 
@@ -245,14 +245,34 @@
 
        if (_loadPosition != _actualPosition) 
_stream->set_position(_loadPosition);
 
-       int ret = _stream->read_bytes(_cache+_cachedData, _chunkSize);
+       int ret;
+       if (_cachedData + _chunkSize > _cacheSize) {
+               ret = _stream->read_bytes(_cache + _cachedData, _cacheSize - 
_cachedData);
 
+               _cachedData += ret;
+               if (ret != _cacheSize - _cachedData) {
+                       _completed = true;
+               } else {
+                       _stream->set_position(_loadPosition + _chunkSize);
+                       long pos = _stream->get_position();
+                       if (pos != _loadPosition + _chunkSize) {
+                               _completed = true;
+                       }
+                       ret += pos - (_loadPosition + _chunkSize);
+               }
+               
+       } else {
+               ret = _stream->read_bytes(_cache + _cachedData, _chunkSize);
        if (ret != _chunkSize) {
                _completed = true;
        }
        _cachedData += ret;
+
+       }
+
        _loadPosition = _loadPosition + ret;
        _actualPosition = _loadPosition;
+
 }
 
 void LoadThread::download()




reply via email to

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