History

fftools/ffmpeg: simplify conditions in ts_discontinuity_process

Anton Khirnov committed 4 years ago

Commit ca38fe91 parent aa6d4a51 file · +4 −8Browse files

Unified · Split

fftools/ffmpeg.c+4−8
@@ -3714,8 +3714,7 @@ static void ts_discontinuity_process(InputFile *ifile, InputStream *ist, · 3713 unmodified lines
37143714 if (ist->next_dts != AV_NOPTS_VALUE && !disable_discontinuity_correction) {
37153715 int64_t delta = pkt_dts - ist->next_dts;
37163716 if (fmt_is_discont) {
3717− if (delta < -1LL*dts_delta_threshold*AV_TIME_BASE ||
3718− delta > 1LL*dts_delta_threshold*AV_TIME_BASE ||
3717+ if (FFABS(delta) > 1LL * dts_delta_threshold * AV_TIME_BASE ||
37193718 pkt_dts + AV_TIME_BASE/10 < FFMAX(ist->pts, ist->dts)) {
37203719 ifile->ts_offset -= delta;
37213720 av_log(NULL, AV_LOG_DEBUG,
@@ -3729,16 +3728,14 @@ static void ts_discontinuity_process(InputFile *ifile, InputStream *ist, · 7 unmodified lines
37293728 pkt->pts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
37303729 }
37313730 } else {
3732− if (delta < -1LL*dts_error_threshold*AV_TIME_BASE ||
3733− delta > 1LL*dts_error_threshold*AV_TIME_BASE) {
3731+ if (FFABS(delta) > 1LL * dts_error_threshold * AV_TIME_BASE) {
37343732 av_log(NULL, AV_LOG_WARNING, "DTS %"PRId64", next:%"PRId64" st:%d invalid dropping\n", pkt->dts, ist->next_dts, pkt->stream_index);
37353733 pkt->dts = AV_NOPTS_VALUE;
37363734 }
37373735 if (pkt->pts != AV_NOPTS_VALUE){
37383736 int64_t pkt_pts = av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q);
37393737 delta = pkt_pts - ist->next_dts;
3740− if (delta < -1LL*dts_error_threshold*AV_TIME_BASE ||
3741− delta > 1LL*dts_error_threshold*AV_TIME_BASE) {
3738+ if (FFABS(delta) > 1LL * dts_error_threshold * AV_TIME_BASE) {
37423739 av_log(NULL, AV_LOG_WARNING, "PTS %"PRId64", next:%"PRId64" invalid dropping st:%d\n", pkt->pts, ist->next_dts, pkt->stream_index);
37433740 pkt->pts = AV_NOPTS_VALUE;
37443741 }
@@ -3747,8 +3744,7 @@ static void ts_discontinuity_process(InputFile *ifile, InputStream *ist, · 2 unmodified lines
37473744 } else if (ist->next_dts == AV_NOPTS_VALUE && !copy_ts &&
37483745 fmt_is_discont && ifile->last_ts != AV_NOPTS_VALUE) {
37493746 int64_t delta = pkt_dts - ifile->last_ts;
3750− if (delta < -1LL*dts_delta_threshold*AV_TIME_BASE ||
3751− delta > 1LL*dts_delta_threshold*AV_TIME_BASE) {
3747+ if (FFABS(delta) > 1LL * dts_delta_threshold * AV_TIME_BASE) {
37523748 ifile->ts_offset -= delta;
37533749 av_log(NULL, AV_LOG_DEBUG,
37543750 "Inter stream timestamp discontinuity %"PRId64", new offset= %"PRId64"\n",

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t