62 lines
1.8 KiB
Diff
62 lines
1.8 KiB
Diff
|
From f6e6eeae032fc8a4e33cb46193480c106f86207d Mon Sep 17 00:00:00 2001
|
||
|
From: Jeffy Chen <jeffy.chen@rock-chips.com>
|
||
|
Date: Mon, 3 Oct 2022 15:07:33 +0800
|
||
|
Subject: [PATCH 4/4] gst-launch: Fix random hang when EOS
|
||
|
|
||
|
There's a race between the async initial pause and initial play.
|
||
|
|
||
|
When the async pausing message arrives later than the playing one, the
|
||
|
gstbin's state machine would be confused.
|
||
|
|
||
|
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
|
||
|
---
|
||
|
tools/gst-launch.c | 12 ++++++++++++
|
||
|
1 file changed, 12 insertions(+)
|
||
|
|
||
|
diff --git a/tools/gst-launch.c b/tools/gst-launch.c
|
||
|
index 7d93993..fc3aa16 100644
|
||
|
--- a/tools/gst-launch.c
|
||
|
+++ b/tools/gst-launch.c
|
||
|
@@ -82,6 +82,7 @@ static gboolean eos_on_shutdown = FALSE;
|
||
|
static gchar **exclude_args = NULL;
|
||
|
|
||
|
/* pipeline status */
|
||
|
+static gboolean pending_async_done = FALSE;
|
||
|
static gboolean is_live = FALSE;
|
||
|
static gboolean buffering = FALSE;
|
||
|
static LaunchExitCode last_launch_code = LEC_NO_ERROR;
|
||
|
@@ -741,12 +742,22 @@ bus_handler (GstBus * bus, GstMessage * message, gpointer data)
|
||
|
PRINT (_("Prerolled, waiting for progress to finish...\n"));
|
||
|
break;
|
||
|
}
|
||
|
+ if (pending_async_done) {
|
||
|
+ PRINT (_("Prerolled, waiting for async message to finish...\n"));
|
||
|
+ break;
|
||
|
+ }
|
||
|
|
||
|
do_initial_play (pipeline);
|
||
|
}
|
||
|
/* else not an interesting message */
|
||
|
break;
|
||
|
}
|
||
|
+ case GST_MESSAGE_ASYNC_DONE:
|
||
|
+ {
|
||
|
+ if (target_state == GST_STATE_PAUSED)
|
||
|
+ do_initial_play (pipeline);
|
||
|
+ break;
|
||
|
+ }
|
||
|
case GST_MESSAGE_BUFFERING:{
|
||
|
gint percent;
|
||
|
|
||
|
@@ -1279,6 +1290,7 @@ real_main (int argc, char *argv[])
|
||
|
break;
|
||
|
case GST_STATE_CHANGE_ASYNC:
|
||
|
PRINT (_("Pipeline is PREROLLING ...\n"));
|
||
|
+ pending_async_done = TRUE;
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
--
|
||
|
2.20.1
|
||
|
|