summaryrefslogtreecommitdiff
path: root/libswresample/swresample.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-25 03:04:03 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-25 04:39:26 +0100
commit35aaa306ac2d6f699af430a7d4a3b85790d2269d (patch)
treeb77e800cdc94a1b87fa8bc8318f45a11697f3ff0 /libswresample/swresample.c
parent7f2ab129b19ceeb6974a7d5bc846274536c8efe2 (diff)
downloadffmpeg-35aaa306ac2d6f699af430a7d4a3b85790d2269d.tar.gz
swr: make the default of nopts for first_pts actually work
Fixes Ticket2210 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/swresample.c')
-rw-r--r--libswresample/swresample.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index f85f88fea5..9b71b2e122 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -339,7 +339,8 @@ av_cold int swr_init(struct SwrContext *s){
s->async = 1;
s->firstpts =
s->outpts = s->firstpts_in_samples * s->out_sample_rate;
- }
+ } else
+ s->firstpts = AV_NOPTS_VALUE;
if (s->async) {
if (s->min_compensation >= FLT_MAX/2)
@@ -899,6 +900,10 @@ int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensatio
int64_t swr_next_pts(struct SwrContext *s, int64_t pts){
if(pts == INT64_MIN)
return s->outpts;
+
+ if (s->firstpts == AV_NOPTS_VALUE)
+ s->outpts = s->firstpts = pts;
+
if(s->min_compensation >= FLT_MAX) {
return (s->outpts = pts - swr_get_delay(s, s->in_sample_rate * (int64_t)s->out_sample_rate));
} else {