fix bug with samples_decoded
authorJosh Coalson <jcoalson@users.sourceforce.net>
Tue, 17 Apr 2001 17:32:01 +0000 (17:32 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Tue, 17 Apr 2001 17:32:01 +0000 (17:32 +0000)
src/libFLAC/stream_decoder.c

index 77aa362..b1ba921 100644 (file)
@@ -210,6 +210,8 @@ bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder)
        }
        decoder->state = FLAC__STREAM_DECODER_SEARCH_FOR_METADATA;
 
        }
        decoder->state = FLAC__STREAM_DECODER_SEARCH_FOR_METADATA;
 
+       decoder->guts->samples_decoded = 0;
+
        return true;
 }
 
        return true;
 }
 
@@ -779,7 +781,7 @@ bool stream_decoder_read_frame_(FLAC__StreamDecoder *decoder, bool *got_a_frame)
        decoder->sample_rate = decoder->guts->frame.header.sample_rate;
        decoder->blocksize = decoder->guts->frame.header.blocksize;
 
        decoder->sample_rate = decoder->guts->frame.header.sample_rate;
        decoder->blocksize = decoder->guts->frame.header.blocksize;
 
-       decoder->guts->samples_decoded += decoder->guts->frame.header.blocksize;
+       decoder->guts->samples_decoded = decoder->guts->frame.header.number.sample_number + decoder->guts->frame.header.blocksize;
 
        /* write it */
        /* NOTE: some versions of GCC can't figure out const-ness right and will give you an 'incompatible pointer type' warning on arg 3 here: */
 
        /* write it */
        /* NOTE: some versions of GCC can't figure out const-ness right and will give you an 'incompatible pointer type' warning on arg 3 here: */