summaryrefslogtreecommitdiff
path: root/streamer.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-09-16 21:47:02 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-09-16 21:47:02 +0200
commit7862cac471309c7e81a482693481fd161477e884 (patch)
tree25b2d2657452774ab2ec266cd8d9e9a287656066 /streamer.c
parent8d7d55da6bb3d750c500b0de90ce1764ce163dc1 (diff)
fixed crash when last song is deleted during streamer final drain
Diffstat (limited to 'streamer.c')
-rw-r--r--streamer.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/streamer.c b/streamer.c
index e74866f1..84c5f7e8 100644
--- a/streamer.c
+++ b/streamer.c
@@ -63,8 +63,8 @@ playItem_t str_streaming_song;
static playItem_t *orig_playing_song;
static playItem_t *orig_streaming_song;
-//#define trace(...) { fprintf(stderr, __VA_ARGS__); }
-#define trace(fmt,...)
+#define trace(...) { fprintf(stderr, __VA_ARGS__); }
+//#define trace(fmt,...)
// playlist must call that whenever item was removed
void
@@ -239,6 +239,14 @@ streamer_thread (uintptr_t ctx) {
}
if (bytes_until_next_song == 0) {
+ if (!str_streaming_song.fname) {
+ // means last song was deleted during final drain
+ nextsong = -1;
+ p_stop ();
+ messagepump_push (M_SONGCHANGED, 0, pl_get_idx_of (playlist_current_ptr), -1);
+ streamer_set_current (NULL);
+ continue;
+ }
trace ("bytes_until_next_song=0, starting playback of new song\n");
bytes_until_next_song = -1;
// plugin will get pointer to str_playing_song
@@ -360,7 +368,7 @@ streamer_read_async (char *bytes, int size) {
codec_lock ();
DB_decoder_t *decoder = str_streaming_song.decoder;
if (!decoder) {
- trace ("no decoder!\n");
+ // means there's nothing left to stream, so just do nothing
codec_unlock ();
break;
}