[SCM] libgroove/upstream: player: thread cleanup only if thread was initialized

andrewrk-guest at users.alioth.debian.org andrewrk-guest at users.alioth.debian.org
Sat May 31 19:00:02 UTC 2014


The following commit has been merged in the upstream branch:
commit cedd18ce9790f68c47524a80974c99c1d100b686
Author: Andrew Kelley <superjoe30 at gmail.com>
Date:   Tue May 20 16:10:05 2014 -0700

    player: thread cleanup only if thread was initialized

diff --git a/grooveplayer/player.c b/grooveplayer/player.c
index 6f9d3b7..4d6c85f 100644
--- a/grooveplayer/player.c
+++ b/grooveplayer/player.c
@@ -37,6 +37,7 @@ struct GroovePlayerPrivate {
 
     // for dummy player
     pthread_t thread_id;
+    int thread_inited;
     int abort_request;
     uint64_t start_nanos;
     uint64_t frames_consumed;
@@ -442,6 +443,7 @@ int groove_player_attach(struct GroovePlayer *player, struct GroovePlaylist *pla
             av_log(NULL, AV_LOG_ERROR, "unable to create dummy player thread\n");
             return -1;
         }
+        p->thread_inited = 1;
     } else {
         SDL_PauseAudioDevice(p->device_id, 0);
     }
@@ -463,8 +465,11 @@ int groove_player_detach(struct GroovePlayer *player) {
         SDL_CloseAudioDevice(p->device_id);
         p->device_id = 0;
     }
-    pthread_cond_signal(&p->pause_cond);
-    pthread_join(p->thread_id, NULL);
+    if (p->thread_inited) {
+        pthread_cond_signal(&p->pause_cond);
+        pthread_join(p->thread_id, NULL);
+        p->thread_inited = 0;
+    }
 
     player->playlist = NULL;
 

-- 
libgroove packaging



More information about the pkg-multimedia-commits mailing list