summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2013-03-05 11:14:41 +0100
committerWim Taymans <wim.taymans@collabora.co.uk>2013-03-11 12:28:19 +0100
commit9baef63f5b49d0c9ba3c041a655135a7a0989c07 (patch)
tree20422df1a234c27b37011dd4c475294ba90366c2 /tools
parent31fbc86e09864354a058143039c484bad0344673 (diff)
launch: don't exit the loop on buffering in paused
When we receive a buffering message of 100% in the paused state, we exit the event_loop and move to the PLAYING state. What should happen is that we wait for both ASYNC-DONE and 100% buffering before continueing.
Diffstat (limited to 'tools')
-rw-r--r--tools/gst-launch.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/tools/gst-launch.c b/tools/gst-launch.c
index 5d4ee4654..bd7a85bef 100644
--- a/tools/gst-launch.c
+++ b/tools/gst-launch.c
@@ -493,6 +493,7 @@ event_loop (GstElement * pipeline, gboolean blocking, GstState target_state)
GstMessage *message = NULL;
EventLoopResult res = ELR_NO_ERROR;
gboolean buffering = FALSE;
+ gboolean prerolled = target_state != GST_STATE_PAUSED;
bus = gst_element_get_bus (GST_ELEMENT (pipeline));
@@ -665,19 +666,19 @@ event_loop (GstElement * pipeline, gboolean blocking, GstState target_state)
if (GST_MESSAGE_SRC (message) != GST_OBJECT_CAST (pipeline))
break;
- /* ignore when we are buffering since then we mess with the states
- * ourselves. */
- if (buffering) {
- PRINT (_("Prerolled, waiting for buffering to finish...\n"));
- break;
- }
-
gst_message_parse_state_changed (message, &old, &new, &pending);
/* if we reached the final target state, exit */
- if (target_state == GST_STATE_PAUSED && new == target_state)
+ if (target_state == GST_STATE_PAUSED && new == target_state) {
+ prerolled = TRUE;
+ /* ignore when we are buffering since then we mess with the states
+ * ourselves. */
+ if (buffering) {
+ PRINT (_("Prerolled, waiting for buffering to finish...\n"));
+ break;
+ }
goto exit;
-
+ }
/* else not an interesting message */
break;
}
@@ -698,7 +699,7 @@ event_loop (GstElement * pipeline, gboolean blocking, GstState target_state)
if (target_state == GST_STATE_PLAYING) {
PRINT (_("Done buffering, setting pipeline to PLAYING ...\n"));
gst_element_set_state (pipeline, GST_STATE_PLAYING);
- } else
+ } else if (prerolled)
goto exit;
} else {
/* buffering busy */