[Scummvm-cvs-logs] scummvm master -> 6e794a9823440b6859ce65fb1097d710780a493d

sev- sev at scummvm.org
Sat Aug 9 15:34:28 CEST 2014


This automated email contains information about 8 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
1b834f92bd AUDIO: Finish off AAC/QDM2 queues when done decoding a packet
d2353964b8 AUDIO: Fix QueuingAudioStreamImpl locking
6d632dda27 AUDIO: Better handle endOfStream() vs endOfData() in QueuingAudioStreamImpl
931e2e16f7 AUDIO: Fix endOfStream() for LimitingAudioStream
82d464367b AUDIO: Better handle endOfStream() vs endOfData() in LoopingAudioStream
d8ef40879c AUDIO: Better handle endOfStream() vs endOfData() in SubLoopingAudioStream
dc155b23f0 AUDIO: Better handle endOfStream() vs endOfData() in SubSeekableAudioStream
6e794a9823 Merge pull request #487 from clone2727/audio_fixes


Commit: 1b834f92bd75d394051de650747096ee9d82b513
    https://github.com/scummvm/scummvm/commit/1b834f92bd75d394051de650747096ee9d82b513
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2014-07-27T23:44:44-04:00

Commit Message:
AUDIO: Finish off AAC/QDM2 queues when done decoding a packet

Changed paths:
    audio/decoders/aac.cpp
    audio/decoders/qdm2.cpp



diff --git a/audio/decoders/aac.cpp b/audio/decoders/aac.cpp
index 7700bb3..beabf7b 100644
--- a/audio/decoders/aac.cpp
+++ b/audio/decoders/aac.cpp
@@ -117,6 +117,7 @@ AudioStream *AACDecoder::decodeFrame(Common::SeekableReadStream &stream) {
 		inBufferPos += frameInfo.bytesconsumed;
 	}
 
+	audioStream->finish();
 	return audioStream;
 }
 
diff --git a/audio/decoders/qdm2.cpp b/audio/decoders/qdm2.cpp
index 743ca1c..97d73b3 100644
--- a/audio/decoders/qdm2.cpp
+++ b/audio/decoders/qdm2.cpp
@@ -2607,6 +2607,7 @@ AudioStream *QDM2Stream::decodeFrame(Common::SeekableReadStream &stream) {
 	while (qdm2_decodeFrame(stream, audioStream))
 		;
 
+	audioStream->finish();
 	return audioStream;
 }
 


Commit: d2353964b8712bb3604ba7af678ca6cc95278fbf
    https://github.com/scummvm/scummvm/commit/d2353964b8712bb3604ba7af678ca6cc95278fbf
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2014-07-27T23:44:44-04:00

Commit Message:
AUDIO: Fix QueuingAudioStreamImpl locking

Changed paths:
    audio/audiostream.cpp



diff --git a/audio/audiostream.cpp b/audio/audiostream.cpp
index 4dd5d23..bfb1dda 100644
--- a/audio/audiostream.cpp
+++ b/audio/audiostream.cpp
@@ -315,18 +315,27 @@ public:
 	virtual int readBuffer(int16 *buffer, const int numSamples);
 	virtual bool isStereo() const { return _stereo; }
 	virtual int getRate() const { return _rate; }
+
 	virtual bool endOfData() const {
-		//Common::StackLock lock(_mutex);
+		Common::StackLock lock(_mutex);
 		return _queue.empty();
 	}
-	virtual bool endOfStream() const { return _finished && _queue.empty(); }
+
+	virtual bool endOfStream() const {
+		Common::StackLock lock(_mutex);
+		return _finished && _queue.empty();
+	}
 
 	// Implement the QueuingAudioStream API
 	virtual void queueAudioStream(AudioStream *stream, DisposeAfterUse::Flag disposeAfterUse);
-	virtual void finish() { _finished = true; }
+
+	virtual void finish() {
+		Common::StackLock lock(_mutex);
+		_finished = true;
+	}
 
 	uint32 numQueuedStreams() const {
-		//Common::StackLock lock(_mutex);
+		Common::StackLock lock(_mutex);
 		return _queue.size();
 	}
 };


Commit: 6d632dda27a9a05ee5668d955a254625fb2626b3
    https://github.com/scummvm/scummvm/commit/6d632dda27a9a05ee5668d955a254625fb2626b3
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2014-07-27T23:44:44-04:00

Commit Message:
AUDIO: Better handle endOfStream() vs endOfData() in QueuingAudioStreamImpl

Changed paths:
    audio/audiostream.cpp



diff --git a/audio/audiostream.cpp b/audio/audiostream.cpp
index bfb1dda..54dcd9b 100644
--- a/audio/audiostream.cpp
+++ b/audio/audiostream.cpp
@@ -318,7 +318,7 @@ public:
 
 	virtual bool endOfData() const {
 		Common::StackLock lock(_mutex);
-		return _queue.empty();
+		return _queue.empty() || _queue.front()._stream->endOfData();
 	}
 
 	virtual bool endOfStream() const {
@@ -365,11 +365,17 @@ int QueuingAudioStreamImpl::readBuffer(int16 *buffer, const int numSamples) {
 		AudioStream *stream = _queue.front()._stream;
 		samplesDecoded += stream->readBuffer(buffer + samplesDecoded, numSamples - samplesDecoded);
 
-		if (stream->endOfData()) {
+		// Done with the stream completely
+		if (stream->endOfStream()) {
 			StreamHolder tmp = _queue.pop();
 			if (tmp._disposeAfterUse == DisposeAfterUse::YES)
 				delete stream;
+			continue;
 		}
+
+		// Done with data but not the stream, bail out
+		if (stream->endOfData())
+			break;
 	}
 
 	return samplesDecoded;


Commit: 931e2e16f7f65f21e51d501574b4c0c908bd72e5
    https://github.com/scummvm/scummvm/commit/931e2e16f7f65f21e51d501574b4c0c908bd72e5
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2014-07-27T23:44:45-04:00

Commit Message:
AUDIO: Fix endOfStream() for LimitingAudioStream

Changed paths:
    audio/audiostream.cpp



diff --git a/audio/audiostream.cpp b/audio/audiostream.cpp
index 54dcd9b..36f714b 100644
--- a/audio/audiostream.cpp
+++ b/audio/audiostream.cpp
@@ -431,12 +431,14 @@ public:
 		return samplesRead;
 	}
 
-	bool endOfData() const { return _parentStream->endOfData() || _samplesRead >= _totalSamples; }
+	bool endOfData() const { return _parentStream->endOfData() || reachedLimit(); }
+	bool endOfStream() const { return _parentStream->endOfStream() || reachedLimit(); }
 	bool isStereo() const { return _parentStream->isStereo(); }
 	int getRate() const { return _parentStream->getRate(); }
 
 private:
 	int getChannels() const { return isStereo() ? 2 : 1; }
+	bool reachedLimit() const { return _samplesRead >= _totalSamples; }
 
 	AudioStream *_parentStream;
 	DisposeAfterUse::Flag _disposeAfterUse;


Commit: 82d464367b1060003886b1a331a03f5ca099499f
    https://github.com/scummvm/scummvm/commit/82d464367b1060003886b1a331a03f5ca099499f
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2014-07-27T23:44:45-04:00

Commit Message:
AUDIO: Better handle endOfStream() vs endOfData() in LoopingAudioStream

Changed paths:
    audio/audiostream.cpp
    audio/audiostream.h



diff --git a/audio/audiostream.cpp b/audio/audiostream.cpp
index 36f714b..fbf672c 100644
--- a/audio/audiostream.cpp
+++ b/audio/audiostream.cpp
@@ -98,7 +98,7 @@ LoopingAudioStream::LoopingAudioStream(RewindableAudioStream *stream, uint loops
 		// TODO: Properly indicate error
 		_loops = _completeIterations = 1;
 	}
-	if (stream->endOfData()) {
+	if (stream->endOfStream()) {
 		// Apparently this is an empty stream
 		_loops = _completeIterations = 1;
 	}
@@ -122,7 +122,7 @@ int LoopingAudioStream::readBuffer(int16 *buffer, const int numSamples) {
 			_loops = _completeIterations = 1;
 			return samplesRead;
 		}
-		if (_parent->endOfData()) {
+		if (_parent->endOfStream()) {
 			// Apparently this is an empty stream
 			_loops = _completeIterations = 1;
 		}
@@ -134,7 +134,11 @@ int LoopingAudioStream::readBuffer(int16 *buffer, const int numSamples) {
 }
 
 bool LoopingAudioStream::endOfData() const {
-	return (_loops != 0 && (_completeIterations == _loops));
+	return (_loops != 0 && _completeIterations == _loops) || _parent->endOfData();
+}
+
+bool LoopingAudioStream::endOfStream() const {
+	return _loops != 0 && _completeIterations == _loops;
 }
 
 AudioStream *makeLoopingAudioStream(RewindableAudioStream *stream, uint loops) {
diff --git a/audio/audiostream.h b/audio/audiostream.h
index d5d7d0b..ad842d7 100644
--- a/audio/audiostream.h
+++ b/audio/audiostream.h
@@ -118,6 +118,7 @@ public:
 
 	int readBuffer(int16 *buffer, const int numSamples);
 	bool endOfData() const;
+	bool endOfStream() const;
 
 	bool isStereo() const { return _parent->isStereo(); }
 	int getRate() const { return _parent->getRate(); }


Commit: d8ef40879ca8f9d05384135ad2383f3677cb38cf
    https://github.com/scummvm/scummvm/commit/d8ef40879ca8f9d05384135ad2383f3677cb38cf
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2014-08-01T01:39:46-04:00

Commit Message:
AUDIO: Better handle endOfStream() vs endOfData() in SubLoopingAudioStream

Changed paths:
    audio/audiostream.cpp
    audio/audiostream.h



diff --git a/audio/audiostream.cpp b/audio/audiostream.cpp
index fbf672c..c413edb 100644
--- a/audio/audiostream.cpp
+++ b/audio/audiostream.cpp
@@ -193,7 +193,7 @@ int SubLoopingAudioStream::readBuffer(int16 *buffer, const int numSamples) {
 	int framesRead = _parent->readBuffer(buffer, framesLeft);
 	_pos = _pos.addFrames(framesRead);
 
-	if (framesRead < framesLeft && _parent->endOfData()) {
+	if (framesRead < framesLeft && _parent->endOfStream()) {
 		// TODO: Proper error indication.
 		_done = true;
 		return framesRead;
@@ -220,6 +220,18 @@ int SubLoopingAudioStream::readBuffer(int16 *buffer, const int numSamples) {
 	}
 }
 
+bool SubLoopingAudioStream::endOfData() const {
+	// We're out of data if this stream is finished or the parent
+	// has run out of data for now.
+	return _done || _parent->endOfData();
+}
+
+bool SubLoopingAudioStream::endOfStream() const {
+	// The end of the stream has been reached only when we've gone
+	// through all the iterations.
+	return _done;
+}
+
 #pragma mark -
 #pragma mark --- SubSeekableAudioStream ---
 #pragma mark -
diff --git a/audio/audiostream.h b/audio/audiostream.h
index ad842d7..e3b8773 100644
--- a/audio/audiostream.h
+++ b/audio/audiostream.h
@@ -248,7 +248,8 @@ public:
 	                      DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
 
 	int readBuffer(int16 *buffer, const int numSamples);
-	bool endOfData() const { return _done; }
+	bool endOfData() const;
+	bool endOfStream() const;
 
 	bool isStereo() const { return _parent->isStereo(); }
 	int getRate() const { return _parent->getRate(); }


Commit: dc155b23f02f6a462bf59a3f51dcdfea3e95c5b8
    https://github.com/scummvm/scummvm/commit/dc155b23f02f6a462bf59a3f51dcdfea3e95c5b8
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2014-08-01T01:47:30-04:00

Commit Message:
AUDIO: Better handle endOfStream() vs endOfData() in SubSeekableAudioStream

Changed paths:
    audio/audiostream.h



diff --git a/audio/audiostream.h b/audio/audiostream.h
index e3b8773..5202a47 100644
--- a/audio/audiostream.h
+++ b/audio/audiostream.h
@@ -289,7 +289,8 @@ public:
 
 	int getRate() const { return _parent->getRate(); }
 
-	bool endOfData() const { return (_pos >= _length) || _parent->endOfStream(); }
+	bool endOfData() const { return (_pos >= _length) || _parent->endOfData(); }
+	bool endOfStream() const { return (_pos >= _length) || _parent->endOfStream(); }
 
 	bool seek(const Timestamp &where);
 


Commit: 6e794a9823440b6859ce65fb1097d710780a493d
    https://github.com/scummvm/scummvm/commit/6e794a9823440b6859ce65fb1097d710780a493d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2014-08-09T15:33:50+02:00

Commit Message:
Merge pull request #487 from clone2727/audio_fixes

AUDIO: Miscellaneous AudioStream fixes

Changed paths:
    audio/audiostream.cpp
    audio/audiostream.h
    audio/decoders/aac.cpp
    audio/decoders/qdm2.cpp









More information about the Scummvm-git-logs mailing list