From d65841a2db7b8ee94306b5aa3751825d627d25c3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 6 Mar 2014 13:08:30 +0100 Subject: [PATCH 1/7] configure.ac: prepare for 0.18.10 --- NEWS | 2 ++ configure.ac | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 7a3173f57..7a12778d5 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +ver 0.18.10 (not yet released) + ver 0.18.9 (2014/03/02) * protocol - "findadd" requires the "add" permission diff --git a/configure.ac b/configure.ac index 81bdcea24..ae3a2341c 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ(2.60) -AC_INIT(mpd, 0.18.9, mpd-devel@musicpd.org) +AC_INIT(mpd, 0.18.10, mpd-devel@musicpd.org) VERSION_MAJOR=0 VERSION_MINOR=18 From a9e351e00d023829a5bb7def60208eef826b2ef3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 6 Mar 2014 13:12:39 +0100 Subject: [PATCH 2/7] decoder/gme: fix memory leak in container_scan() --- NEWS | 2 ++ src/decoder/GmeDecoderPlugin.cxx | 1 + 2 files changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 7a12778d5..e5f19470e 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.18.10 (not yet released) +* decoder + - gme: fix memory leak ver 0.18.9 (2014/03/02) * protocol diff --git a/src/decoder/GmeDecoderPlugin.cxx b/src/decoder/GmeDecoderPlugin.cxx index 815fd8d69..d67ee4b42 100644 --- a/src/decoder/GmeDecoderPlugin.cxx +++ b/src/decoder/GmeDecoderPlugin.cxx @@ -117,6 +117,7 @@ gme_container_scan(const char *path_fs, const unsigned int tnum) } const unsigned num_songs = gme_track_count(emu); + gme_delete(emu); /* if it only contains a single tune, don't treat as container */ if (num_songs < 2) return nullptr; From 8e39cf62e7f84eca6f8b431bf721281d50653892 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 18 Mar 2014 09:10:36 +0100 Subject: [PATCH 3/7] decoder/ffmpeg: pass AVSEEK_FLAG_ANY to av_seek_frame() This corrects a major mistake from commit 724a59aa - there was one small thing that commit was supposed to do, and it failed. AV_TIME_BASE is not a seek flag. --- NEWS | 1 + src/decoder/FfmpegDecoderPlugin.cxx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index e5f19470e..5abed4964 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,6 @@ ver 0.18.10 (not yet released) * decoder + - ffmpeg: fix seeking bug - gme: fix memory leak ver 0.18.9 (2014/03/02) diff --git a/src/decoder/FfmpegDecoderPlugin.cxx b/src/decoder/FfmpegDecoderPlugin.cxx index 593f42d39..e1e848bf3 100644 --- a/src/decoder/FfmpegDecoderPlugin.cxx +++ b/src/decoder/FfmpegDecoderPlugin.cxx @@ -496,7 +496,7 @@ ffmpeg_decode(Decoder &decoder, InputStream &input) av_stream->start_time; if (av_seek_frame(format_context, audio_stream, where, - AV_TIME_BASE) < 0) + AVSEEK_FLAG_ANY) < 0) decoder_seek_error(decoder); else { avcodec_flush_buffers(codec_context); From ce18c36ed9328b4b5d376562594d8acb13a6723d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 18 Mar 2014 08:19:05 +0100 Subject: [PATCH 4/7] decoder/ffmpeg: handle unknown stream start time --- NEWS | 1 + src/decoder/FfmpegDecoderPlugin.cxx | 27 +++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 5abed4964..66db1f6d8 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ ver 0.18.10 (not yet released) * decoder - ffmpeg: fix seeking bug + - ffmpeg: handle unknown stream start time - gme: fix memory leak ver 0.18.9 (2014/03/02) diff --git a/src/decoder/FfmpegDecoderPlugin.cxx b/src/decoder/FfmpegDecoderPlugin.cxx index e1e848bf3..bcb1ae3c9 100644 --- a/src/decoder/FfmpegDecoderPlugin.cxx +++ b/src/decoder/FfmpegDecoderPlugin.cxx @@ -197,6 +197,29 @@ time_to_ffmpeg(double t, const AVRational time_base) time_base); } +/** + * Replace #AV_NOPTS_VALUE with the given fallback. + */ +static constexpr int64_t +timestamp_fallback(int64_t t, int64_t fallback) +{ + return gcc_likely(t != int64_t(AV_NOPTS_VALUE)) + ? t + : fallback; +} + +/** + * Accessor for AVStream::start_time that replaces AV_NOPTS_VALUE with + * zero. We can't use AV_NOPTS_VALUE in calculations, and we simply + * assume that the stream's start time is zero, which appears to be + * the best way out of that situation. + */ +static int64_t +start_time_fallback(const AVStream &stream) +{ + return timestamp_fallback(stream.start_time, 0); +} + static void copy_interleave_frame2(uint8_t *dest, uint8_t **src, unsigned nframes, unsigned nchannels, @@ -263,7 +286,7 @@ ffmpeg_send_packet(Decoder &decoder, InputStream &is, { if (packet->pts >= 0 && packet->pts != (int64_t)AV_NOPTS_VALUE) decoder_timestamp(decoder, - time_from_ffmpeg(packet->pts - stream->start_time, + time_from_ffmpeg(packet->pts - start_time_fallback(*stream), stream->time_base)); AVPacket packet2 = *packet; @@ -493,7 +516,7 @@ ffmpeg_decode(Decoder &decoder, InputStream &input) int64_t where = time_to_ffmpeg(decoder_seek_where(decoder), av_stream->time_base) + - av_stream->start_time; + start_time_fallback(*av_stream); if (av_seek_frame(format_context, audio_stream, where, AVSEEK_FLAG_ANY) < 0) From 3a4e667078e13f27b3d196d3b3a56f1f39be2c75 Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Wed, 9 Apr 2014 23:10:14 +0200 Subject: [PATCH 5/7] PlaylistEdit: don't interrupt playback when current song gets deleted --- NEWS | 1 + src/PlaylistEdit.cxx | 18 ++++++++---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/NEWS b/NEWS index 66db1f6d8..3ab9a5b67 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ ver 0.18.10 (not yet released) - ffmpeg: fix seeking bug - ffmpeg: handle unknown stream start time - gme: fix memory leak +* don't interrupt playback when current song gets deleted ver 0.18.9 (2014/03/02) * protocol diff --git a/src/PlaylistEdit.cxx b/src/PlaylistEdit.cxx index 668612a1a..3eea2491e 100644 --- a/src/PlaylistEdit.cxx +++ b/src/PlaylistEdit.cxx @@ -234,12 +234,8 @@ playlist::DeleteInternal(PlayerControl &pc, if (playing && current == (int)songOrder) { const bool paused = pc.GetState() == PlayerState::PAUSE; - /* the current song is going to be deleted: stop the player */ - - pc.Stop(); - playing = false; - - /* see which song is going to be played instead */ + /* the current song is going to be deleted: see which + song is going to be played instead */ current = queue.GetNextOrder(current); if (current == (int)songOrder) @@ -248,10 +244,12 @@ playlist::DeleteInternal(PlayerControl &pc, if (current >= 0 && !paused) /* play the song after the deleted one */ PlayOrder(pc, current); - else - /* no songs left to play, stop playback - completely */ - Stop(pc); + else { + /* stop the player */ + + pc.Stop(); + playing = false; + } *queued_p = nullptr; } else if (current == (int)songOrder) From 95ac6071b9fdaa543bd0c8ab7665d262db708683 Mon Sep 17 00:00:00 2001 From: Marcello Desantis Date: Wed, 9 Apr 2014 23:58:56 +0200 Subject: [PATCH 6/7] decoder/sndfile: work around libsndfile bug on partial read --- NEWS | 1 + src/decoder/SndfileDecoderPlugin.cxx | 26 ++++++++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 3ab9a5b67..0c30b5eda 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ ver 0.18.10 (not yet released) - ffmpeg: fix seeking bug - ffmpeg: handle unknown stream start time - gme: fix memory leak + - sndfile: work around libsndfile bug on partial read * don't interrupt playback when current song gets deleted ver 0.18.9 (2014/03/02) diff --git a/src/decoder/SndfileDecoderPlugin.cxx b/src/decoder/SndfileDecoderPlugin.cxx index 3360cd1bf..77b132962 100644 --- a/src/decoder/SndfileDecoderPlugin.cxx +++ b/src/decoder/SndfileDecoderPlugin.cxx @@ -55,14 +55,28 @@ sndfile_vio_read(void *ptr, sf_count_t count, void *user_data) { InputStream &is = *(InputStream *)user_data; + sf_count_t total_bytes = 0; Error error; - size_t nbytes = is.LockRead(ptr, count, error); - if (nbytes == 0 && error.IsDefined()) { - LogError(error); - return -1; - } - return nbytes; + /* this loop is necessary because libsndfile chokes on partial + reads */ + + do { + size_t nbytes = is.LockRead((char *)ptr + total_bytes, + count - total_bytes, error); + if (nbytes == 0) { + if (error.IsDefined()) { + LogError(error); + return -1; + } + + break; + } + + total_bytes += nbytes; + } while (total_bytes < count); + + return total_bytes; } static sf_count_t From d0119548c116ae038b1a1f625f11c4815d3a4bd8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 10 Apr 2014 13:36:38 +0200 Subject: [PATCH 7/7] release v0.18.10 --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 0c30b5eda..d87626bd9 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -ver 0.18.10 (not yet released) +ver 0.18.10 (2014/04/10) * decoder - ffmpeg: fix seeking bug - ffmpeg: handle unknown stream start time