When mux_rate (CBR) is defined, pat/sdt period setting is now respected. In case of VBR, leave it as it was.

---
 libavformat/mpegtsenc.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index fc0ea225c6..5ad1f813e0 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -999,10 +999,18 @@ static int mpegts_init(AVFormatContext *s)
     ts->last_sdt_ts = AV_NOPTS_VALUE;
     // The user specified a period, use only it
     if (ts->pat_period < INT_MAX/2) {
-        ts->pat_packet_period = INT_MAX;
+        if (ts->mux_rate > 1)
+            ts->pat_packet_period = (int64_t)ts->mux_rate * ts->pat_period /
+                                    (TS_PACKET_SIZE * 8);
+        else
+            ts->pat_packet_period = INT_MAX;
     }
     if (ts->sdt_period < INT_MAX/2) {
-        ts->sdt_packet_period = INT_MAX;
+        if (ts->mux_rate > 1)
+            ts->sdt_packet_period = (int64_t)ts->mux_rate * ts->sdt_period /
+                                    (TS_PACKET_SIZE * 8);
+        else
+            ts->sdt_packet_period = INT_MAX;
     }

     // output a PCR as soon as possible
--
2.19.1

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to