On Sun, 5 Apr 2015, Derek Buitenhuis wrote:

Signed-off-by: Derek Buitenhuis <[email protected]>
---
libavformat/mpegtsenc.c | 10 +++++++---
libavformat/version.h   |  2 +-
2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 28b700e..2340e34 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -84,6 +84,7 @@ typedef struct MpegTSWrite {
    int reemit_pat_pmt; // backward compatibility

    int pcr_period;
+    int sdt_period;
#define MPEGTS_FLAG_REEMIT_PAT_PMT  0x01
#define MPEGTS_FLAG_AAC_LATM        0x02
    int flags;
@@ -189,7 +190,7 @@ static int mpegts_write_section1(MpegTSSection *s, int tid, 
int id,
#define DEFAULT_SERVICE_NAME    "Service01"

/* we retransmit the SI info at this rate */
-#define SDT_RETRANS_TIME 500
+#define SDT_RETRANS_TIME 200
#define PAT_RETRANS_TIME 100
#define PCR_RETRANS_TIME 20


This changes the default value for the CBR case

@@ -645,7 +646,7 @@ static int mpegts_write_header(AVFormatContext *s)
    if (ts->mux_rate > 1) {
        service->pcr_packet_period = (ts->mux_rate * ts->pcr_period) /
                                     (TS_PACKET_SIZE * 8 * 1000);
-        ts->sdt_packet_period      = (ts->mux_rate * SDT_RETRANS_TIME) /
+        ts->sdt_packet_period      = (ts->mux_rate * ts->sdt_period) /
                                     (TS_PACKET_SIZE * 8 * 1000);
        ts->pat_packet_period      = (ts->mux_rate * PAT_RETRANS_TIME) /
                                     (TS_PACKET_SIZE * 8 * 1000);
@@ -653,7 +654,7 @@ static int mpegts_write_header(AVFormatContext *s)
        ts->first_pcr = av_rescale(s->max_delay, PCR_TIME_BASE, AV_TIME_BASE);
    } else {
        /* Arbitrary values, PAT/PMT could be written on key frames */
-        ts->sdt_packet_period = 200;
+        ts->sdt_packet_period = ts->sdt_period;
        ts->pat_packet_period = 40;
        if (pcr_st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
            if (!pcr_st->codec->frame_size) {

This is a bit problematic, when one single option is interpreted in two different units depending on the case. For the CBR case, SDT_RETRANS_TIME previously (and ts->sdt_period after this patch) is interpreted as a value in milliseconds, while for the VBR case below it is interpreted as a number of packets.

I'm a bit unsure how to expose this in the best way via an avoption actually - two different avoptions for the two cases is ugly, while one single option interpreted in two different ways also is problematic. Also, if changing the default value for any case, I'd rather change the value for the VBR case (the CBR case default value makes more sense I think).

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

Reply via email to