Commit 25f70769 authored by Marton Balint's avatar Marton Balint

avformat/utils: increase detected start_time with skip_samples

Reviewed-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
parent 48a96383
...@@ -997,16 +997,22 @@ static void update_initial_timestamps(AVFormatContext *s, int stream_index, ...@@ -997,16 +997,22 @@ static void update_initial_timestamps(AVFormatContext *s, int stream_index,
if (is_relative(pktl_it->pkt.dts)) if (is_relative(pktl_it->pkt.dts))
pktl_it->pkt.dts += shift; 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; 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)) { if (has_decode_delay_been_guessed(st)) {
update_dts_from_pts(s, stream_index, pktl); 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; 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, static void update_initial_durations(AVFormatContext *s, AVStream *st,
......
[STREAM] [STREAM]
index=0 index=0
start_pts=1058 start_pts=-1024
duration_ts=104384 duration_ts=104384
[/STREAM] [/STREAM]
[FORMAT] [FORMAT]
start_time=0.023991 start_time=-0.023220
duration=2.367000 duration=2.367000
[/FORMAT] [/FORMAT]
packet|pts=1058|dts=1058|duration=1024 packet|pts=-1024|dts=-1024|duration=1024
packet|pts=2082|dts=2082|duration=1024 packet|pts=0|dts=0|duration=1024
packet|pts=3106|dts=3106|duration=1024 packet|pts=1024|dts=1024|duration=1024
packet|pts=4130|dts=4130|duration=1024 packet|pts=2048|dts=2048|duration=1024
packet|pts=5154|dts=5154|duration=1024 packet|pts=3072|dts=3072|duration=1024
packet|pts=6178|dts=6178|duration=1024 packet|pts=4096|dts=4096|duration=1024
packet|pts=7202|dts=7202|duration=1024 packet|pts=5120|dts=5120|duration=1024
packet|pts=8226|dts=8226|duration=1024 packet|pts=6144|dts=6144|duration=1024
packet|pts=97314|dts=97314|duration=1024 packet|pts=95232|dts=95232|duration=1024
packet|pts=98338|dts=98338|duration=1024 packet|pts=96256|dts=96256|duration=1024
packet|pts=99362|dts=99362|duration=1024 packet|pts=97280|dts=97280|duration=1024
packet|pts=100386|dts=100386|duration=1024 packet|pts=98304|dts=98304|duration=1024
packet|pts=101410|dts=101410|duration=1024 packet|pts=99328|dts=99328|duration=1024
packet|pts=102434|dts=102434|duration=1024 packet|pts=100352|dts=100352|duration=1024
packet|pts=103458|dts=103458|duration=1024 packet|pts=101376|dts=101376|duration=1024
packet|pts=104482|dts=104482|duration=-98 packet|pts=102400|dts=102400|duration=1984
stream|nb_read_packets=102 stream|nb_read_packets=102
frame|pkt_pts=1058|pkt_dts=1058|best_effort_timestamp=1058|pkt_duration=1024|nb_samples=1024 frame|pkt_pts=-1024|pkt_dts=-1024|best_effort_timestamp=-1024|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=2082|pkt_dts=2082|best_effort_timestamp=2082|pkt_duration=1024|nb_samples=1024 frame|pkt_pts=0|pkt_dts=0|best_effort_timestamp=0|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=3106|pkt_dts=3106|best_effort_timestamp=3106|pkt_duration=1024|nb_samples=1024 frame|pkt_pts=1024|pkt_dts=1024|best_effort_timestamp=1024|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=4130|pkt_dts=4130|best_effort_timestamp=4130|pkt_duration=1024|nb_samples=1024 frame|pkt_pts=2048|pkt_dts=2048|best_effort_timestamp=2048|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=5154|pkt_dts=5154|best_effort_timestamp=5154|pkt_duration=1024|nb_samples=1024 frame|pkt_pts=3072|pkt_dts=3072|best_effort_timestamp=3072|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=6178|pkt_dts=6178|best_effort_timestamp=6178|pkt_duration=1024|nb_samples=1024 frame|pkt_pts=4096|pkt_dts=4096|best_effort_timestamp=4096|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=7202|pkt_dts=7202|best_effort_timestamp=7202|pkt_duration=1024|nb_samples=1024 frame|pkt_pts=5120|pkt_dts=5120|best_effort_timestamp=5120|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=8226|pkt_dts=8226|best_effort_timestamp=8226|pkt_duration=1024|nb_samples=1024 frame|pkt_pts=6144|pkt_dts=6144|best_effort_timestamp=6144|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=97314|pkt_dts=97314|best_effort_timestamp=97314|pkt_duration=1024|nb_samples=1024 frame|pkt_pts=95232|pkt_dts=95232|best_effort_timestamp=95232|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=98338|pkt_dts=98338|best_effort_timestamp=98338|pkt_duration=1024|nb_samples=1024 frame|pkt_pts=96256|pkt_dts=96256|best_effort_timestamp=96256|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=99362|pkt_dts=99362|best_effort_timestamp=99362|pkt_duration=1024|nb_samples=1024 frame|pkt_pts=97280|pkt_dts=97280|best_effort_timestamp=97280|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=100386|pkt_dts=100386|best_effort_timestamp=100386|pkt_duration=1024|nb_samples=1024 frame|pkt_pts=98304|pkt_dts=98304|best_effort_timestamp=98304|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=101410|pkt_dts=101410|best_effort_timestamp=101410|pkt_duration=1024|nb_samples=1024 frame|pkt_pts=99328|pkt_dts=99328|best_effort_timestamp=99328|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=102434|pkt_dts=102434|best_effort_timestamp=102434|pkt_duration=1024|nb_samples=1024 frame|pkt_pts=100352|pkt_dts=100352|best_effort_timestamp=100352|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=103458|pkt_dts=103458|best_effort_timestamp=103458|pkt_duration=1024|nb_samples=1024 frame|pkt_pts=101376|pkt_dts=101376|best_effort_timestamp=101376|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=104482|pkt_dts=104482|best_effort_timestamp=104482|pkt_duration=-98|nb_samples=1024 frame|pkt_pts=102400|pkt_dts=102400|best_effort_timestamp=102400|pkt_duration=1984|nb_samples=1024
stream|nb_read_frames=102 stream|nb_read_frames=102
[STREAM] [STREAM]
index=0 index=0
start_pts=0 start_pts=2112
duration_ts=1294336 duration_ts=1294336
[/STREAM] [/STREAM]
[FORMAT] [FORMAT]
start_time=0.000000 start_time=0.047889
duration=29.350023 duration=29.350023
[/FORMAT] [/FORMAT]
packet|pts=0|dts=0|duration=1024 packet|pts=0|dts=0|duration=1024
......
[STREAM] [STREAM]
index=0 index=0
start_pts=0 start_pts=2112
duration_ts=105472 duration_ts=105472
[/STREAM] [/STREAM]
[FORMAT] [FORMAT]
start_time=0.000000 start_time=0.047891
duration=2.391655 duration=2.391655
[/FORMAT] [/FORMAT]
packet|pts=0|dts=0|duration=1024 packet|pts=0|dts=0|duration=1024
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment