]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/sdp.c
movenc: remove uses of deprecated API.
[ffmpeg] / libavformat / sdp.c
index dd925bce4c018619dc8e9002b48b8019a6ac8dbb..2a8821815a2d462e8ed3b157025774ea7d0c1844 100644 (file)
@@ -21,6 +21,7 @@
 #include <string.h>
 #include "libavutil/avstring.h"
 #include "libavutil/base64.h"
+#include "libavutil/parseutils.h"
 #include "libavcodec/xiph.h"
 #include "avformat.h"
 #include "internal.h"
@@ -56,7 +57,9 @@ static void sdp_write_address(char *buff, int size, const char *dest_addr,
     if (dest_addr) {
         if (!dest_type)
             dest_type = "IP4";
-        if (ttl > 0) {
+        if (ttl > 0 && !strcmp(dest_type, "IP4")) {
+            /* The TTL should only be specified for IPv4 multicast addresses,
+             * not for IPv6. */
             av_strlcatf(buff, size, "c=IN %s %s/%d\r\n", dest_type, dest_addr, ttl);
         } else {
             av_strlcatf(buff, size, "c=IN %s %s\r\n", dest_type, dest_addr);
@@ -80,7 +83,7 @@ static void sdp_write_header(char *buff, int size, struct sdp_session_level *s)
 
 #if CONFIG_NETWORK
 static int resolve_destination(char *dest_addr, int size, char *type,
-                                int type_size)
+                               int type_size)
 {
     struct addrinfo hints, *ai;
     int is_multicast;
@@ -97,15 +100,17 @@ static int resolve_destination(char *dest_addr, int size, char *type,
         return 0;
     getnameinfo(ai->ai_addr, ai->ai_addrlen, dest_addr, size,
                 NULL, 0, NI_NUMERICHOST);
+#ifdef AF_INET6
     if (ai->ai_family == AF_INET6)
         av_strlcpy(type, "IP6", type_size);
+#endif
     is_multicast = ff_is_multicast_address(ai->ai_addr);
     freeaddrinfo(ai);
     return is_multicast;
 }
 #else
 static int resolve_destination(char *dest_addr, int size, char *type,
-                                int type_size)
+                               int type_size)
 {
     return 0;
 }
@@ -132,11 +137,11 @@ static int sdp_get_address(char *dest_addr, int size, int *ttl, const char *url)
     if (p) {
         char buff[64];
 
-            if (find_info_tag(buff, sizeof(buff), "ttl", p)) {
-                *ttl = strtol(buff, NULL, 10);
-            } else {
-                *ttl = 5;
-            }
+        if (av_find_info_tag(buff, sizeof(buff), "ttl", p)) {
+            *ttl = strtol(buff, NULL, 10);
+        } else {
+            *ttl = 5;
+        }
     }
 
     return port;
@@ -310,7 +315,14 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
             break;
         case CODEC_ID_H263:
         case CODEC_ID_H263P:
-            av_strlcatf(buff, size, "a=rtpmap:%d H263-2000/90000\r\n", payload_type);
+            /* a=framesize is required by 3GPP TS 26.234 (PSS). It
+             * actually specifies the maximum video size, but we only know
+             * the current size. This is required for playback on Android
+             * stagefright and on Samsung bada. */
+            av_strlcatf(buff, size, "a=rtpmap:%d H263-2000/90000\r\n"
+                                    "a=framesize:%d %d-%d\r\n",
+                                    payload_type,
+                                    payload_type, c->width, c->height);
             break;
         case CODEC_ID_MPEG4:
             if (c->extradata_size) {