On Sun, 5 Apr 2015, Derek Buitenhuis wrote:

This saves a lot of muxing overhead, especially on lower bitrate
segments.

Signed-off-by: Derek Buitenhuis <[email protected]>
---
libavformat/hlsenc.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 21c9526..5c3b8c3 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -190,8 +190,16 @@ static int hls_start(AVFormatContext *s)
                          &s->interrupt_callback, NULL)) < 0)
        return err;

-    if (oc->oformat->priv_class && oc->priv_data)
+    /* We only require one PAT/PMT per segment. */
+    if (oc->oformat->priv_class && oc->priv_data) {
+        char period[21];
+
+        snprintf(period, sizeof(period), "%d", INT_MAX);
+
        av_opt_set(oc->priv_data, "mpegts_flags", "resend_headers", 0);
+        av_opt_set(oc->priv_data, "sdt_period", period, 0);
+        av_opt_set(oc->priv_data, "pat_period", period, 0);

For things like this, you could use av_opt_set_int. But in this case, these don't need to be reset for each segment at all, but could be set just once at startup, via an AVDictionary to avformat_write_header.

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

Reply via email to