[FFmpeg-cvslog] sdp: Make opus declaration conform to the spec

Timothy B. Terriberry git at videolan.org
Mon Sep 29 20:33:07 CEST 2014


ffmpeg | branch: master | Timothy B. Terriberry <tterribe at xiph.org> | Wed Sep 24 17:43:22 2014 -0700| [a05f5052fef3b3743fab7846da12861d8a8098ec] | committer: Martin Storsjö

sdp: Make opus declaration conform to the spec

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a05f5052fef3b3743fab7846da12861d8a8098ec
---

 libavformat/sdp.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 3c39ac7..eccd676 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... */



More information about the ffmpeg-cvslog mailing list