track->rtp_ctx->streams[0]->sample_aspect_ratio =
src_st->sample_aspect_ratio;
- /* Remove the allocated codec context, link to the original one
- * instead, to give the rtp muxer access to codec parameters. */
- av_free(track->rtp_ctx->streams[0]->codec);
- track->rtp_ctx->streams[0]->codec = src_st->codec;
+ avcodec_copy_context(track->rtp_ctx->streams[0]->codec, src_st->codec);
if ((ret = url_open_dyn_packet_buf(&track->rtp_ctx->pb,
RTP_MAX_PACKET_SIZE)) < 0)
}
if (track->rtp_ctx && track->rtp_ctx->streams[0]) {
av_metadata_free(&track->rtp_ctx->streams[0]->metadata);
+ av_free(track->rtp_ctx->streams[0]->codec->extradata);
+ av_free(track->rtp_ctx->streams[0]->codec);
av_free(track->rtp_ctx->streams[0]->info);
av_free(track->rtp_ctx->streams[0]);
}
}
av_metadata_free(&rtp_ctx->streams[0]->metadata);
av_metadata_free(&rtp_ctx->metadata);
+ av_free(rtp_ctx->streams[0]->codec->extradata);
+ av_free(rtp_ctx->streams[0]->codec);
av_free(rtp_ctx->streams[0]->info);
av_free(rtp_ctx->streams[0]);
av_freep(&rtp_ctx);
/* Set the synchronized start time. */
rtpctx->start_time_realtime = s->start_time_realtime;
- /* Remove the local codec, link to the original codec
- * context instead, to give the rtp muxer access to
- * codec parameters. */
- av_free(rtpctx->streams[0]->codec);
- rtpctx->streams[0]->codec = st->codec;
+ avcodec_copy_context(rtpctx->streams[0]->codec, st->codec);
if (handle) {
url_fdopen(&rtpctx->pb, handle);
url_close_dyn_buf(rtpctx->pb, &ptr);
av_free(ptr);
}
+ av_free(rtpctx->streams[0]->codec->extradata);
+ av_free(rtpctx->streams[0]->codec);
av_free(rtpctx->streams[0]->info);
av_free(rtpctx->streams[0]);
av_free(rtpctx);
}
av_metadata_free(&rtpctx->streams[0]->metadata);
av_metadata_free(&rtpctx->metadata);
+ av_free(rtpctx->streams[0]->codec->extradata);
+ av_free(rtpctx->streams[0]->codec);
av_free(rtpctx->streams[0]->info);
av_free(rtpctx->streams[0]);
av_free(rtpctx);
url_fclose(rtpctx->pb);
av_metadata_free(&rtpctx->streams[0]->metadata);
av_metadata_free(&rtpctx->metadata);
+ av_free(rtpctx->streams[0]->codec->extradata);
+ av_free(rtpctx->streams[0]->codec);
av_free(rtpctx->streams[0]->info);
av_free(rtpctx->streams[0]);
av_free(rtpctx);