summaryrefslogtreecommitdiff
path: root/libavformat/rtpenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-09 13:06:04 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-09 13:06:04 +0200
commitef9fe5bedd1993700818a0ba1c195cd6f6668afe (patch)
tree3c70bf61e4bae16375575e3e6e8dac55fc1ba148 /libavformat/rtpenc.c
parent238e904df3988ea0253ba08c8b2883e4740565b6 (diff)
parenta75b9a1804769169456306f570b6716d977ebdc5 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: mingw/cygwin: Stop adding -fno-common to gcc CFLAGS Restructure av_log_missing_feature message rtp: Support packetization/depacketization of opus file: Set the return value type for lseek to int64_t. ppc: fix Altivec build with old compilers build: add LTO support for PGI compiler build: add -Mdse to PGI optimisation flags rtpenc_vp8: Update the packetizer to the latest spec version rtpdec_vp8: Make the depacketizer implement the latest spec draft doc: allow building with old texi2html versions avutil: skip old_pix_fmts.h since it is just a list Conflicts: libavcodec/aacdec.c libavcodec/h264.c libavcodec/ppc/fmtconvert_altivec.c libavcodec/utils.c libavformat/file.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/rtpenc.c')
-rw-r--r--libavformat/rtpenc.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index ea678a6792..3a5bbeb398 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -77,6 +77,7 @@ static int is_supported(enum AVCodecID id)
case AV_CODEC_ID_ILBC:
case AV_CODEC_ID_MJPEG:
case AV_CODEC_ID_SPEEX:
+ case AV_CODEC_ID_OPUS:
return 1;
default:
return 0;
@@ -181,15 +182,21 @@ static int rtp_write_header(AVFormatContext *s1)
s->max_payload_size -= 6; // ident+frag+tdt/vdt+pkt_num+pkt_length
s->num_frames = 0;
goto defaultcase;
- case AV_CODEC_ID_VP8:
- av_log(s1, AV_LOG_ERROR, "RTP VP8 payload implementation is "
- "incompatible with the latest spec drafts.\n");
- break;
case AV_CODEC_ID_ADPCM_G722:
/* Due to a historical error, the clock rate for G722 in RTP is
* 8000, even if the sample rate is 16000. See RFC 3551. */
avpriv_set_pts_info(st, 32, 1, 8000);
break;
+ case AV_CODEC_ID_OPUS:
+ if (st->codec->channels > 2) {
+ av_log(s1, AV_LOG_ERROR, "Multistream opus not supported in RTP\n");
+ goto fail;
+ }
+ /* The opus RTP RFC says that all opus streams should use 48000 Hz
+ * as clock rate, since all opus sample rates can be expressed in
+ * this clock rate, and sample rate changes on the fly are supported. */
+ avpriv_set_pts_info(st, 32, 1, 48000);
+ break;
case AV_CODEC_ID_ILBC:
if (st->codec->block_align != 38 && st->codec->block_align != 50) {
av_log(s1, AV_LOG_ERROR, "Incorrect iLBC block size specified\n");
@@ -529,6 +536,14 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
case AV_CODEC_ID_MJPEG:
ff_rtp_send_jpeg(s1, pkt->data, size);
break;
+ case AV_CODEC_ID_OPUS:
+ if (size > s->max_payload_size) {
+ av_log(s1, AV_LOG_ERROR,
+ "Packet size %d too large for max RTP payload size %d\n",
+ size, s->max_payload_size);
+ return AVERROR(EINVAL);
+ }
+ /* Intentional fallthrough */
default:
/* better than nothing : send the codec raw data */
rtp_send_raw(s1, pkt->data, size);