Commit ca732d43 authored by lucabe's avatar lucabe

Make rtp_write_header() fail in case of unsupported payload type


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@18204 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent db36904e
...@@ -39,6 +39,31 @@ static uint64_t ntp_time(void) ...@@ -39,6 +39,31 @@ static uint64_t ntp_time(void)
return (av_gettime() / 1000) * 1000 + NTP_OFFSET_US; return (av_gettime() / 1000) * 1000 + NTP_OFFSET_US;
} }
static int is_supported(enum CodecID id)
{
switch(id) {
case CODEC_ID_H264:
case CODEC_ID_MPEG1VIDEO:
case CODEC_ID_MPEG2VIDEO:
case CODEC_ID_MPEG4:
case CODEC_ID_AAC:
case CODEC_ID_MP2:
case CODEC_ID_MP3:
case CODEC_ID_PCM_ALAW:
case CODEC_ID_PCM_MULAW:
case CODEC_ID_PCM_S8:
case CODEC_ID_PCM_S16BE:
case CODEC_ID_PCM_S16LE:
case CODEC_ID_PCM_U16BE:
case CODEC_ID_PCM_U16LE:
case CODEC_ID_PCM_U8:
case CODEC_ID_MPEG2TS:
return 1;
default:
return 0;
}
}
static int rtp_write_header(AVFormatContext *s1) static int rtp_write_header(AVFormatContext *s1)
{ {
RTPMuxContext *s = s1->priv_data; RTPMuxContext *s = s1->priv_data;
...@@ -48,6 +73,11 @@ static int rtp_write_header(AVFormatContext *s1) ...@@ -48,6 +73,11 @@ static int rtp_write_header(AVFormatContext *s1)
if (s1->nb_streams != 1) if (s1->nb_streams != 1)
return -1; return -1;
st = s1->streams[0]; st = s1->streams[0];
if (!is_supported(st->codec->codec_id)) {
av_log(s1, AV_LOG_ERROR, "Unsupported codec %x\n", st->codec->codec_id);
return -1;
}
payload_type = ff_rtp_get_payload_type(st->codec); payload_type = ff_rtp_get_payload_type(st->codec);
if (payload_type < 0) if (payload_type < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment