Browse Source

fix returning wrong array size, fix memory leak when no resampling is necessary

remove_deprecated_ffmpeg_api
Alexandros Theodotou 3 years ago
parent
commit
c724c387c9
Signed by: alex
GPG Key ID: 022EAE42313D70F3
  1. 8
      src/ad_plugin.c

8
src/ad_plugin.c

@ -178,7 +178,9 @@ get_buf_size_for_sample_rate ( @@ -178,7 +178,9 @@ get_buf_size_for_sample_rate (
if (fabs (resample_ratio - 1.0) < 1e-20)
{
/* no sample rate change needed */
return (ssize_t) sample_rate;
return
(ssize_t) nfo->frames *
(ssize_t) nfo->channels;
}
if (src_is_valid_ratio (resample_ratio) == 0)
{
@ -370,9 +372,7 @@ audec_read ( @@ -370,9 +372,7 @@ audec_read (
}
else
{
*out =
malloc (in_len * sizeof (float));
memcpy (*out, in, in_len * sizeof (float));
*out = in;
ret = nfo.frames;
dbg (

Loading…
Cancel
Save