Commit 13cd6b28 authored by Max Kellermann's avatar Max Kellermann

player_thread: removed player_stop_decoder()

Replaced both player_stop_decoder() invocations with player_dc_stop(), which also cleans up the pipe.
parent 903a07b8
...@@ -125,13 +125,6 @@ player_dc_stop(struct player *player) ...@@ -125,13 +125,6 @@ player_dc_stop(struct player *player)
} }
} }
static void player_stop_decoder(void)
{
dc_stop(&pc.notify);
pc.state = PLAYER_STATE_STOP;
event_pipe_emit(PIPE_EVENT_PLAYLIST);
}
static bool static bool
player_wait_for_decoder(struct player *player) player_wait_for_decoder(struct player *player)
{ {
...@@ -562,9 +555,10 @@ static void do_play(void) ...@@ -562,9 +555,10 @@ static void do_play(void)
dc.pipe = player.pipe; dc.pipe = player.pipe;
dc_start(&pc.notify, pc.next_song); dc_start(&pc.notify, pc.next_song);
if (!player_wait_for_decoder(&player)) { if (!player_wait_for_decoder(&player)) {
player_stop_decoder(); player_dc_stop(&player);
player_command_finished(); player_command_finished();
music_pipe_free(player.pipe); music_pipe_free(player.pipe);
event_pipe_emit(PIPE_EVENT_PLAYLIST);
return; return;
} }
...@@ -685,15 +679,13 @@ static void do_play(void) ...@@ -685,15 +679,13 @@ static void do_play(void)
pc.next_song = NULL; pc.next_song = NULL;
} }
player_stop_decoder(); player_dc_stop(&player);
if (dc.pipe != NULL && dc.pipe != player.pipe) {
music_pipe_clear(dc.pipe, player_buffer);
music_pipe_free(dc.pipe);
}
music_pipe_clear(player.pipe, player_buffer); music_pipe_clear(player.pipe, player_buffer);
music_pipe_free(player.pipe); music_pipe_free(player.pipe);
pc.state = PLAYER_STATE_STOP;
event_pipe_emit(PIPE_EVENT_PLAYLIST);
} }
static gpointer player_task(G_GNUC_UNUSED gpointer arg) static gpointer player_task(G_GNUC_UNUSED gpointer arg)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment