[FFmpeg-devel] [PATCH] swresample/soxr: never return negative delay
Michael Niedermayer
michaelni at gmx.at
Fri Jun 5 01:03:13 CEST 2015
On Thu, Jun 04, 2015 at 07:54:15PM +0200, wm4 wrote:
> This makes no sense in this context, and can cause swr_get_out_samples()
> and swr_get_delay() negative numbers that are not error codes.
> ---
> libswresample/soxr_resample.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
is there an actual case where a negative value occurs or is this
"just to be sure" ?
also ive added the soxr_resample author to CC, he might want to
comment
>
> diff --git a/libswresample/soxr_resample.c b/libswresample/soxr_resample.c
> index 0f75bc5..9597e1f 100644
> --- a/libswresample/soxr_resample.c
> +++ b/libswresample/soxr_resample.c
> @@ -88,7 +88,7 @@ static int process(
>
> static int64_t get_delay(struct SwrContext *s, int64_t base){
> double delay_s = soxr_delay((soxr_t)s->resample) / s->out_sample_rate;
> - return (int64_t)(delay_s * base + .5);
> + return (int64_t)(FFMAX(delay_s, 0) * base + .5);
> }
>
> static int invert_initial_buffer(struct ResampleContext *c, AudioData *dst, const AudioData *src,
> --
> 2.1.4
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The educated differ from the uneducated as much as the living from the
dead. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150605/7f500d1d/attachment.asc>
More information about the ffmpeg-devel
mailing list