Revision 1338dc08

View differences:

libavformat/movenchint.c
57 57
    track->rtp_ctx->streams[0]->sample_aspect_ratio =
58 58
                        src_st->sample_aspect_ratio;
59 59

  
60
    /* Remove the allocated codec context, link to the original one
61
     * instead, to give the rtp muxer access to codec parameters. */
62
    av_free(track->rtp_ctx->streams[0]->codec);
63
    track->rtp_ctx->streams[0]->codec = src_st->codec;
60
    avcodec_copy_context(track->rtp_ctx->streams[0]->codec, src_st->codec);
64 61

  
65 62
    if ((ret = url_open_dyn_packet_buf(&track->rtp_ctx->pb,
66 63
                                       RTP_MAX_PACKET_SIZE)) < 0)
......
86 83
    }
87 84
    if (track->rtp_ctx && track->rtp_ctx->streams[0]) {
88 85
        av_metadata_free(&track->rtp_ctx->streams[0]->metadata);
86
        av_free(track->rtp_ctx->streams[0]->codec->extradata);
87
        av_free(track->rtp_ctx->streams[0]->codec);
89 88
        av_free(track->rtp_ctx->streams[0]->info);
90 89
        av_free(track->rtp_ctx->streams[0]);
91 90
    }
......
491 490
    }
492 491
    av_metadata_free(&rtp_ctx->streams[0]->metadata);
493 492
    av_metadata_free(&rtp_ctx->metadata);
493
    av_free(rtp_ctx->streams[0]->codec->extradata);
494
    av_free(rtp_ctx->streams[0]->codec);
494 495
    av_free(rtp_ctx->streams[0]->info);
495 496
    av_free(rtp_ctx->streams[0]);
496 497
    av_freep(&rtp_ctx);
libavformat/rtpenc_chain.c
50 50
    /* Set the synchronized start time. */
51 51
    rtpctx->start_time_realtime = s->start_time_realtime;
52 52

  
53
    /* Remove the local codec, link to the original codec
54
     * context instead, to give the rtp muxer access to
55
     * codec parameters. */
56
    av_free(rtpctx->streams[0]->codec);
57
    rtpctx->streams[0]->codec = st->codec;
53
    avcodec_copy_context(rtpctx->streams[0]->codec, st->codec);
58 54

  
59 55
    if (handle) {
60 56
        url_fdopen(&rtpctx->pb, handle);
......
70 66
            url_close_dyn_buf(rtpctx->pb, &ptr);
71 67
            av_free(ptr);
72 68
        }
69
        av_free(rtpctx->streams[0]->codec->extradata);
70
        av_free(rtpctx->streams[0]->codec);
73 71
        av_free(rtpctx->streams[0]->info);
74 72
        av_free(rtpctx->streams[0]);
75 73
        av_free(rtpctx);
libavformat/rtsp.c
500 500
                }
501 501
                av_metadata_free(&rtpctx->streams[0]->metadata);
502 502
                av_metadata_free(&rtpctx->metadata);
503
                av_free(rtpctx->streams[0]->codec->extradata);
504
                av_free(rtpctx->streams[0]->codec);
503 505
                av_free(rtpctx->streams[0]->info);
504 506
                av_free(rtpctx->streams[0]);
505 507
                av_free(rtpctx);
libavformat/sapenc.c
48 48
        url_fclose(rtpctx->pb);
49 49
        av_metadata_free(&rtpctx->streams[0]->metadata);
50 50
        av_metadata_free(&rtpctx->metadata);
51
        av_free(rtpctx->streams[0]->codec->extradata);
52
        av_free(rtpctx->streams[0]->codec);
51 53
        av_free(rtpctx->streams[0]->info);
52 54
        av_free(rtpctx->streams[0]);
53 55
        av_free(rtpctx);

Also available in: Unified diff