mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-25 00:32:31 +00:00
rtp: factorize dynamic payload type fallback
Move the identical code in rtp_write_header() and ff_sdp_write_media() inside ff_rtp_get_payload_type() Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
parent
bafff1668c
commit
0c378ea1f7
@ -103,6 +103,11 @@ int ff_rtp_get_payload_type(AVCodecContext *codec)
|
|||||||
continue;
|
continue;
|
||||||
payload_type = AVRtpPayloadTypes[i].pt;
|
payload_type = AVRtpPayloadTypes[i].pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* dynamic payload type */
|
||||||
|
if (payload_type < 0)
|
||||||
|
payload_type = RTP_PT_PRIVATE + (codec->codec_type == AVMEDIA_TYPE_AUDIO);
|
||||||
|
|
||||||
return payload_type;
|
return payload_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,9 +93,6 @@ static int rtp_write_header(AVFormatContext *s1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
s->payload_type = ff_rtp_get_payload_type(st->codec);
|
s->payload_type = ff_rtp_get_payload_type(st->codec);
|
||||||
if (s->payload_type < 0)
|
|
||||||
s->payload_type = RTP_PT_PRIVATE + (st->codec->codec_type == AVMEDIA_TYPE_AUDIO);
|
|
||||||
|
|
||||||
s->base_timestamp = av_get_random_seed();
|
s->base_timestamp = av_get_random_seed();
|
||||||
s->timestamp = s->base_timestamp;
|
s->timestamp = s->base_timestamp;
|
||||||
s->cur_timestamp = 0;
|
s->cur_timestamp = 0;
|
||||||
|
@ -533,9 +533,6 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des
|
|||||||
int payload_type;
|
int payload_type;
|
||||||
|
|
||||||
payload_type = ff_rtp_get_payload_type(c);
|
payload_type = ff_rtp_get_payload_type(c);
|
||||||
if (payload_type < 0) {
|
|
||||||
payload_type = RTP_PT_PRIVATE + (c->codec_type == AVMEDIA_TYPE_AUDIO);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (c->codec_type) {
|
switch (c->codec_type) {
|
||||||
case AVMEDIA_TYPE_VIDEO : type = "video" ; break;
|
case AVMEDIA_TYPE_VIDEO : type = "video" ; break;
|
||||||
|
Loading…
Reference in New Issue
Block a user