rtspsrc: Cleanup code for next pending command

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4799>
This commit is contained in:
Jochen Henneberg 2023-06-05 07:29:57 +02:00 committed by Tim-Philipp Müller
parent 89ece711dd
commit 33e789e067

View file

@ -9341,23 +9341,33 @@ gst_rtspsrc_thread (GstRTSPSrc * src)
GST_OBJECT_LOCK (src); GST_OBJECT_LOCK (src);
cmd = src->pending_cmd; cmd = src->pending_cmd;
if (cmd == CMD_RECONNECT || cmd == CMD_PLAY || cmd == CMD_PAUSE
|| cmd == CMD_LOOP || cmd == CMD_OPEN || cmd == CMD_GET_PARAMETER switch (cmd) {
|| cmd == CMD_SET_PARAMETER) { case CMD_CLOSE:
if (g_queue_is_empty (&src->set_get_param_q)) { src->pending_cmd = CMD_WAIT;
src->pending_cmd = CMD_LOOP; break;
if (cmd == CMD_GET_PARAMETER || cmd == CMD_SET_PARAMETER) case CMD_GET_PARAMETER:
cmd = CMD_LOOP; case CMD_SET_PARAMETER:
} else { req = g_queue_pop_head (&src->set_get_param_q);
ParameterRequest *next_req; if (!req)
if (cmd == CMD_GET_PARAMETER || cmd == CMD_SET_PARAMETER) { cmd = CMD_LOOP;
req = g_queue_pop_head (&src->set_get_param_q); /* fall through */
case CMD_OPEN:
case CMD_PLAY:
case CMD_PAUSE:
case CMD_LOOP:
case CMD_RECONNECT:
if (g_queue_is_empty (&src->set_get_param_q)) {
src->pending_cmd = CMD_LOOP;
} else {
ParameterRequest *next_req;
next_req = g_queue_peek_head (&src->set_get_param_q);
src->pending_cmd = next_req->cmd;
} }
next_req = g_queue_peek_head (&src->set_get_param_q); break;
src->pending_cmd = next_req ? next_req->cmd : CMD_LOOP; default:
} break;
} else }
src->pending_cmd = CMD_WAIT;
GST_DEBUG_OBJECT (src, "got command %s", cmd_to_string (cmd)); GST_DEBUG_OBJECT (src, "got command %s", cmd_to_string (cmd));
/* we got the message command, so ensure communication is possible again */ /* we got the message command, so ensure communication is possible again */