From 9c92afa5fef58f3a7781d9cd95de26ab07cdd079 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 13 Feb 2012 18:10:09 +0100 Subject: output/winmm: remove pointless NULL check pcm_buffer_get() cannot ever return NULL. --- src/output/winmm_output_plugin.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src') diff --git a/src/output/winmm_output_plugin.c b/src/output/winmm_output_plugin.c index b9687874d..4312c635e 100644 --- a/src/output/winmm_output_plugin.c +++ b/src/output/winmm_output_plugin.c @@ -200,11 +200,7 @@ winmm_set_buffer(struct winmm_output *wo, struct winmm_buffer *buffer, GError **error_r) { void *dest = pcm_buffer_get(&buffer->buffer, size); - if (dest == NULL) { - g_set_error(error_r, winmm_output_quark(), 0, - "Out of memory"); - return false; - } + assert(dest != NULL); memcpy(dest, data, size); -- cgit v1.2.3 From 7855a3257980e45dec7cc57e998a5b4fa1504903 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 13 Feb 2012 18:05:42 +0100 Subject: pcm_buffer: pcm_buffer_get() never returns NULL This fixes a bug when libsamplerate returns an empty buffer for a very small input buffer. The caller thinks this is an error, bug there is no GError object. --- src/pcm_buffer.c | 5 +++++ src/pcm_buffer.h | 4 ++++ 2 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/pcm_buffer.c b/src/pcm_buffer.c index b0449d44e..60a699b20 100644 --- a/src/pcm_buffer.c +++ b/src/pcm_buffer.c @@ -34,6 +34,11 @@ pcm_buffer_get(struct pcm_buffer *buffer, size_t size) { assert(buffer != NULL); + if (size == 0) + /* never return NULL, because NULL would be assumed to + be an error condition */ + size = 1; + if (buffer->size < size) { /* free the old buffer */ g_free(buffer->buffer); diff --git a/src/pcm_buffer.h b/src/pcm_buffer.h index fe223c742..b132d4fd2 100644 --- a/src/pcm_buffer.h +++ b/src/pcm_buffer.h @@ -63,6 +63,10 @@ pcm_buffer_deinit(struct pcm_buffer *buffer) /** * Get the buffer, and guarantee a minimum size. This buffer becomes * invalid with the next pcm_buffer_get() call. + * + * This function will never return NULL, even if size is zero, because + * the PCM library uses the NULL return value to signal "error". An + * empty destination buffer is not always an error. */ G_GNUC_MALLOC void * -- cgit v1.2.3 From e1e3ce980af1f2fb1c4b4f3e4788a4f478bc43e7 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 13 Feb 2012 18:27:43 +0100 Subject: decoder_api: check state before emitting initial seek command This fixes seeking in the vorbis decoder during MPD startup. --- src/decoder_api.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/decoder_api.c b/src/decoder_api.c index 695ca0281..19de47855 100644 --- a/src/decoder_api.c +++ b/src/decoder_api.c @@ -89,6 +89,12 @@ decoder_prepare_initial_seek(struct decoder *decoder) const struct decoder_control *dc = decoder->dc; assert(dc->pipe != NULL); + if (dc->state != DECODE_STATE_DECODE) + /* wait until the decoder has finished initialisation + (reading file headers etc.) before emitting the + virtual "SEEK" command */ + return false; + if (decoder->initial_seek_running) /* initial seek has already begun - override any other command */ -- cgit v1.2.3 From 103832742d4ef2b6bb86d287b8557ab3e64dba21 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 13 Feb 2012 19:05:39 +0100 Subject: decoder/ffmpeg: read the "year" tag This was disabled when compiled with a new ffmpeg version. Older ffmpeg versions used it explicitly, while newer ones may pass it through from the codec. --- src/decoder/ffmpeg_decoder_plugin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/decoder/ffmpeg_decoder_plugin.c b/src/decoder/ffmpeg_decoder_plugin.c index 52632dc4a..2929d316a 100644 --- a/src/decoder/ffmpeg_decoder_plugin.c +++ b/src/decoder/ffmpeg_decoder_plugin.c @@ -597,8 +597,8 @@ typedef struct ffmpeg_tag_map { static const ffmpeg_tag_map ffmpeg_tag_maps[] = { #if LIBAVFORMAT_VERSION_INT < ((52<<16)+(50<<8)) { TAG_ARTIST, "author" }, - { TAG_DATE, "year" }, #endif + { TAG_DATE, "year" }, { TAG_ARTIST_SORT, "author-sort" }, { TAG_ALBUM_ARTIST, "album_artist" }, { TAG_ALBUM_ARTIST_SORT, "album_artist-sort" }, -- cgit v1.2.3