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
3714 if (ist->next_dts != AV_NOPTS_VALUE && !disable_discontinuity_correction) {3714 if (ist->next_dts != AV_NOPTS_VALUE && !disable_discontinuity_correction) {
3715 int64_t delta = pkt_dts - ist->next_dts;3715 int64_t delta = pkt_dts - ist->next_dts;
3716 if (fmt_is_discont) {3716 if (fmt_is_discont) {
3717 if (delta < -1LL*dts_delta_threshold*AV_TIME_BASE ||3717 if (FFABS(delta) > 1LL * dts_delta_threshold * AV_TIME_BASE ||
3718 delta > 1LL*dts_delta_threshold*AV_TIME_BASE ||
3719 pkt_dts + AV_TIME_BASE/10 < FFMAX(ist->pts, ist->dts)) {3718 pkt_dts + AV_TIME_BASE/10 < FFMAX(ist->pts, ist->dts)) {
3720 ifile->ts_offset -= delta;3719 ifile->ts_offset -= delta;
3721 av_log(NULL, AV_LOG_DEBUG,3720 av_log(NULL, AV_LOG_DEBUG,
@@ -3729,16 +3728,14 @@ static void ts_discontinuity_process(InputFile *ifile, InputStream *ist, · 7 unmodified lines
3729 pkt->pts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);3728 pkt->pts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
3730 }3729 }
3731 } else {3730 } else {
3732 if (delta < -1LL*dts_error_threshold*AV_TIME_BASE ||3731 if (FFABS(delta) > 1LL * dts_error_threshold * AV_TIME_BASE) {
3733 delta > 1LL*dts_error_threshold*AV_TIME_BASE) {
3734 av_log(NULL, AV_LOG_WARNING, "DTS %"PRId64", next:%"PRId64" st:%d invalid dropping\n", pkt->dts, ist->next_dts, pkt->stream_index);3732 av_log(NULL, AV_LOG_WARNING, "DTS %"PRId64", next:%"PRId64" st:%d invalid dropping\n", pkt->dts, ist->next_dts, pkt->stream_index);
3735 pkt->dts = AV_NOPTS_VALUE;3733 pkt->dts = AV_NOPTS_VALUE;
3736 }3734 }
3737 if (pkt->pts != AV_NOPTS_VALUE){3735 if (pkt->pts != AV_NOPTS_VALUE){
3738 int64_t pkt_pts = av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q);3736 int64_t pkt_pts = av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q);
3739 delta = pkt_pts - ist->next_dts;3737 delta = pkt_pts - ist->next_dts;
3740 if (delta < -1LL*dts_error_threshold*AV_TIME_BASE ||3738 if (FFABS(delta) > 1LL * dts_error_threshold * AV_TIME_BASE) {
3741 delta > 1LL*dts_error_threshold*AV_TIME_BASE) {
3742 av_log(NULL, AV_LOG_WARNING, "PTS %"PRId64", next:%"PRId64" invalid dropping st:%d\n", pkt->pts, ist->next_dts, pkt->stream_index);3739 av_log(NULL, AV_LOG_WARNING, "PTS %"PRId64", next:%"PRId64" invalid dropping st:%d\n", pkt->pts, ist->next_dts, pkt->stream_index);
3743 pkt->pts = AV_NOPTS_VALUE;3740 pkt->pts = AV_NOPTS_VALUE;
3744 }3741 }
@@ -3747,8 +3744,7 @@ static void ts_discontinuity_process(InputFile *ifile, InputStream *ist, · 2 unmodified lines
3747 } else if (ist->next_dts == AV_NOPTS_VALUE && !copy_ts &&3744 } else if (ist->next_dts == AV_NOPTS_VALUE && !copy_ts &&
3748 fmt_is_discont && ifile->last_ts != AV_NOPTS_VALUE) {3745 fmt_is_discont && ifile->last_ts != AV_NOPTS_VALUE) {
3749 int64_t delta = pkt_dts - ifile->last_ts;3746 int64_t delta = pkt_dts - ifile->last_ts;
3750 if (delta < -1LL*dts_delta_threshold*AV_TIME_BASE ||3747 if (FFABS(delta) > 1LL * dts_delta_threshold * AV_TIME_BASE) {
3751 delta > 1LL*dts_delta_threshold*AV_TIME_BASE) {
3752 ifile->ts_offset -= delta;3748 ifile->ts_offset -= delta;
3753 av_log(NULL, AV_LOG_DEBUG,3749 av_log(NULL, AV_LOG_DEBUG,
3754 "Inter stream timestamp discontinuity %"PRId64", new offset= %"PRId64"\n",3750 "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