[Scummvm-git-logs] scummvm master -> 6e51e828033fbebbc82d0adde2fa045e8f0e2445
Scorpeg
noreply at scummvm.org
Tue Oct 13 06:51:12 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
6e51e82803 VIDEO: Buffer PCM-only AVI audio incrementally
Commit: 6e51e828033fbebbc82d0adde2fa045e8f0e2445
https://github.com/scummvm/scummvm/commit/6e51e828033fbebbc82d0adde2fa045e8f0e2445
Author: Scorp (scorp at mrs.mn)
Date: 2026-10-13T09:23:11+03:00
Commit Message:
VIDEO: Buffer PCM-only AVI audio incrementally
Changed paths:
video/avi_decoder.cpp
video/avi_decoder.h
diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp
index 26d92baff45..49b66c9eef6 100644
--- a/video/avi_decoder.cpp
+++ b/video/avi_decoder.cpp
@@ -565,6 +565,8 @@ void AVIDecoder::readNextPacket() {
void AVIDecoder::handleNextPacket(TrackStatus &status) {
// If there's no more to search, bail out
if (status.chunkSearchOffset + 8 >= _movieListEnd) {
+ if (status.track->getTrackType() == Track::kTrackTypeAudio)
+ ((AVIAudioTrack *)status.track)->setAllPacketsQueued();
if (status.track->getTrackType() == Track::kTrackTypeVideo) {
// Horrible AVI video has a premature end
// Force the frame to be the last frame
@@ -587,6 +589,8 @@ void AVIDecoder::handleNextPacket(TrackStatus &status) {
for (;;) {
// If there's no more to search, bail out
if ((uint32)_fileStream->pos() + 8 >= _movieListEnd) {
+ if (status.track->getTrackType() == Track::kTrackTypeAudio)
+ ((AVIAudioTrack *)status.track)->setAllPacketsQueued();
if (status.track->getTrackType() == Track::kTrackTypeVideo) {
// Horrible AVI video has a premature end
// Force the frame to be the last frame
@@ -662,7 +666,7 @@ bool AVIDecoder::shouldQueueAudio(TrackStatus& status) {
return false;
if (_videoTracks.empty())
- return true;
+ return static_cast<AVIAudioTrack *>(status.track)->needsAudioOnlyBuffering();
// If video is done, make sure that the rest of the audio is queued
// (I guess this is also really a sanity check)
@@ -1151,7 +1155,9 @@ AVIDecoder::AVIAudioTrack::AVIAudioTrack(const AVIStreamHeader &streamHeader, co
_wvInfo(waveFormat),
_audioStream(0),
_packetStream(0),
- _curChunk(0) {
+ _curChunk(0),
+ _bufferedAudioOnly(false),
+ _allPacketsQueued(false) {
}
AVIDecoder::AVIAudioTrack::~AVIAudioTrack() {
@@ -1190,6 +1196,19 @@ void AVIDecoder::AVIAudioTrack::resetStream() {
delete _audioStream;
createAudioStream();
_curChunk = 0;
+ _allPacketsQueued = false;
+}
+
+bool AVIDecoder::AVIAudioTrack::needsAudioOnlyBuffering() {
+ if (_wvInfo.tag != Audio::kWaveFormatPCM || !_packetStream)
+ return true;
+
+ _bufferedAudioOnly = true;
+ return static_cast<Audio::StatelessPacketizedAudioStream *>(_packetStream)->numQueuedStreams() < 3;
+}
+
+bool AVIDecoder::AVIAudioTrack::endOfTrack() const {
+ return (!_bufferedAudioOnly || _allPacketsQueued) && AudioTrack::endOfTrack();
}
bool AVIDecoder::AVIAudioTrack::rewind() {
diff --git a/video/avi_decoder.h b/video/avi_decoder.h
index 799ba086e88..eabab66c150 100644
--- a/video/avi_decoder.h
+++ b/video/avi_decoder.h
@@ -296,6 +296,9 @@ protected:
uint32 getCurChunk() const { return _curChunk; }
Common::String &getName() { return _audsHeader.name; }
void setCurChunk(uint32 chunk) { _curChunk = chunk; }
+ bool needsAudioOnlyBuffering();
+ void setAllPacketsQueued() { _allPacketsQueued = true; }
+ bool endOfTrack() const override;
bool isRewindable() const override { return true; }
bool rewind() override;
@@ -308,6 +311,8 @@ protected:
Audio::AudioStream *_audioStream;
Audio::PacketizedAudioStream *_packetStream;
uint32 _curChunk;
+ bool _bufferedAudioOnly;
+ bool _allPacketsQueued;
};
struct TrackStatus {
More information about the Scummvm-git-logs
mailing list