summaryrefslogtreecommitdiff
path: root/libswresample
diff options
context:
space:
mode:
Diffstat (limited to 'libswresample')
-rw-r--r--libswresample/swresample.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index 27f3581d5f..38bedf1e99 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -87,7 +87,7 @@ static const AVOption options[]={
{"comp_duration" , "Duration (in seconds) over which data is stretched/squeezeed to make it match the timestamps."
, OFFSET(soft_compensation_duration),AV_OPT_TYPE_FLOAT ,{.dbl=1 }, 0 , INT_MAX , PARAM },
{"max_soft_comp" , "Maximum factor by which data is stretched/squeezeed to make it match the timestamps."
- , OFFSET(max_soft_compensation),AV_OPT_TYPE_FLOAT ,{.dbl=0 }, 0 , INT_MAX , PARAM },
+ , OFFSET(max_soft_compensation),AV_OPT_TYPE_FLOAT ,{.dbl=0 }, INT_MIN, INT_MAX , PARAM },
{0}
};
@@ -771,7 +771,8 @@ int64_t swr_next_pts(struct SwrContext *s, int64_t pts){
}
} else if(s->soft_compensation_duration && s->max_soft_compensation) {
int duration = s->out_sample_rate * s->soft_compensation_duration;
- int comp = av_clipf(fdelta, -s->max_soft_compensation, s->max_soft_compensation) * duration ;
+ double max_soft_compensation = s->max_soft_compensation / (s->max_soft_compensation < 0 ? -s->in_sample_rate : 1);
+ int comp = av_clipf(fdelta, -max_soft_compensation, max_soft_compensation) * duration ;
av_log(s, AV_LOG_VERBOSE, "compensating audio timestamp drift:%f compensation:%d in:%d\n", fdelta, comp, duration);
swr_set_compensation(s, comp, duration);
}