summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2015-06-13 01:35:59 +0530
committerTim-Philipp Müller <tim@centricular.com>2015-06-12 21:14:57 +0100
commit4d42704312091c9fc71b5f3f99ae69c171111089 (patch)
tree9fe5153b41e130106b4deb37fd03fbcc587341be
parent5da10b4f57f5f1a9490873f4f13302c03ece3e09 (diff)
downloadgstreamer-plugins-bad-4d42704312091c9fc71b5f3f99ae69c171111089.tar.gz
examples: playout: Decrement the currently-playing counter correctly
Only do that when we're removing an item that was playing, otherwise we'll mess things up while trying to edit the play queue (playlist).
-rw-r--r--tests/examples/playout.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/examples/playout.c b/tests/examples/playout.c
index 29ae812c5..05afe210a 100644
--- a/tests/examples/playout.c
+++ b/tests/examples/playout.c
@@ -757,8 +757,9 @@ playout_app_remove_item (PlayoutItem * item)
g_mutex_lock (&app->play_queue_lock);
g_ptr_array_remove (app->play_queue, item);
- /* This item has been removed from the array, decrement the index */
- app->play_queue_current--;
+ if (item->state >= PLAYOUT_ITEM_STATE_ACTIVATED)
+ /* Removed item was playing; decrement the current-play-queue index */
+ app->play_queue_current--;
g_mutex_unlock (&app->play_queue_lock);
/* Don't call this again */