rtsp: Discard the dynamic handler, if it has an alloc function which failed
authorMartin Storsjö <martin@martin.st>
Sun, 6 Nov 2011 21:50:39 +0000 (23:50 +0200)
committerMartin Storsjö <martin@martin.st>
Mon, 7 Nov 2011 09:23:56 +0000 (11:23 +0200)
Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/rtsp.c

index c673c35..84cf922 100644 (file)
@@ -172,8 +172,11 @@ static void init_rtp_handler(RTPDynamicProtocolHandler *handler,
         return;
     codec->codec_id          = handler->codec_id;
     rtsp_st->dynamic_handler = handler;
-    if (handler->alloc)
+    if (handler->alloc) {
         rtsp_st->dynamic_protocol_context = handler->alloc();
+        if (!rtsp_st->dynamic_protocol_context)
+            rtsp_st->dynamic_handler = NULL;
+    }
 }
 
 /* parse the rtpmap description: <codec_name>/<clock_rate>[/<other params>] */