Changes between Version 3 and Version 4 of Ticket #6573, comment 12


Ignore:
Timestamp:
Aug 25, 2017, 4:27:14 PM (3 years ago)
Author:
krs_vital
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #6573, comment 12

    v3 v4  
    11lets se my changes of ffmpeg.c, it solve problem when signal down more then 10 seconds
    22
    3  diff -u ./ffmpeg.c /var/db/pack/FFmpeg/ffmpeg.c
     3this change duration after discontinuity PTS and DTS correcting, now it makes before
     4
     5diff -u ./ffmpeg.c /var/db/pack/FFmpeg/ffmpeg.c
    46--- ./ffmpeg.c  2017-08-23 13:33:15.457301967 +0700
    5 +++ /var/db/pack/FFmpeg/ffmpeg.c        2017-08-23 13:42:18.412960914 +0700
    6 @@ -4359,7 +4359,7 @@
    7          int64_t delta   = pkt_dts - ifile->last_ts;
    8          if (delta < -1LL*dts_delta_threshold*AV_TIME_BASE ||
    9              delta >  1LL*dts_delta_threshold*AV_TIME_BASE){
    10 --            ifile->ts_offset -= delta;
    11 +            if(delta < 0){ifile->ts_offset -= delta;}
    12              av_log(NULL, AV_LOG_DEBUG,
    13                     "Inter stream timestamp discontinuity %"PRId64", new offset= %"PRId64"\n",
    14                     delta, ifile->ts_offset);
    15 @@ -4389,7 +4389,7 @@
    16              if (delta < -1LL*dts_delta_threshold*AV_TIME_BASE ||
    17                  delta >  1LL*dts_delta_threshold*AV_TIME_BASE ||
    18                  pkt_dts + AV_TIME_BASE/10 < FFMAX(ist->pts, ist->dts)) {
    19 --                ifile->ts_offset -= delta;
    20 +                if(delta < 0){ifile->ts_offset -= delta;}
    21                  av_log(NULL, AV_LOG_DEBUG,
    22                         "timestamp discontinuity %"PRId64", new offset= %"PRId64"\n",
    23                         delta, ifile->ts_offset);
     7+++ /var/db/pack/FFmpeg/ffmpeg.c        2017-08-25 20:03:24.607099912 +0700
     8@@ -4369,16 +4369,6 @@
     9         }
     10     }
     11
     12--    duration = av_rescale_q(ifile->duration, ifile->time_base, ist->st->time_base);
     13--    if (pkt.pts != AV_NOPTS_VALUE) {
     14--        pkt.pts += duration;
     15--        ist->max_pts = FFMAX(pkt.pts, ist->max_pts);
     16--        ist->min_pts = FFMIN(pkt.pts, ist->min_pts);
     17--    }
     18--
     19--    if (pkt.dts != AV_NOPTS_VALUE)
     20--        pkt.dts += duration;
     21--
     22     pkt_dts = av_rescale_q_rnd(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
     23     if ((ist->dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO ||
     24          ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) &&
     25@@ -4415,8 +4405,17 @@
     26         }
     27     }
     28
     29--    if (pkt.dts != AV_NOPTS_VALUE)
     30+    duration = av_rescale_q(ifile->duration, ifile->time_base, ist->st->time_base);
     31+    if (pkt.pts != AV_NOPTS_VALUE) {
     32+        pkt.pts += duration;
     33+        ist->max_pts = FFMAX(pkt.pts, ist->max_pts);
     34+        ist->min_pts = FFMIN(pkt.pts, ist->min_pts);
     35+    }
     36+
     37+    if (pkt.dts != AV_NOPTS_VALUE){
     38+        pkt.dts += duration;
     39         ifile->last_ts = av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q);
     40+    }
     41
     42     if (debug_ts) {
     43         av_log(NULL, AV_LOG_INFO, "demuxer+ffmpeg -> ist_index:%d type:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%s off_time:%s\n",
     44