The information provided by compute_pkt_fields2() is all related to
timestamps.
---
 libavformat/utils.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 156c527..707fcda 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3025,10 +3025,11 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
         return 1;
     }
 
-    ret = compute_pkt_fields2(s, s->streams[pkt->stream_index], pkt);
-
-    if(ret<0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
-        return ret;
+    if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
+        ret = compute_pkt_fields2(s, s->streams[pkt->stream_index], pkt);
+        if (ret < 0)
+            return ret;
+    }
 
     ret= s->oformat->write_packet(s, pkt);
 
@@ -3156,11 +3157,14 @@ int av_interleaved_write_frame(AVFormatContext *s, 
AVPacket *pkt){
 
         av_dlog(s, "av_interleaved_write_frame size:%d dts:%"PRId64" 
pts:%"PRId64"\n",
                 pkt->size, pkt->dts, pkt->pts);
-        if((ret = compute_pkt_fields2(s, st, pkt)) < 0 && !(s->oformat->flags 
& AVFMT_NOTIMESTAMPS))
-            return ret;
 
-        if(pkt->dts == AV_NOPTS_VALUE && !(s->oformat->flags & 
AVFMT_NOTIMESTAMPS))
-            return AVERROR(EINVAL);
+        if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
+            ret = compute_pkt_fields2(s, st, pkt);
+            if (ret < 0)
+                return ret;
+            if (pkt->dts == AV_NOPTS_VALUE)
+                return AVERROR(EINVAL);
+        }
     } else {
         av_dlog(s, "av_interleaved_write_frame FLUSH\n");
         flush = 1;
-- 
1.7.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to