summaryrefslogtreecommitdiff
path: root/libswresample
diff options
context:
space:
mode:
Diffstat (limited to 'libswresample')
-rw-r--r--libswresample/swresample_frame.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libswresample/swresample_frame.c b/libswresample/swresample_frame.c
index 71d3ed711a..2853266d6c 100644
--- a/libswresample/swresample_frame.c
+++ b/libswresample/swresample_frame.c
@@ -139,9 +139,10 @@ int swr_convert_frame(SwrContext *s,
if (out) {
if (!out->linesize[0]) {
- out->nb_samples = swr_get_delay(s, s->out_sample_rate)
- + in->nb_samples*(int64_t)s->out_sample_rate / s->in_sample_rate
- + 3;
+ out->nb_samples = swr_get_delay(s, s->out_sample_rate) + 3;
+ if (in) {
+ out->nb_samples += in->nb_samples*(int64_t)s->out_sample_rate / s->in_sample_rate;
+ }
if ((ret = av_frame_get_buffer(out, 0)) < 0) {
if (setup)
swr_close(s);