diff options
author | Jan Schmidt <jan@centricular.com> | 2020-10-30 03:38:15 +1100 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2020-10-31 11:40:08 +0000 |
commit | 09ab239ebdd9791518b6aee1ffdf1e6b509ca890 (patch) | |
tree | 71c78efd842f20a3977e2bd4539e63ebfb0fc10a | |
parent | a300aa43b1c662d504f22cfb42c6e07cf02273ef (diff) | |
download | gstreamer-plugins-good-09ab239ebdd9791518b6aee1ffdf1e6b509ca890.tar.gz |
splitmuxsink: Don't busy loop on a non-ready pad.
If a pad gets into the check_completed_gop method and then
the underlying conditions change on the reference context,
things could get stuck in a busy loop when the context should
instead jump back out and wait for more data.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/799>
-rw-r--r-- | gst/multifile/gstsplitmuxsink.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gst/multifile/gstsplitmuxsink.c b/gst/multifile/gstsplitmuxsink.c index d4161c5f6..675d7b749 100644 --- a/gst/multifile/gstsplitmuxsink.c +++ b/gst/multifile/gstsplitmuxsink.c @@ -2503,16 +2503,19 @@ check_completed_gop (GstSplitMuxSink * splitmux, MqStreamCtx * ctx) if (ctx->in_eos) return; - /* Some pad is not yet ready, or GOP is being pushed - * either way, sleep and wait to get woken */ - if (splitmux->input_state == SPLITMUX_INPUT_STATE_WAITING_GOP_COLLECT && !ctx->flushing && (ctx->in_running_time >= splitmux->max_in_running_time) && (splitmux->max_in_running_time != GST_CLOCK_STIME_NONE)) { + /* Some pad is not yet ready, or GOP is being pushed + * either way, sleep and wait to get woken */ GST_LOG_OBJECT (splitmux, "Sleeping for GOP collection (ctx %p)", ctx); GST_SPLITMUX_WAIT_INPUT (splitmux); GST_LOG_OBJECT (splitmux, "Done waiting for complete GOP (ctx %p)", ctx); + } else { + /* This pad is not ready or the state changed - break out and get another + * buffer / event */ + break; } } while (splitmux->input_state == SPLITMUX_INPUT_STATE_WAITING_GOP_COLLECT); } |