]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rtpdec.c
Revert "wmapro: prevent division by zero when sample rate is unspecified"
[ffmpeg] / libavformat / rtpdec.c
index 7e8b52adad50394e46986504492778329c0f23ad..2c5e6c817650243d570eece591fddd14af8b14d2 100644 (file)
 
 #include "libavutil/mathematics.h"
 #include "libavutil/avstring.h"
+#include "libavutil/time.h"
 #include "libavcodec/get_bits.h"
 #include "avformat.h"
 #include "mpegts.h"
 #include "url.h"
 
-#include <unistd.h>
 #include "network.h"
 
 #include "rtpdec.h"
@@ -66,7 +66,9 @@ void av_register_rtp_dynamic_payload_handlers(void)
     ff_register_dynamic_payload_handler(&ff_amr_wb_dynamic_handler);
     ff_register_dynamic_payload_handler(&ff_h263_1998_dynamic_handler);
     ff_register_dynamic_payload_handler(&ff_h263_2000_dynamic_handler);
+    ff_register_dynamic_payload_handler(&ff_h263_rfc2190_dynamic_handler);
     ff_register_dynamic_payload_handler(&ff_h264_dynamic_handler);
+    ff_register_dynamic_payload_handler(&ff_ilbc_dynamic_handler);
     ff_register_dynamic_payload_handler(&ff_vorbis_dynamic_handler);
     ff_register_dynamic_payload_handler(&ff_theora_dynamic_handler);
     ff_register_dynamic_payload_handler(&ff_qdm2_dynamic_handler);
@@ -299,7 +301,7 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
     avio_w8(pb, RTCP_SDES);
     len = strlen(s->hostname);
     avio_wb16(pb, (6 + len + 3) / 4); /* length in words - 1 */
-    avio_wb32(pb, s->ssrc);
+    avio_wb32(pb, s->ssrc + 1);
     avio_w8(pb, 0x01);
     avio_w8(pb, len);
     avio_write(pb, s->hostname, len);
@@ -384,7 +386,7 @@ RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext
             av_free(s);
             return NULL;
         }
-    } else {
+    } else if (st) {
         switch(st->codec->codec_id) {
         case CODEC_ID_MPEG1VIDEO:
         case CODEC_ID_MPEG2VIDEO:
@@ -395,6 +397,9 @@ RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext
         case CODEC_ID_H264:
             st->need_parsing = AVSTREAM_PARSE_FULL;
             break;
+        case CODEC_ID_VORBIS:
+            st->need_parsing = AVSTREAM_PARSE_HEADERS;
+            break;
         case CODEC_ID_ADPCM_G722:
             /* According to RFC 3551, the stream clock rate is 8000
              * even if the sample rate is 16000. */
@@ -694,7 +699,7 @@ static int rtp_parse_one_packet(RTPDemuxContext *s, AVPacket *pkt,
 
     if ((buf[0] & 0xc0) != (RTP_VERSION << 6))
         return -1;
-    if (buf[1] >= RTCP_SR && buf[1] <= RTCP_APP) {
+    if (RTP_PT_IS_RTCP(buf[1])) {
         return rtcp_parse_packet(s, buf, len);
     }