[FFmpeg-cvslog] lavf: remove unreliable timestamp guessing heuristic

Anton Khirnov git at videolan.org
Mon Oct 28 13:53:04 CET 2013


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Oct 27 21:04:20 2013 +0100| [2ba68dd044ca8fc591139c05563840f546a9c0c0] | committer: Anton Khirnov

lavf: remove unreliable timestamp guessing heuristic

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2ba68dd044ca8fc591139c05563840f546a9c0c0
---

 libavformat/avformat.h |    8 --------
 libavformat/seek.c     |    3 ---
 libavformat/seek.h     |    1 -
 libavformat/utils.c    |   22 ----------------------
 4 files changed, 34 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index ce7a2f8..a8e3a7d 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -730,14 +730,6 @@ typedef struct AVStream {
     int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */
 
     // Timestamp generation support:
-    /**
-     * Timestamp corresponding to the last dts sync point.
-     *
-     * Initialized when AVCodecParserContext.dts_sync_point >= 0 and
-     * a DTS is received from the underlying container. Otherwise set to
-     * AV_NOPTS_VALUE by default.
-     */
-    int64_t reference_dts;
     int64_t first_dts;
     int64_t cur_dts;
     int64_t last_IP_pts;
diff --git a/libavformat/seek.c b/libavformat/seek.c
index 524cd87..e17cdcc 100644
--- a/libavformat/seek.c
+++ b/libavformat/seek.c
@@ -428,13 +428,11 @@ AVParserState *ff_store_parser_state(AVFormatContext *s)
         ss->parser        = st->parser;
         ss->last_IP_pts   = st->last_IP_pts;
         ss->cur_dts       = st->cur_dts;
-        ss->reference_dts = st->reference_dts;
         ss->probe_packets = st->probe_packets;
 
         st->parser        = NULL;
         st->last_IP_pts   = AV_NOPTS_VALUE;
         st->cur_dts       = AV_NOPTS_VALUE;
-        st->reference_dts = AV_NOPTS_VALUE;
         st->probe_packets = MAX_PROBE_PACKETS;
     }
 
@@ -467,7 +465,6 @@ void ff_restore_parser_state(AVFormatContext *s, AVParserState *state)
         st->parser        = ss->parser;
         st->last_IP_pts   = ss->last_IP_pts;
         st->cur_dts       = ss->cur_dts;
-        st->reference_dts = ss->reference_dts;
         st->probe_packets = ss->probe_packets;
     }
 
diff --git a/libavformat/seek.h b/libavformat/seek.h
index e79d7bd..44cd369 100644
--- a/libavformat/seek.h
+++ b/libavformat/seek.h
@@ -33,7 +33,6 @@ typedef struct AVParserStreamState {
     AVCodecParserContext   *parser;
     int64_t                 last_IP_pts;
     int64_t                 cur_dts;
-    int64_t                 reference_dts;
     int                     probe_packets;
 } AVParserStreamState;
 
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 0700c5d..987d682 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -771,25 +771,6 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
             pkt->dts += offset;
     }
 
-    if (pc && pc->dts_sync_point >= 0) {
-        // we have synchronization info from the parser
-        int64_t den = st->codec->time_base.den * (int64_t) st->time_base.num;
-        if (den > 0) {
-            int64_t num = st->codec->time_base.num * (int64_t) st->time_base.den;
-            if (pkt->dts != AV_NOPTS_VALUE) {
-                // got DTS from the stream, update reference timestamp
-                st->reference_dts = pkt->dts - pc->dts_ref_dts_delta * num / den;
-                pkt->pts = pkt->dts + pc->pts_dts_delta * num / den;
-            } else if (st->reference_dts != AV_NOPTS_VALUE) {
-                // compute DTS based on reference timestamp
-                pkt->dts = st->reference_dts + pc->dts_ref_dts_delta * num / den;
-                pkt->pts = pkt->dts + pc->pts_dts_delta * num / den;
-            }
-            if (pc->dts_sync_point > 0)
-                st->reference_dts = pkt->dts; // new reference
-        }
-    }
-
     /* This may be redundant, but it should not hurt. */
     if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts > pkt->dts)
         presentation_delayed = 1;
@@ -1214,7 +1195,6 @@ void ff_read_frame_flush(AVFormatContext *s)
         }
         st->last_IP_pts = AV_NOPTS_VALUE;
         st->cur_dts = AV_NOPTS_VALUE; /* we set the current DTS to an unspecified origin */
-        st->reference_dts = AV_NOPTS_VALUE;
 
         st->probe_packets = MAX_PROBE_PACKETS;
 
@@ -1868,7 +1848,6 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
         st= ic->streams[i];
         st->cur_dts= st->first_dts;
         st->last_IP_pts = AV_NOPTS_VALUE;
-        st->reference_dts = AV_NOPTS_VALUE;
     }
 }
 
@@ -2618,7 +2597,6 @@ AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c)
     st->last_IP_pts = AV_NOPTS_VALUE;
     for(i=0; i<MAX_REORDER_DELAY+1; i++)
         st->pts_buffer[i]= AV_NOPTS_VALUE;
-    st->reference_dts = AV_NOPTS_VALUE;
 
     st->sample_aspect_ratio = (AVRational){0,1};
 



More information about the ffmpeg-cvslog mailing list