aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorTimothy B. Terriberry <tterribe@xiph.org>2014-09-24 17:43:22 -0700
committerMartin Storsjö <martin@martin.st>2014-09-29 13:48:42 +0300
commita05f5052fef3b3743fab7846da12861d8a8098ec (patch)
tree5ab1b87891f0644f632dbad9079a25f8c5110a2d /libavformat
parent551746680462538bb5ad7adf55fb1248190428ec (diff)
downloadffmpeg-a05f5052fef3b3743fab7846da12861d8a8098ec.tar.gz
sdp: Make opus declaration conform to the spec
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/sdp.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 3c39ac7988..eccd676f01 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -583,8 +583,18 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
payload_type, c->sample_rate);
break;
case AV_CODEC_ID_OPUS:
- av_strlcatf(buff, size, "a=rtpmap:%d opus/48000\r\n",
+ /* The opus RTP draft says that all opus streams MUST be declared
+ as stereo, to avoid negotiation failures. The actual number of
+ channels can change on a packet-by-packet basis. The number of
+ channels a receiver prefers to receive or a sender plans to send
+ can be declared via fmtp parameters (both default to mono), but
+ receivers MUST be able to receive and process stereo packets. */
+ av_strlcatf(buff, size, "a=rtpmap:%d opus/48000/2\r\n",
payload_type);
+ if (c->channels == 2) {
+ av_strlcatf(buff, size, "a=fmtp:%d sprop-stereo:1\r\n",
+ payload_type);
+ }
break;
default:
/* Nothing special to do here... */