From fa4beeee75f6f4a8377d6fb2ab0844b8b7105840 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 11 Dec 2014 10:50:20 +0100 Subject: decoder/ffmpeg: detect and fix negative time stamps Works around assertion failure due to something that appears to be a (minor) FFmpeg bug. --- src/decoder/FfmpegDecoderPlugin.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/decoder/FfmpegDecoderPlugin.cxx b/src/decoder/FfmpegDecoderPlugin.cxx index 8a0937903..9a00bf3c4 100644 --- a/src/decoder/FfmpegDecoderPlugin.cxx +++ b/src/decoder/FfmpegDecoderPlugin.cxx @@ -284,10 +284,13 @@ ffmpeg_send_packet(Decoder &decoder, InputStream &is, AVFrame *frame, uint8_t **buffer, int *buffer_size) { - if (packet->pts >= 0 && packet->pts != (int64_t)AV_NOPTS_VALUE) - decoder_timestamp(decoder, - time_from_ffmpeg(packet->pts - start_time_fallback(*stream), - stream->time_base)); + if (packet->pts >= 0 && packet->pts != (int64_t)AV_NOPTS_VALUE) { + auto start = start_time_fallback(*stream); + if (packet->pts >= start) + decoder_timestamp(decoder, + time_from_ffmpeg(packet->pts - start, + stream->time_base)); + } AVPacket packet2 = *packet; -- cgit v1.2.3 From 773de38bd9e018e48cf5b0a4f009dedce090bf0a Mon Sep 17 00:00:00 2001 From: k44 Date: Tue, 16 Dec 2014 18:43:05 +0100 Subject: playlist/embcue: fix filename suffix detection The definition of the playlist_plugin struct member of the embcue plugin was incorrect. --- src/playlist/EmbeddedCuePlaylistPlugin.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/playlist/EmbeddedCuePlaylistPlugin.cxx b/src/playlist/EmbeddedCuePlaylistPlugin.cxx index 2734fa59e..9ad71b8a8 100644 --- a/src/playlist/EmbeddedCuePlaylistPlugin.cxx +++ b/src/playlist/EmbeddedCuePlaylistPlugin.cxx @@ -178,7 +178,7 @@ const struct playlist_plugin embcue_playlist_plugin = { embcue_playlist_open_uri, nullptr, - embcue_playlist_suffixes, nullptr, + embcue_playlist_suffixes, nullptr, }; -- cgit v1.2.3 From 81f17d10c8a817cd9f2b40608c7ccdf5d038ad8a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 17 Dec 2014 18:45:32 +0100 Subject: util/HugeAllocator: enable MEM_COMMIT on Windows Without MEM_COMMIT, the reserved address space is not accessible, and MPD crashes. --- src/util/HugeAllocator.hxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/util/HugeAllocator.hxx b/src/util/HugeAllocator.hxx index e02e69f10..fa45e5610 100644 --- a/src/util/HugeAllocator.hxx +++ b/src/util/HugeAllocator.hxx @@ -71,7 +71,9 @@ static inline void * HugeAllocate(size_t size) { // TODO: use MEM_LARGE_PAGES - return VirtualAlloc(nullptr, size, MEM_RESERVE, PAGE_READWRITE); + return VirtualAlloc(nullptr, size, + MEM_COMMIT|MEM_RESERVE, + PAGE_READWRITE); } static inline void -- cgit v1.2.3 From 90709b332a5514e19d572138cbd96c9364740bf8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 17 Dec 2014 18:05:44 +0100 Subject: LogInit: make stderr line-buffered Make sure everything gets logged right away. No delays because stdio's buffer is not yet full. --- src/LogInit.cxx | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/LogInit.cxx b/src/LogInit.cxx index accd1d4d8..117c6d8dc 100644 --- a/src/LogInit.cxx +++ b/src/LogInit.cxx @@ -111,6 +111,9 @@ log_early_init(bool verbose) #ifdef ANDROID (void)verbose; #else + /* force stderr to be line-buffered */ + setvbuf(stderr, nullptr, _IOLBF, 0); + if (verbose) SetLogThreshold(LogLevel::DEBUG); #endif -- cgit v1.2.3 From c5720a15c76a15debadc9205afa2558f11e5d9ff Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 17 Dec 2014 18:08:09 +0100 Subject: LogBackend: force-flush stderr on WIN32 setvbuf() does not seem to have an effect on Windows. --- src/LogBackend.cxx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/LogBackend.cxx b/src/LogBackend.cxx index 6591fef2d..04c2e6324 100644 --- a/src/LogBackend.cxx +++ b/src/LogBackend.cxx @@ -194,6 +194,12 @@ FileLog(const Domain &domain, const char *message) domain.GetName(), chomp_length(message), message); +#ifdef WIN32 + /* force-flush the log file, because setvbuf() does not seem + to have an effect on WIN32 */ + fflush(stderr); +#endif + #ifdef HAVE_GLIB g_free(converted); #endif -- cgit v1.2.3