[FFmpeg-cvslog] avformat/mpegtsenc: first_pts_check -> first_pts_checked

Limin Wang git at videolan.org
Fri Oct 30 16:52:42 EET 2020


ffmpeg | branch: master | Limin Wang <lance.lmwang at gmail.com> | Tue Oct 27 22:26:22 2020 +0800| [27e8a6c44bbe349827990783b7ebd9a44073c4c9] | committer: Limin Wang

avformat/mpegtsenc: first_pts_check -> first_pts_checked

change to first_pts_checked and reverse the logic.

Reviewed-by: Marton Balint <cus at passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang at gmail.com>

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

 libavformat/mpegtsenc.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 29dcaf6bec..383181d2a2 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -232,7 +232,7 @@ typedef struct MpegTSWriteStream {
     int cc;
     int discontinuity;
     int payload_size;
-    int first_pts_check; ///< first pts check needed
+    int first_pts_checked; ///< first pts check needed
     int prev_payload_key;
     int64_t payload_pts;
     int64_t payload_dts;
@@ -1101,7 +1101,6 @@ static int mpegts_init(AVFormatContext *s)
         }
         ts_st->payload_pts     = AV_NOPTS_VALUE;
         ts_st->payload_dts     = AV_NOPTS_VALUE;
-        ts_st->first_pts_check = 1;
         ts_st->cc              = 15;
         ts_st->discontinuity   = ts->flags & MPEGTS_FLAG_DISCONT;
         if (st->codecpar->codec_id == AV_CODEC_ID_AAC &&
@@ -1700,11 +1699,11 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
             dts += delay;
     }
 
-    if (ts_st->first_pts_check && pts == AV_NOPTS_VALUE) {
+    if (!ts_st->first_pts_checked && pts == AV_NOPTS_VALUE) {
         av_log(s, AV_LOG_ERROR, "first pts value must be set\n");
         return AVERROR_INVALIDDATA;
     }
-    ts_st->first_pts_check = 0;
+    ts_st->first_pts_checked = 1;
 
     if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
         const uint8_t *p = buf, *buf_end = p + size;



More information about the ffmpeg-cvslog mailing list