]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rtpenc_mpegts.c
rtpenc_mpegts: Set chain->rtp_ctx only after avformat_write_header succeeded
[ffmpeg] / libavformat / rtpenc_mpegts.c
index 8ced6a9d4995aa28c71be153f7ded138ca989980..585d1adc6d01568b18be6a486a686ac518cc720f 100644 (file)
@@ -88,11 +88,10 @@ static int rtp_mpegts_write_header(AVFormatContext *s)
     st->time_base.num   = 1;
     st->time_base.den   = 90000;
     st->codec->codec_id = AV_CODEC_ID_MPEG2TS;
-    chain->rtp_ctx = rtp_ctx;
     rtp_ctx->pb = s->pb;
     if ((ret = avformat_write_header(rtp_ctx, NULL)) < 0)
         goto fail;
-    rtp_ctx = NULL;
+    chain->rtp_ctx = rtp_ctx;
 
     return 0;