client: suspend after SDP and unsuspend before PLAYING
authorWim Taymans <wtaymans@redhat.com>
Thu, 28 Nov 2013 13:14:35 +0000 (14:14 +0100)
committerWim Taymans <wtaymans@redhat.com>
Thu, 28 Nov 2013 15:18:40 +0000 (16:18 +0100)
Based on patches by Ognyan Tonchev <ognyan@axis.com>

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=711257

gst/rtsp-server/rtsp-client.c

index 76f8c8c..162f52c 100644 (file)
@@ -1074,6 +1074,10 @@ handle_play_request (GstRTSPClient * client, GstRTSPContext * ctx)
   if (rtspstate != GST_RTSP_STATE_PLAYING && rtspstate != GST_RTSP_STATE_READY)
     goto invalid_state;
 
+  /* in play we first unsuspend, media could be suspended from SDP or PAUSED */
+  if (!gst_rtsp_media_unsuspend (media))
+    goto unsuspend_failed;
+
   /* parse the range header if we have one */
   res = gst_rtsp_message_get_header (ctx->request, GST_RTSP_HDR_RANGE, &str, 0);
   if (res == GST_RTSP_OK) {
@@ -1194,6 +1198,13 @@ invalid_state:
     g_free (path);
     return FALSE;
   }
+unsuspend_failed:
+  {
+    GST_ERROR ("client %p: unsuspend failed", client);
+    send_generic_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx);
+    g_free (path);
+    return FALSE;
+  }
 }
 
 static void
@@ -1755,6 +1766,8 @@ handle_describe_request (GstRTSPClient * client, GstRTSPContext * ctx)
   if (!(sdp = klass->create_sdp (client, media)))
     goto no_sdp;
 
+  /* we suspend after the describe */
+  gst_rtsp_media_suspend (media);
   g_object_unref (media);
 
   gst_rtsp_message_init_response (ctx->response, GST_RTSP_STS_OK,