Ticket #3404: flac-loop-fix.patch

File flac-loop-fix.patch, 1.1 KB (added by fingolfin, 16 years ago)
  • sound/flac.cpp

     
    137137        int getRate() const { return _streaminfo.sample_rate; }
    138138        bool endOfData() const {
    139139                // End of data is reached if there either is no valid stream data available,
    140                 // or if we reached the last sample and completely emptied the sample cache
     140                // or if we reached the last sample and completely emptied the sample cache.
    141141                return _streaminfo.channels == 0 || (_lastSampleWritten && _sampleCache.bufFill == 0);
    142142        }
    143143
     
    335335                FLAC__StreamDecoderState state = getStreamDecoderState();
    336336
    337337                // Keep poking FLAC to process more samples until we completely satisfied the request
    338                 while (_requestedSamples > 0 && state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) {
     338                // respectively until we run out of data.
     339                while (!_lastSampleWritten && _requestedSamples > 0 && state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) {
    339340                        assert(_sampleCache.bufFill == 0);
    340341                        assert(_requestedSamples % numChannels == 0);
    341342                        processSingleBlock();