From f834700efff651a83442207395c626f5aacbbbfa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristofer=20Bj=C3=B6rkstr=C3=B6m?= Date: Fri, 30 Aug 2019 14:00:52 +0200 Subject: [PATCH] rtsp-client: RTP Info must exist in PLAY response If RTP Info is missing. Then return GST_RTSP_STS_INTERNAL_SERVER_ERROR Fixes #76 --- gst/rtsp-server/rtsp-client.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gst/rtsp-server/rtsp-client.c b/gst/rtsp-server/rtsp-client.c index 5dac08b..7c3ea5c 100644 --- a/gst/rtsp-server/rtsp-client.c +++ b/gst/rtsp-server/rtsp-client.c @@ -2006,7 +2006,8 @@ handle_play_request (GstRTSPClient * client, GstRTSPContext * ctx) goto invalid_mode; /* grab RTPInfo from the media now */ - rtpinfo = gst_rtsp_session_media_get_rtpinfo (sessmedia); + if (!(rtpinfo = gst_rtsp_session_media_get_rtpinfo (sessmedia))) + goto rtp_info_error; /* construct the response now */ code = GST_RTSP_STS_OK; @@ -2014,9 +2015,7 @@ handle_play_request (GstRTSPClient * client, GstRTSPContext * ctx) gst_rtsp_status_as_text (code), ctx->request); /* add the RTP-Info header */ - if (rtpinfo) - gst_rtsp_message_take_header (ctx->response, GST_RTSP_HDR_RTP_INFO, - rtpinfo); + gst_rtsp_message_take_header (ctx->response, GST_RTSP_HDR_RTP_INFO, rtpinfo); if (seek_style) gst_rtsp_message_add_header (ctx->response, GST_RTSP_HDR_SEEK_STYLE, seek_style); @@ -2138,6 +2137,12 @@ adjust_play_response_failed: send_generic_response (client, code, ctx); return FALSE; } +rtp_info_error: + { + GST_ERROR ("client %p: failed to add RTP-Info", client); + send_generic_response (client, GST_RTSP_STS_INTERNAL_SERVER_ERROR, ctx); + return FALSE; + } } static void -- 2.7.4