mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
a2dp: improve codec specific transport socket send buffer size setting
This commit is contained in:
parent
60aef11072
commit
c778bd734c
5 changed files with 11 additions and 11 deletions
|
|
@ -341,8 +341,6 @@ const struct a2dp_codec a2dp_codec_aptx = {
|
|||
.codec_id = APTX_CODEC_ID },
|
||||
.name = "aptx",
|
||||
.description = "aptX",
|
||||
.send_fill_frames = 2,
|
||||
.recv_fill_frames = 2,
|
||||
.fill_caps = codec_fill_caps,
|
||||
.select_config = codec_select_config,
|
||||
.enum_config = codec_enum_config,
|
||||
|
|
@ -366,8 +364,6 @@ const struct a2dp_codec a2dp_codec_aptx_hd = {
|
|||
.codec_id = APTX_HD_CODEC_ID },
|
||||
.name = "aptx_hd",
|
||||
.description = "aptX HD",
|
||||
.send_fill_frames = 2,
|
||||
.recv_fill_frames = 2,
|
||||
.fill_caps = codec_fill_caps,
|
||||
.select_config = codec_select_config,
|
||||
.enum_config = codec_enum_config,
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@
|
|||
#define LDAC_ABR_THRESHOLD_DANGEROUSTREND 4
|
||||
#define LDAC_ABR_THRESHOLD_SAFETY_FOR_HQSQ 3
|
||||
|
||||
#define LDAC_ABR_SOCK_BUFFER_SIZE (LDAC_ABR_THRESHOLD_CRITICAL * LDAC_ABR_MAX_PACKET_NBYTES)
|
||||
|
||||
|
||||
struct impl {
|
||||
HANDLE_LDAC_BT ldac;
|
||||
|
|
@ -487,7 +489,9 @@ const struct a2dp_codec a2dp_codec_ldac = {
|
|||
.codec_id = LDAC_CODEC_ID },
|
||||
.name = "ldac",
|
||||
.description = "LDAC",
|
||||
.send_fill_frames = 4,
|
||||
#ifdef ENABLE_LDAC_ABR
|
||||
.send_buf_size = LDAC_ABR_SOCK_BUFFER_SIZE,
|
||||
#endif
|
||||
.fill_caps = codec_fill_caps,
|
||||
.select_config = codec_select_config,
|
||||
.enum_config = codec_enum_config,
|
||||
|
|
|
|||
|
|
@ -571,8 +571,6 @@ const struct a2dp_codec a2dp_codec_sbc = {
|
|||
.codec_id = A2DP_CODEC_SBC,
|
||||
.name = "sbc",
|
||||
.description = "SBC",
|
||||
.send_fill_frames = 2,
|
||||
.recv_fill_frames = 2,
|
||||
.fill_caps = codec_fill_caps,
|
||||
.select_config = codec_select_config,
|
||||
.enum_config = codec_enum_config,
|
||||
|
|
|
|||
|
|
@ -332,8 +332,7 @@ struct a2dp_codec {
|
|||
const char *description;
|
||||
const struct spa_dict *info;
|
||||
|
||||
const int send_fill_frames;
|
||||
const int recv_fill_frames;
|
||||
const size_t send_buf_size;
|
||||
|
||||
int (*fill_caps) (const struct a2dp_codec *codec, uint32_t flags,
|
||||
uint8_t caps[A2DP_MAX_CAPS_SIZE]);
|
||||
|
|
|
|||
|
|
@ -686,7 +686,10 @@ static int do_start(struct impl *this)
|
|||
spa_log_debug(this->log, NAME " %p: block_size %d num_blocks:%d", this,
|
||||
this->block_size, this->num_blocks);
|
||||
|
||||
val = SPA_MAX(this->codec->send_fill_frames, FILL_FRAMES) * this->transport->write_mtu;
|
||||
val = this->codec->send_buf_size > 0
|
||||
/* The kernel doubles the SO_SNDBUF option value set by setsockopt(). */
|
||||
? this->codec->send_buf_size / 2 + this->codec->send_buf_size % 2
|
||||
: FILL_FRAMES * this->transport->write_mtu;
|
||||
if (setsockopt(this->transport->fd, SOL_SOCKET, SO_SNDBUF, &val, sizeof(val)) < 0)
|
||||
spa_log_warn(this->log, NAME " %p: SO_SNDBUF %m", this);
|
||||
|
||||
|
|
@ -699,7 +702,7 @@ static int do_start(struct impl *this)
|
|||
}
|
||||
this->fd_buffer_size = val;
|
||||
|
||||
val = SPA_MAX(this->codec->recv_fill_frames, FILL_FRAMES) * this->transport->read_mtu;
|
||||
val = FILL_FRAMES * this->transport->read_mtu;
|
||||
if (setsockopt(this->transport->fd, SOL_SOCKET, SO_RCVBUF, &val, sizeof(val)) < 0)
|
||||
spa_log_warn(this->log, NAME " %p: SO_RCVBUF %m", this);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue