shithub: opus-tools

Download patch

ref: ecd50e531fbf378499a3f71cdca05ad969c2e29f
parent: 5d0ac2030244b33bf12512267fe62ffe831bf105
author: Thomas Daede <daede003@umn.edu>
date: Mon May 23 07:08:08 EDT 2022

Fix FLAC read callback for data previously read during probing.

This was not encountered before because libflac happened to
always request at least 4 bytes for the first read callback.

Fixes https://github.com/xiph/opus-tools/issues/71

Signed-off-by: Mark Harris <mark.hsj@gmail.com>

--- a/src/flac.c
+++ b/src/flac.c
@@ -56,7 +56,7 @@
         some more.*/
       bytes_to_copy=buflen-bufpos;
       bytes_to_copy=*bytes<bytes_to_copy?*bytes:bytes_to_copy;
-      memcpy(buffer,flac->oldbuf,bytes_to_copy);
+      memcpy(buffer,flac->oldbuf+flac->bufpos,bytes_to_copy);
       flac->bufpos+=bytes_to_copy;
       *bytes=bytes_to_copy;
     }else{