aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-09-11 19:24:52 +0200
committerMax Kellermann <max@duempel.org>2014-09-11 19:26:58 +0200
commita464dc681a64514ad7b8b8dbb7e4c64ea0561396 (patch)
tree7cd84bd8fcd394f73920d46a9628b79450f40cb3 /src
parentaf384d9aa6f216d3c5b890e3bd52140536c09686 (diff)
parenteaf675dc92fbe0143fdc0e9c4234bd78a889decf (diff)
downloadmpd-a464dc681a64514ad7b8b8dbb7e4c64ea0561396.tar.gz
mpd-a464dc681a64514ad7b8b8dbb7e4c64ea0561396.tar.xz
mpd-a464dc681a64514ad7b8b8dbb7e4c64ea0561396.zip
Merge tag 'v0.18.14'
Diffstat (limited to 'src')
-rw-r--r--src/decoder/DecoderAPI.cxx4
-rw-r--r--src/decoder/DecoderInternal.cxx3
-rw-r--r--src/decoder/DecoderThread.cxx12
-rw-r--r--src/decoder/plugins/FfmpegDecoderPlugin.cxx13
-rw-r--r--src/protocol/ArgParser.cxx4
5 files changed, 33 insertions, 3 deletions
diff --git a/src/decoder/DecoderAPI.cxx b/src/decoder/DecoderAPI.cxx
index c3cbb3a21..4794d60e7 100644
--- a/src/decoder/DecoderAPI.cxx
+++ b/src/decoder/DecoderAPI.cxx
@@ -48,6 +48,7 @@ decoder_initialized(Decoder &decoder,
assert(dc.state == DecoderState::START);
assert(dc.pipe != nullptr);
+ assert(dc.pipe->IsEmpty());
assert(decoder.convert == nullptr);
assert(decoder.stream_tag == nullptr);
assert(decoder.decoder_tag == nullptr);
@@ -461,6 +462,9 @@ decoder_data(Decoder &decoder,
length == 0)
return cmd;
+ assert(!decoder.initial_seek_pending);
+ assert(!decoder.initial_seek_running);
+
/* send stream tags */
if (update_stream_tag(decoder, is)) {
diff --git a/src/decoder/DecoderInternal.cxx b/src/decoder/DecoderInternal.cxx
index 416a75b75..f35878682 100644
--- a/src/decoder/DecoderInternal.cxx
+++ b/src/decoder/DecoderInternal.cxx
@@ -85,6 +85,9 @@ Decoder::GetChunk()
void
Decoder::FlushChunk()
{
+ assert(!seeking);
+ assert(!initial_seek_running);
+ assert(!initial_seek_pending);
assert(chunk != nullptr);
if (chunk->IsEmpty())
diff --git a/src/decoder/DecoderThread.cxx b/src/decoder/DecoderThread.cxx
index 3f4f7c42e..b2b41b661 100644
--- a/src/decoder/DecoderThread.cxx
+++ b/src/decoder/DecoderThread.cxx
@@ -25,6 +25,7 @@
#include "DecoderPlugin.hxx"
#include "DetachedSong.hxx"
#include "system/FatalError.hxx"
+#include "MusicPipe.hxx"
#include "fs/Traits.hxx"
#include "fs/AllocatedPath.hxx"
#include "DecoderAPI.hxx"
@@ -449,9 +450,18 @@ decoder_task(void *arg)
dc.replay_gain_prev_db = dc.replay_gain_db;
dc.replay_gain_db = 0;
- /* fall through */
+ decoder_run(dc);
+ break;
case DecoderCommand::SEEK:
+ /* this seek was too late, and the decoder had
+ already finished; start a new decoder */
+
+ /* we need to clear the pipe here; usually the
+ PlayerThread is responsible, but it is not
+ aware that the decoder has finished */
+ dc.pipe->Clear(*dc.buffer);
+
decoder_run(dc);
break;
diff --git a/src/decoder/plugins/FfmpegDecoderPlugin.cxx b/src/decoder/plugins/FfmpegDecoderPlugin.cxx
index 7f4ac8bcc..904e21a5a 100644
--- a/src/decoder/plugins/FfmpegDecoderPlugin.cxx
+++ b/src/decoder/plugins/FfmpegDecoderPlugin.cxx
@@ -412,10 +412,23 @@ ffmpeg_probe(Decoder *decoder, InputStream &is)
nbytes -= PADDING;
AVProbeData avpd;
+
+ /* new versions of ffmpeg may add new attributes, and leaving
+ them uninitialized may crash; hopefully, zero-initializing
+ everything we don't know is ok */
+ memset(&avpd, 0, sizeof(avpd));
+
avpd.buf = buffer;
avpd.buf_size = nbytes;
avpd.filename = is.GetURI();
+#ifdef AVPROBE_SCORE_MIME
+ /* this attribute was added in libav/ffmpeg version 11, but
+ unfortunately it's "uint8_t" instead of "char", and it's
+ not "const" - wtf? */
+ avpd.mime_type = (uint8_t *)const_cast<char *>(is.GetMimeType());
+#endif
+
return av_probe_input_format(&avpd, true);
}
diff --git a/src/protocol/ArgParser.cxx b/src/protocol/ArgParser.cxx
index e3a0c107c..e373827b4 100644
--- a/src/protocol/ArgParser.cxx
+++ b/src/protocol/ArgParser.cxx
@@ -82,7 +82,7 @@ check_range(Client &client, unsigned *value_r1, unsigned *value_r2,
/* compatibility with older MPD versions: specifying
"-1" makes MPD display the whole list */
*value_r1 = 0;
- *value_r2 = std::numeric_limits<unsigned>::max();
+ *value_r2 = std::numeric_limits<int>::max();
return true;
}
@@ -109,7 +109,7 @@ check_range(Client &client, unsigned *value_r1, unsigned *value_r2,
}
if (test == test2)
- value = std::numeric_limits<unsigned>::max();
+ value = std::numeric_limits<int>::max();
if (value < 0) {
command_error(client, ACK_ERROR_ARG,