aboutsummaryrefslogtreecommitdiffstats
path: root/libavresample
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-04-11 19:19:15 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-04-11 19:24:03 +0200
commitc04961fa0ff63a87f07ba411f4f0a413a23ceea8 (patch)
tree6eddb5baceabcc7d9083495ac2fb46c361c7e7ec /libavresample
parentd2417061ef50dbe606692fa24031e3d68cc6292b (diff)
parentb9dea23766f52b8e059e72d34980bb7b456efe8f (diff)
downloadffmpeg-c04961fa0ff63a87f07ba411f4f0a413a23ceea8.tar.gz
Merge commit 'b9dea23766f52b8e059e72d34980bb7b456efe8f'
* commit 'b9dea23766f52b8e059e72d34980bb7b456efe8f': resample: fix avresample_get_delay() return value Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavresample')
-rw-r--r--libavresample/resample.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavresample/resample.c b/libavresample/resample.c
index 525828c528..91093d9d26 100644
--- a/libavresample/resample.c
+++ b/libavresample/resample.c
@@ -47,6 +47,7 @@ struct ResampleContext {
void (*resample_one)(struct ResampleContext *c, int no_filter, void *dst0,
int dst_index, const void *src0, int src_size,
int index, int frac);
+ int padding_size;
};
@@ -212,6 +213,7 @@ ResampleContext *ff_audio_resample_init(AVAudioResampleContext *avr)
goto error;
c->ideal_dst_incr = c->dst_incr;
+ c->padding_size = (c->filter_length - 1) / 2;
c->index = -phase_count * ((c->filter_length - 1) / 2);
c->frac = 0;
@@ -462,8 +464,10 @@ int ff_audio_resample(ResampleContext *c, AudioData *dst, AudioData *src)
int avresample_get_delay(AVAudioResampleContext *avr)
{
+ ResampleContext *c = avr->resample;
+
if (!avr->resample_needed || !avr->resample)
return 0;
- return avr->resample->buffer->nb_samples;
+ return FFMAX(c->buffer->nb_samples - c->padding_size, 0);
}