sdp: Ignore RTCP packets when autodetecting RTP streams

Message ID 1329145661-91773-1-git-send-email-martin@martin.st
State Committed
Commit f3a094f2da26f62f3461e78a22b115ab8a700b8d
Headers show

Commit Message

Martin Storsjö Feb. 13, 2012, 3:07 p.m.
The rtp demuxer which listens for RTP packets and detects the
RTP payload type will currently get confused if the first packet
received is an RTCP packet. Thus ignore such packets.
---
 libavformat/rtsp.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Luca Barbato Feb. 16, 2012, 3:11 p.m. | #1
On 13/02/12 16:07, Martin Storsjö wrote:
> The rtp demuxer which listens for RTP packets and detects the
> RTP payload type will currently get confused if the first packet
> received is an RTCP packet. Thus ignore such packets.
> ---
>  libavformat/rtsp.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> index 1fb7b2b..f8611de 100644
> --- a/libavformat/rtsp.c
> +++ b/libavformat/rtsp.c
> @@ -1927,6 +1927,9 @@ static int rtp_read_header(AVFormatContext *s)
>              continue;
>          }
>  
> +        if (recvbuf[1] >= RTCP_SR && recvbuf[1] <= RTCP_APP)
> +            continue;
> +
>          payload_type = recvbuf[1] & 0x7f;
>          break;
>      }

Seems ok. what gets misunderstood?

lu
Martin Storsjö Feb. 16, 2012, 3:23 p.m. | #2
On Thu, 16 Feb 2012, Luca Barbato wrote:

> On 13/02/12 16:07, Martin Storsjö wrote:
>> The rtp demuxer which listens for RTP packets and detects the
>> RTP payload type will currently get confused if the first packet
>> received is an RTCP packet. Thus ignore such packets.
>> ---
>>  libavformat/rtsp.c |    3 +++
>>  1 files changed, 3 insertions(+), 0 deletions(-)
>> 
>> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
>> index 1fb7b2b..f8611de 100644
>> --- a/libavformat/rtsp.c
>> +++ b/libavformat/rtsp.c
>> @@ -1927,6 +1927,9 @@ static int rtp_read_header(AVFormatContext *s)
>>              continue;
>>          }
>> 
>> +        if (recvbuf[1] >= RTCP_SR && recvbuf[1] <= RTCP_APP)
>> +            continue;
>> +
>>          payload_type = recvbuf[1] & 0x7f;
>>          break;
>>      }
>
> Seems ok. what gets misunderstood?

Without this, RTCP packets are interpreted as RTP packets of type 
70-something, which we then say we can't handle without an SDP file. With 
this applied, we skip those packets and actually only use the real RTP 
packets for autodetection.

Pushed.

// Martin

Patch

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 1fb7b2b..f8611de 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1927,6 +1927,9 @@  static int rtp_read_header(AVFormatContext *s)
             continue;
         }
 
+        if (recvbuf[1] >= RTCP_SR && recvbuf[1] <= RTCP_APP)
+            continue;
+
         payload_type = recvbuf[1] & 0x7f;
         break;
     }