aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/decoder_api.c2
-rw-r--r--src/decoder_control.c2
-rw-r--r--src/decoder_control.h11
-rw-r--r--src/decoder_thread.c5
-rw-r--r--src/player_thread.c12
5 files changed, 16 insertions, 16 deletions
diff --git a/src/decoder_api.c b/src/decoder_api.c
index 7681b7b85..2350396a9 100644
--- a/src/decoder_api.c
+++ b/src/decoder_api.c
@@ -86,7 +86,7 @@ char *decoder_get_uri(G_GNUC_UNUSED struct decoder *decoder)
assert(dc->pipe != NULL);
- return song_get_uri(dc->current_song);
+ return song_get_uri(dc->song);
}
enum decoder_command decoder_get_command(G_GNUC_UNUSED struct decoder * decoder)
diff --git a/src/decoder_control.c b/src/decoder_control.c
index b3092f773..058cd3f33 100644
--- a/src/decoder_control.c
+++ b/src/decoder_control.c
@@ -89,7 +89,7 @@ dc_start(struct decoder_control *dc, struct song *song)
assert(dc->pipe != NULL);
assert(song != NULL);
- dc->next_song = song;
+ dc->song = song;
dc_command(dc, DECODE_COMMAND_START);
}
diff --git a/src/decoder_control.h b/src/decoder_control.h
index f3bd26d53..a70adff05 100644
--- a/src/decoder_control.h
+++ b/src/decoder_control.h
@@ -72,8 +72,13 @@ struct decoder_control {
/** the format being sent to the music pipe */
struct audio_format out_audio_format;
- const struct song *current_song;
- const struct song *next_song;
+ /**
+ * The song currently being decoded. This attribute is set by
+ * the player thread, when it sends the #DECODE_COMMAND_START
+ * command.
+ */
+ const struct song *song;
+
float total_time;
/** the #music_chunk allocator */
@@ -198,7 +203,7 @@ decoder_current_song(const struct decoder_control *dc)
case DECODE_STATE_START:
case DECODE_STATE_DECODE:
- return dc->current_song;
+ return dc->song;
}
assert(false);
diff --git a/src/decoder_thread.c b/src/decoder_thread.c
index d02e6985c..175f343e0 100644
--- a/src/decoder_thread.c
+++ b/src/decoder_thread.c
@@ -268,9 +268,11 @@ decoder_run_song(struct decoder_control *dc,
static void
decoder_run(struct decoder_control *dc)
{
- const struct song *song = dc->next_song;
+ const struct song *song = dc->song;
char *uri;
+ assert(song != NULL);
+
if (song_is_file(song))
uri = map_song_fs(song);
else
@@ -281,7 +283,6 @@ decoder_run(struct decoder_control *dc)
return;
}
- dc->current_song = dc->next_song; /* NEED LOCK */
decoder_run_song(dc, song, uri);
g_free(uri);
diff --git a/src/player_thread.c b/src/player_thread.c
index e648ab375..fa02a2e0e 100644
--- a/src/player_thread.c
+++ b/src/player_thread.c
@@ -160,10 +160,8 @@ player_wait_for_decoder(struct player *player)
struct decoder_control *dc = player->dc;
if (decoder_lock_has_failed(dc)) {
- assert(dc->next_song == NULL || dc->next_song->uri != NULL);
-
player_lock();
- pc.errored_song = dc->next_song;
+ pc.errored_song = dc->song;
pc.error = PLAYER_ERROR_FILE;
pc.next_song = NULL;
player_unlock();
@@ -210,11 +208,9 @@ player_check_decoder_startup(struct player *player)
if (decoder_has_failed(dc)) {
/* the decoder failed */
- assert(dc->next_song == NULL || dc->next_song->uri != NULL);
-
decoder_unlock(dc);
- pc.errored_song = dc->next_song;
+ pc.errored_song = dc->song;
pc.error = PLAYER_ERROR_FILE;
return false;
@@ -237,12 +233,11 @@ player_check_decoder_startup(struct player *player)
if (!player->paused &&
!audio_output_all_open(&dc->out_audio_format,
player_buffer)) {
- char *uri = song_get_uri(dc->next_song);
+ char *uri = song_get_uri(dc->song);
g_warning("problems opening audio device "
"while playing \"%s\"", uri);
g_free(uri);
- assert(dc->next_song == NULL || dc->next_song->uri != NULL);
pc.error = PLAYER_ERROR_AUDIO;
/* pause: the user may resume playback as soon
@@ -433,7 +428,6 @@ static void player_process_command(struct player *player)
} else {
/* the audio device has failed - rollback to
pause mode */
- assert(dc->next_song == NULL || dc->next_song->uri != NULL);
pc.error = PLAYER_ERROR_AUDIO;
player->paused = true;