shithub: sox

Download patch

ref: 2502bcd9b570012e34e34166aefca9c116f06026
parent: 56788ce30828d228d48739bf6498da4dad3745a9
author: robs <robs>
date: Sat Dec 20 11:06:21 EST 2008

Fix slight FLAC seek inaccuracy e.g. when using 'trim' effect

--- a/src/flac.c
+++ b/src/flac.c
@@ -481,16 +481,11 @@
 
 
 
-/*
- * N.B.  Do not call this function with offset=0 when file-pointer
- * is already 0 or a block of decoded FLAC data will be discarded.
- */
 static int seek(sox_format_t * ft, uint64_t offset)
 {
   priv_t * p = (priv_t *)ft->priv;
-  int result = ft->mode == 'r' && FLAC__stream_decoder_seek_absolute(p->decoder, (FLAC__uint64)(offset / ft->signal.channels)) ?  SOX_SUCCESS : SOX_EOF;
   p->wide_sample_number = p->number_of_wide_samples = 0;
-  return result;
+  return ft->mode == 'r' && FLAC__stream_decoder_seek_absolute(p->decoder, (FLAC__uint64)(offset / ft->signal.channels)) ?  SOX_SUCCESS : SOX_EOF;
 }