fix bug where seek point was hit during metadata write_callback time
authorJosh Coalson <jcoalson@users.sourceforce.net>
Fri, 13 Apr 2001 23:03:02 +0000 (23:03 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Fri, 13 Apr 2001 23:03:02 +0000 (23:03 +0000)
src/flac/encode.c

index 678faab..3420bf0 100644 (file)
@@ -788,8 +788,8 @@ FLAC__EncoderWriteStatus write_callback(const FLAC__Encoder *encoder, const byte
        encoder_wrapper_struct *encoder_wrapper = (encoder_wrapper_struct *)client_data;
        unsigned mask = (encoder->do_exhaustive_model_search || encoder->do_qlp_coeff_prec_search)? 0x07 : 0x1f;
 
-       /* mark the current seek point if hit */
-       if(encoder_wrapper->seek_table.num_points > 0) {
+       /* mark the current seek point if hit (if stream_offset == 0 that means we're still writing metadata and haven't hit the first frame yet) */
+       if(encoder_wrapper->stream_offset > 0 && encoder_wrapper->seek_table.num_points > 0) {
                uint64 current_sample = (uint64)current_frame * (uint64)encoder->blocksize, test_sample;
                unsigned i;
                for(i = encoder_wrapper->first_seek_point_to_check; i < encoder_wrapper->seek_table.num_points; i++) {