Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make buffer size configurable at compile time and set it to 8192 #74

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ libmpdclient 2.20 (not yet released)
- albumart
* support tags "ComposerSort", "Ensemble", "Movement",
"MovementNumber", "Location"
* configurable buffer size, increase default from 4096 to 8192

libmpdclient 2.19 (2020/07/03)
* fix off-by-one bug in MPD_HOST parser
Expand Down
2 changes: 2 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ conf.set('DEFAULT_PORT', get_option('default_port'))

conf.set('HAVE_STRNDUP', cc.has_function('strndup', prefix: '#define _GNU_SOURCE\n#include <string.h>'))

conf.set('BUFFER_SIZE', get_option('buffer_size'))

platform_deps = []
if host_machine.system() == 'haiku'
platform_deps = [cc.find_library('network')]
Expand Down
4 changes: 4 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ option('documentation', type: 'boolean',
option('test', type: 'boolean',
value: false,
description: 'Enable unit tests')

option('buffer_size', type: 'string',
value: '8192',
description: 'response buffer size')
4 changes: 3 additions & 1 deletion src/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#ifndef MPD_BUFFER_H
#define MPD_BUFFER_H

#include "config.h"

#include <assert.h>
#include <string.h>
#include <stdbool.h>
Expand All @@ -45,7 +47,7 @@ struct mpd_buffer {
unsigned read;

/** the actual buffer */
unsigned char data[4096];
unsigned char data[BUFFER_SIZE];
};

/**
Expand Down