rtsp: Initialize the media_type_mask in the rtp guessing demuxer

Message ID 1322816964-32448-1-git-send-email-martin@martin.st
State Committed
Commit 30266038bdfdecd244edbd91f19e19cb159a74ab
Headers show

Commit Message

Martin Storsjö Dec. 2, 2011, 9:09 a.m.
The media_type_mask is initialized via AVOptions for the
rtsp and sdp demuxers, but it isn't available as an option
for the rtp guessing demuxer (since it doesn't really make
sense there). Therefore, it must be manually initialized
instead, since a zero value means no media types at all
are accepted.
---
 libavformat/rtsp.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Luca Barbato Dec. 2, 2011, 9:11 a.m. | #1
On 02/12/11 10:09, Martin Storsjö wrote:
> The media_type_mask is initialized via AVOptions for the
> rtsp and sdp demuxers, but it isn't available as an option
> for the rtp guessing demuxer (since it doesn't really make
> sense there). Therefore, it must be manually initialized
> instead, since a zero value means no media types at all
> are accepted.
> ---

Ok.

Patch

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 7548a41..b63f9f6 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1934,6 +1934,7 @@  static int rtp_read_header(AVFormatContext *s,
     struct sockaddr_storage addr;
     AVIOContext pb;
     socklen_t addrlen = sizeof(addr);
+    RTSPState *rt = s->priv_data;
 
     if (!ff_network_init())
         return AVERROR(EIO);
@@ -1997,6 +1998,8 @@  static int rtp_read_header(AVFormatContext *s,
     /* sdp_read_header initializes this again */
     ff_network_close();
 
+    rt->media_type_mask = (1 << (AVMEDIA_TYPE_DATA+1)) - 1;
+
     ret = sdp_read_header(s, ap);
     s->pb = NULL;
     return ret;