[1/3] rtsp: Discard the dynamic handler, if it has an alloc method which failed

Message ID 1320618479-75827-1-git-send-email-martin@martin.st
State Committed
Commit 4b3dc857e416f9ec187cb14fd133226456ba7f91
Headers show

Commit Message

Martin Storsjö Nov. 6, 2011, 10:27 p.m.
---
 libavformat/rtsp.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

Comments

Luca Barbato Nov. 6, 2011, 11:08 p.m. | #1
On 11/6/11 2:27 PM, Martin Storsjö wrote:
> ---

The whole patchset looks fine.

Patch

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index c673c35..84cf922 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -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>] */