]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rdt.c
rtpenc_mpegts: Set chain->rtp_ctx only after avformat_write_header succeeded
[ffmpeg] / libavformat / rdt.c
index 2574496d2fd1f3839248ba11b9ebb131301300a1..5478f88fc689d594c8f5ab384949177455695b03 100644 (file)
@@ -298,16 +298,13 @@ rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st,
     int seq = 1, res;
     AVIOContext pb;
 
-    if (!rdt->rmctx)
-        return AVERROR(EINVAL);
-
     if (rdt->audio_pkt_cnt == 0) {
-        int pos;
+        int pos, rmflags;
 
         ffio_init_context(&pb, buf, len, 0, NULL, NULL, NULL, NULL);
-        flags = (flags & RTP_FLAG_KEY) ? 2 : 0;
+        rmflags = (flags & RTP_FLAG_KEY) ? 2 : 0;
         res = ff_rm_parse_packet (rdt->rmctx, &pb, st, rdt->rmst[st->index], len, pkt,
-                                  &seq, flags, *timestamp);
+                                  &seq, rmflags, *timestamp);
         pos = avio_tell(&pb);
         if (res < 0)
             return res;
@@ -530,7 +527,7 @@ static av_cold int rdt_init(AVFormatContext *s, int st_index, PayloadContext *rd
 }
 
 static void
-rdt_free_context (PayloadContext *rdt)
+rdt_close_context (PayloadContext *rdt)
 {
     int i;
 
@@ -553,7 +550,7 @@ static RTPDynamicProtocolHandler rdt_ ## n ## _handler = { \
     .priv_data_size   = sizeof(PayloadContext), \
     .init             = rdt_init, \
     .parse_sdp_a_line = rdt_parse_sdp_line, \
-    .free             = rdt_free_context, \
+    .close            = rdt_close_context, \
     .parse_packet     = rdt_parse_packet \
 }