]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/sdp.c
lavf/webm_dash: Fix incorrect bandwidth computation
[ffmpeg] / libavformat / sdp.c
index 8c831f3607369419806a8ea1480ae6915fa8eb40..d7429523e8913f3e4c2e0945473412509198c7c3 100644 (file)
@@ -428,6 +428,12 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
                                     payload_type,
                                     payload_type, c->width, c->height);
             break;
+        case AV_CODEC_ID_HEVC:
+            if (c->extradata_size)
+                av_log(NULL, AV_LOG_WARNING, "HEVC extradata not currently "
+                                             "passed properly through SDP\n");
+            av_strlcatf(buff, size, "a=rtpmap:%d H265/90000\r\n", payload_type);
+            break;
         case AV_CODEC_ID_MPEG4:
             if (c->extradata_size) {
                 config = extradata2config(c);
@@ -591,8 +597,18 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
             }
             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... */