|
|
@@ -298,6 +298,9 @@ 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;
|
|
|
|
|
|
@@ -521,25 +524,16 @@ ff_real_parse_sdp_a_line (AVFormatContext *s, int stream_index,
|
|
|
real_parse_asm_rulebook(s, s->streams[stream_index], p);
|
|
|
}
|
|
|
|
|
|
-static PayloadContext *
|
|
|
-rdt_new_context (void)
|
|
|
-{
|
|
|
- PayloadContext *rdt = av_mallocz(sizeof(PayloadContext));
|
|
|
- if (!rdt)
|
|
|
- return NULL;
|
|
|
-
|
|
|
- rdt->rmctx = avformat_alloc_context();
|
|
|
- if (!rdt->rmctx)
|
|
|
- av_freep(&rdt);
|
|
|
|
|
|
- return rdt;
|
|
|
-}
|
|
|
|
|
|
-static int
|
|
|
-rdt_init_context (AVFormatContext *s, int st_index, PayloadContext *rdt)
|
|
|
+static av_cold int rdt_init(AVFormatContext *s, int st_index, PayloadContext *rdt)
|
|
|
{
|
|
|
int ret;
|
|
|
|
|
|
+ rdt->rmctx = avformat_alloc_context();
|
|
|
+ if (!rdt->rmctx)
|
|
|
+ return AVERROR(ENOMEM);
|
|
|
+
|
|
|
if ((ret = ff_copy_whitelists(rdt->rmctx, s)) < 0)
|
|
|
return ret;
|
|
|
|
|
|
@@ -568,9 +562,9 @@ static RTPDynamicProtocolHandler rdt_ ## n ## _handler = { \
|
|
|
.enc_name = s, \
|
|
|
.codec_type = t, \
|
|
|
.codec_id = AV_CODEC_ID_NONE, \
|
|
|
+ .priv_data_size = sizeof(PayloadContext), \
|
|
|
+ .init = rdt_init, \
|
|
|
.parse_sdp_a_line = rdt_parse_sdp_line, \
|
|
|
- .alloc = rdt_new_context, \
|
|
|
- .init = rdt_init_context, \
|
|
|
.free = rdt_free_context, \
|
|
|
.parse_packet = rdt_parse_packet \
|
|
|
}
|