Skip to content

Commit 5324ccb

Browse files
committed
ChicleMediaPipeline: Don't block on the path queue needlessly
Allow starting fewer than the maximum amount of loaders each go-around. This makes the edge case where you're typing names in one at a time return results immediately.
1 parent e6682d5 commit 5324ccb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tools/chafa/chicle-media-pipeline.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,11 @@ fill_pipeline (ChicleMediaPipeline *pipeline)
172172
if (slot->path)
173173
break;
174174

175-
slot->path = chicle_path_queue_pop (pipeline->path_queue);
175+
/* Get at least one path, more if available. If we get NULL from a
176+
* blocking pop, the path queue is done. */
177+
slot->path = chicle_path_queue_try_pop (pipeline->path_queue);
178+
if (!slot->path && i == 0)
179+
slot->path = chicle_path_queue_pop (pipeline->path_queue);
176180
if (!slot->path)
177181
break;
178182

@@ -230,7 +234,6 @@ wait_for_next (ChicleMediaPipeline *pipeline,
230234
g_error_free (slot->error);
231235

232236
memset (slot, 0, sizeof (*slot));
233-
fill_pipeline (pipeline);
234237
pipeline->first_slot++;
235238
result = TRUE;
236239
break;

0 commit comments

Comments
 (0)