diff options
author | Marton Balint <cus@passwd.hu> | 2016-02-20 22:39:07 +0100 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2016-03-20 19:51:05 +0100 |
commit | 25f707694cd33f65979320bc0de9273c11bf547c (patch) | |
tree | 28ab6baf888153a125974d8b2fad0a90d81d1771 /libavformat | |
parent | 48a96383faa0393d66d4bf755808845b6318e06f (diff) | |
download | ffmpeg-25f707694cd33f65979320bc0de9273c11bf547c.tar.gz |
avformat/utils: increase detected start_time with skip_samples
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/utils.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 5cff3a78e8..5409907143 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -997,16 +997,22 @@ static void update_initial_timestamps(AVFormatContext *s, int stream_index, if (is_relative(pktl_it->pkt.dts)) pktl_it->pkt.dts += shift; - if (st->start_time == AV_NOPTS_VALUE && pktl_it->pkt.pts != AV_NOPTS_VALUE) + if (st->start_time == AV_NOPTS_VALUE && pktl_it->pkt.pts != AV_NOPTS_VALUE) { st->start_time = pktl_it->pkt.pts; + if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->codec->sample_rate) + st->start_time += av_rescale_q(st->skip_samples, (AVRational){1, st->codec->sample_rate}, st->time_base); + } } if (has_decode_delay_been_guessed(st)) { update_dts_from_pts(s, stream_index, pktl); } - if (st->start_time == AV_NOPTS_VALUE) + if (st->start_time == AV_NOPTS_VALUE) { st->start_time = pts; + if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->codec->sample_rate) + st->start_time += av_rescale_q(st->skip_samples, (AVRational){1, st->codec->sample_rate}, st->time_base); + } } static void update_initial_durations(AVFormatContext *s, AVStream *st, |