CVSROOT: /sources/gnash Module name: gnash Changes by: Benjamin Wolsey <bwy> 07/12/04 09:20:29
Modified files: . : ChangeLog libmedia : MediaDecoder.cpp Log message: * libmedia/MediaDecoder.cpp: make sure we can stop decoding before the buffer is full. Avoids waiting interminably for the thread to finish if gnash is closed in the decoding loop. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5077&r2=1.5078 http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/MediaDecoder.cpp?cvsroot=gnash&r1=1.1&r2=1.2 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.5077 retrieving revision 1.5078 diff -u -b -r1.5077 -r1.5078 --- ChangeLog 4 Dec 2007 08:25:26 -0000 1.5077 +++ ChangeLog 4 Dec 2007 09:20:28 -0000 1.5078 @@ -1,3 +1,9 @@ +2007-12-04 Benjamin Wolsey <[EMAIL PROTECTED]> + + * libmedia/MediaDecoder.cpp: make sure we can stop decoding before the + buffer is full. Avoids waiting interminably for the thread to finish + if gnash is closed in the decoding loop. + 2007-12-04 Sandro Santilli <[EMAIL PROTECTED]> * testsuite/libbase/: Makefile.am, IntTypesTest.cpp: Index: libmedia/MediaDecoder.cpp =================================================================== RCS file: /sources/gnash/gnash/libmedia/MediaDecoder.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -b -r1.1 -r1.2 --- libmedia/MediaDecoder.cpp 30 Nov 2007 00:24:00 -0000 1.1 +++ libmedia/MediaDecoder.cpp 4 Dec 2007 09:20:29 -0000 1.2 @@ -16,7 +16,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: MediaDecoder.cpp,v 1.1 2007/11/30 00:24:00 tgc Exp $ +// $Id: MediaDecoder.cpp,v 1.2 2007/12/04 09:20:29 bwy Exp $ #include "MediaDecoder.h" @@ -34,40 +34,52 @@ return statusQueue; } - bool decodingFailed = false; - void MediaDecoder::decodingLoop() { + + bool decodingFailed = false; + // The decode loop - while (_running) { + while (_running) + { // If the buffer is not full, put something into it! - if (!_buffer->isFull()) { - while (!_buffer->isFull()) { - if (!decodeAndBufferFrame()) { + if (!_buffer->isFull()) + { + while (!_buffer->isFull() && _running) + { + if (!decodeAndBufferFrame()) + { decodingFailed = true; break; } //log_debug("decoded a frame"); } + } // "Warm up" the data. - } else if (_streamSize > _lastConfirmedPosition) { - if (_stream->set_position(_lastConfirmedPosition+2048) != 0) { + else if (_streamSize > _lastConfirmedPosition) + { + if (_stream->set_position(_lastConfirmedPosition+2048) != 0) + { // We assume we're done now // TODO: check for errors _lastConfirmedPosition = _streamSize; - } else { + } + else + { _lastConfirmedPosition += 2048; } //log_debug("warming up the file"); - } - if (_buffer->isFull()) { + + if (_buffer->isFull()) + { pushOnStatus(bufferFull); // If download is complete there is nothing to do, so we take a break. - if (_streamSize <= _lastConfirmedPosition) { + if (_streamSize <= _lastConfirmedPosition) + { relax(); continue; } @@ -75,9 +87,11 @@ // If decoding failed, there's a good chance playback has ended, so // we take a breake until someone tells us to wake up. - if (decodingFailed) { + if (decodingFailed) + { relax(); } + } log_debug("Left the decoding loop"); } _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit