Projects
home:zaitor:branches:Essentials
pipewire-aptx
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Difference Between Revision 2 and
Essentials
/
pipewire-aptx
View file
pipewire-aptx.spec
Changed
@@ -8,7 +8,7 @@ %define minimum_version 1.6.0 Name: pipewire-aptx -Version: 1.6.2 +Version: 1.6.3 Release: 0 Summary: PipeWire Bluetooth aptX codec plugin License: MIT
View file
_service:download_files:pipewire-1.6.2.tar.bz2/NEWS -> _service:download_files:pipewire-1.6.3.tar.bz2/NEWS
Changed
@@ -1,3 +1,42 @@ +# PipeWire 1.6.3 (2026-04-09) + +## Highlights + - Fix some RAOP compatibility regressions. + - Fix segfault in the mixer in some cases. + - Most nodes now produce and consume MIDI1 again and avoid + conversions to and from UMP. + - Various small fixes and improvements. + + +## PipeWire + - Fix regression with sample rate changes. (#5207) + - Fix a potential integer overflow in the memory mapping. + +## Modules + - Align RTP timestamps to make RAOP work on more devices. (#5167) + - Avoid crashes in RTP streams because of concurrent event + emmission. + - Avoid invalid fd usage in native-protocol with special crafted + messages. + - Fix properties and params enumeration in filter-chain (#5202). + +## SPA + - Fix compilation with -Werror=discarded-qualifiers + - Avoid OOB read in mix matrix. (#5176) + - Avoid loading plugins from absolute paths that are not in the + search path. + - Avoid MIDI conversions to and from UMP. (#5183) + +## Bluetooth + - Backport some fixes and avoid some crashes. + +## JACK + - Make sure timebase callback is never called with 0 frames. + - Increase the notify queue to avoid losing notifications. + + +Older versions: + # PipeWire 1.6.2 (2026-03-16) This is a bugfix release that is API and ABI compatible with the previous @@ -31,9 +70,6 @@ ## JACK - Fix jack_port_type_id(). Return values that are compatible with JACK1/2. - -Older versions: - # PipeWire 1.6.1 (2026-03-09) This is a bugfix release that is API and ABI compatible with the previous
View file
_service:download_files:pipewire-1.6.2.tar.bz2/doc/dox/config/pipewire-props.7.md -> _service:download_files:pipewire-1.6.3.tar.bz2/doc/dox/config/pipewire-props.7.md
Changed
@@ -1375,9 +1375,9 @@ @PAR@ device-prop bluez5.bap.force-target-latency = "balanced" # string BAP QoS target latency profile forced for QoS configuration selection. -If not set or set to "balanced", both low-latency and high-reliabilty QoS configuration table are used. +If not set or set to "balanced", both low-latency and high-reliability QoS configuration table are used. This property is experimental. -Available: low-latency, high-reliabilty, balanced +Available: low-latency, high-reliability, balanced ## Node properties
View file
_service:download_files:pipewire-1.6.2.tar.bz2/doc/dox/internals/midi.dox -> _service:download_files:pipewire-1.6.3.tar.bz2/doc/dox/internals/midi.dox
Changed
@@ -62,6 +62,13 @@ for the MIDI 1.0 and 2.0 messages in the \ref spa_pod_sequence. Conversion to SPA_CONTROL_Midi is performed for legacy applications. +As of 1.7 the prefered format is Midi1 again because most devices and +applications are still Midi1 and conversions between Midi1 and UMP are not +completely transparent in ALSA and PipeWire. UMP in the ALSA sequencer +and consumers must be enabled explicitly. UMP in producers is supported +still and will be converted to Midi1 by all consumers that did not explicitly +enable UMP support. + ## The PipeWire Daemon Nothing special is implemented for MIDI. Negotiation of formats @@ -104,13 +111,14 @@ \ref SPA_CONTROL_UMP types. On output ports, the JACK event stream is converted to control messages in a similar way. -Normally, all MIDI and UMP messages are converted to MIDI1 jack events unless -the JACK port was created with an explcit "32 bit raw UMP" format or with -the JackPortIsMIDI2 flag, in which case the raw UMP is passed to the JACK -application directly. For output ports, -the JACK events are assumed to be MIDI1 and converted to UMP unless the port -has the "32 bit raw UMP" format or the JackPortIsMIDI2 flag, in which case -the UMP messages are simply passed on. +Normally, all MIDI and UMP input messages are converted to MIDI1 jack +events unless the JACK port was created with an explcit "32 bit raw UMP" +format or with the JackPortIsMIDI2 flag, in which case the messages are +converted to UMP or passed on directly. + +For output ports, the JACK events are assumed to be +MIDI1 unless the port has the "32 bit raw UMP" format or the JackPortIsMIDI2 +flag, in which case the control messages are assumed to be UMP. There is a 1 to 1 mapping between the JACK events and control messages so there is no information loss or need for complicated
View file
_service:download_files:pipewire-1.6.2.tar.bz2/meson.build -> _service:download_files:pipewire-1.6.3.tar.bz2/meson.build
Changed
@@ -1,5 +1,5 @@ project('pipewire', 'c' , - version : '1.6.2', + version : '1.6.3', license : 'MIT', 'LGPL-2.1-or-later', 'GPL-2.0-only' , meson_version : '>= 0.61.1', default_options : 'warning_level=3',
View file
_service:download_files:pipewire-1.6.2.tar.bz2/pipewire-jack/src/pipewire-jack.c -> _service:download_files:pipewire-1.6.3.tar.bz2/pipewire-jack/src/pipewire-jack.c
Changed
@@ -86,7 +86,7 @@ #define OTHER_CONNECT_FAIL -1 #define OTHER_CONNECT_IGNORE 0 -#define NOTIFY_BUFFER_SIZE (1u<<13) +#define NOTIFY_BUFFER_SIZE (1u<<16) #define NOTIFY_BUFFER_MASK (NOTIFY_BUFFER_SIZE-1) struct notify { @@ -104,8 +104,8 @@ #define NOTIFY_TYPE_TOTAL_LATENCY ((9<<4)|NOTIFY_ACTIVE_FLAG) #define NOTIFY_TYPE_PORT_RENAME ((10<<4)|NOTIFY_ACTIVE_FLAG) int type; - struct object *object; int arg1; + struct object *object; const char *msg; }; @@ -1448,8 +1448,9 @@ switch (type) { case TYPE_ID_MIDI: + event_type = SPA_CONTROL_Midi; + break; case TYPE_ID_OSC: - /* we handle MIDI as OSC, check below */ event_type = SPA_CONTROL_OSC; break; case TYPE_ID_UMP: @@ -1466,27 +1467,15 @@ for (i = 0; i < count; i++) { jack_midi_event_t ev; jack_midi_event_get(&ev, midi, i); + uint32_t ev_type; - if (type != TYPE_ID_MIDI || is_osc(&ev)) { - /* no midi port or it's OSC */ - spa_pod_builder_control(&b, ev.time, event_type); - spa_pod_builder_bytes(&b, ev.buffer, ev.size); - } else { - /* midi port and it's not OSC, convert to UMP */ - uint8_t *data = ev.buffer; - size_t size = ev.size; - uint64_t state = 0; - - while (size > 0) { - uint32_t ump4; - int ump_size = spa_ump_from_midi(&data, &size, - ump, sizeof(ump), 0, &state); - if (ump_size <= 0) - break; - spa_pod_builder_control(&b, ev.time, SPA_CONTROL_UMP); - spa_pod_builder_bytes(&b, ump, ump_size); - } - } + if (type == TYPE_ID_MIDI && is_osc(&ev)) + ev_type = SPA_CONTROL_OSC; + else + ev_type = event_type; + + spa_pod_builder_control(&b, ev.time, ev_type); + spa_pod_builder_bytes(&b, ev.buffer, ev.size); } spa_pod_builder_pop(&b, &f); return b.state.offset; @@ -2210,7 +2199,7 @@ } } else if (SPA_LIKELY(mask & SPA_IO_IN)) { uint32_t buffer_frames; - int status = 0; + int status = -EBUSY; buffer_frames = cycle_run(c); @@ -4875,7 +4864,7 @@ freeze_callbacks(c); /* reemit buffer_frames */ - c->buffer_frames = 0; + c->buffer_frames = (uint32_t)-1; pw_data_loop_start(c->loop); c->active = true; @@ -5456,7 +5445,7 @@ jack_nframes_t jack_get_buffer_size (jack_client_t *client) { struct client *c = (struct client *) client; - jack_nframes_t res = -1; + uint32_t res = -1; return_val_if_fail(c != NULL, 0); @@ -5473,7 +5462,7 @@ } c->buffer_frames = res; pw_log_debug("buffer_frames: %u", res); - return res; + return (jack_nframes_t)res; } SPA_EXPORT
View file
_service:download_files:pipewire-1.6.2.tar.bz2/pipewire-v4l2/src/pipewire-v4l2.c -> _service:download_files:pipewire-1.6.3.tar.bz2/pipewire-v4l2/src/pipewire-v4l2.c
Changed
@@ -2570,7 +2570,10 @@ buf = &file->buffersid; data = &buf->buf->buffer->datas0; - pw_map_range_init(&range, data->mapoffset, data->maxsize, 1024); + if (pw_map_range_init(&range, data->mapoffset, data->maxsize, 1024) < 0) { + res = MAP_FAILED; + goto error_unlock; + } if (!SPA_FLAG_IS_SET(data->flags, SPA_DATA_FLAG_READABLE)) prot &= ~PROT_READ;
View file
_service:download_files:pipewire-1.6.2.tar.bz2/spa/plugins/alsa/acp/compat.h -> _service:download_files:pipewire-1.6.3.tar.bz2/spa/plugins/alsa/acp/compat.h
Changed
@@ -429,9 +429,9 @@ #define pa_fopen_cloexec(f,m) fopen(f,m"e") -static inline char *pa_path_get_filename(const char *p) +static inline const char *pa_path_get_filename(const char *p) { - char *fn; + const char *fn; if (!p) return NULL; if ((fn = strrchr(p, PA_PATH_SEP_CHAR)))
View file
_service:download_files:pipewire-1.6.2.tar.bz2/spa/plugins/alsa/alsa-seq-bridge.c -> _service:download_files:pipewire-1.6.3.tar.bz2/spa/plugins/alsa/alsa-seq-bridge.c
Changed
@@ -227,7 +227,7 @@ if (full) port->info.change_mask = port->info_all; if (port->info.change_mask) { - struct spa_dict_item items6; + struct spa_dict_item items7; uint32_t n_items = 0; int card_id; snd_seq_port_info_t *info; @@ -284,6 +284,9 @@ snprintf(card, sizeof(card), "%d", card_id); itemsn_items++ = SPA_DICT_ITEM_INIT(SPA_KEY_API_ALSA_CARD, card); } + if (this->ump) + itemsn_items++ = SPA_DICT_ITEM_INIT("control.ump", "true"); + port->info.props = &SPA_DICT_INIT(items, n_items); spa_node_emit_port_info(&this->hooks, @@ -501,6 +504,7 @@ struct seq_state *this = object; struct seq_port *port; struct spa_pod *param; + struct spa_pod_frame f1; struct spa_pod_builder b = { 0 }; uint8_t buffer1024; struct spa_result_node_params result; @@ -524,10 +528,18 @@ case SPA_PARAM_EnumFormat: if (result.index > 0) return 0; - param = spa_pod_builder_add_object(&b, - SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat, + spa_pod_builder_push_object(&b, &f0, + SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat); + spa_pod_builder_add(&b, SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_application), - SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_control)); + SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_control), + 0); + if (port->control_types != 0) { + spa_pod_builder_add(&b, + SPA_FORMAT_CONTROL_types, SPA_POD_Int(port->control_types), + 0); + } + param = spa_pod_builder_pop(&b, &f0); break; case SPA_PARAM_Format: @@ -535,10 +547,18 @@ return -EIO; if (result.index > 0) return 0; - param = spa_pod_builder_add_object(&b, - SPA_TYPE_OBJECT_Format, SPA_PARAM_Format, + spa_pod_builder_push_object(&b, &f0, + SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat); + spa_pod_builder_add(&b, SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_application), - SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_control)); + SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_control), + 0); + if (port->control_types != 0) { + spa_pod_builder_add(&b, + SPA_FORMAT_CONTROL_types, SPA_POD_Int(port->control_types), + 0); + } + param = spa_pod_builder_pop(&b, &f0); break; case SPA_PARAM_Buffers: @@ -955,7 +975,7 @@ this->quantum_limit = 8192; this->min_pool_size = 500; this->max_pool_size = 2000; - this->ump = true; + this->ump = false; for (i = 0; info && i < info->n_items; i++) { const char *k = info->itemsi.key;
View file
_service:download_files:pipewire-1.6.2.tar.bz2/spa/plugins/alsa/alsa-seq.c -> _service:download_files:pipewire-1.6.3.tar.bz2/spa/plugins/alsa/alsa-seq.c
Changed
@@ -620,9 +620,8 @@ { struct seq_stream *stream = &state->streamsSPA_DIRECTION_OUTPUT; const bool ump = state->ump; - uint32_t *data; + void *data; uint8_t midi1_dataMAX_EVENT_SIZE; - uint32_t ump_dataMAX_EVENT_SIZE; long size; int res = -1; struct seq_port *port; @@ -633,9 +632,6 @@ uint64_t ev_time, diff; uint32_t offset; void *event; - uint8_t *midi1_ptr; - size_t midi1_size = 0; - uint64_t ump_state = 0; snd_seq_event_type_t SPA_UNUSED type; if (ump) { @@ -702,7 +698,7 @@ #ifdef HAVE_ALSA_UMP snd_seq_ump_event_t *ev = event; - data = (uint32_t*)&ev->ump0; + data = &ev->ump0; size = spa_ump_message_size(snd_ump_msg_hdr_type(ev->ump0)) * 4; #else spa_assert_not_reached(); @@ -715,34 +711,21 @@ spa_log_warn(state->log, "decode failed: %s", snd_strerror(size)); continue; } - - midi1_ptr = midi1_data; - midi1_size = size; + data = midi1_data; } - do { - if (!ump) { - data = ump_data; - size = spa_ump_from_midi(&midi1_ptr, &midi1_size, - ump_data, sizeof(ump_data), 0, &ump_state); - if (size <= 0) - break; - } - - spa_log_trace_fp(state->log, "event %d time:%"PRIu64" offset:%d size:%ld port:%d.%d", - type, ev_time, offset, size, addr->client, addr->port); + spa_log_trace_fp(state->log, "event %d time:%"PRIu64" offset:%d size:%ld port:%d.%d", + type, ev_time, offset, size, addr->client, addr->port); - spa_pod_builder_control(&port->builder, offset, SPA_CONTROL_UMP); - spa_pod_builder_bytes(&port->builder, data, size); + spa_pod_builder_control(&port->builder, offset, ump ? SPA_CONTROL_UMP : SPA_CONTROL_Midi ); + spa_pod_builder_bytes(&port->builder, data, size); - /* make sure we can fit at least one control event of max size otherwise - * we keep the event in the queue and try to copy it in the next cycle */ - if (port->builder.state.offset + - sizeof(struct spa_pod_control) + - MAX_EVENT_SIZE > port->buffer->buf->datas0.maxsize) - goto done; - - } while (!ump); + /* make sure we can fit at least one control event of max size otherwise + * we keep the event in the queue and try to copy it in the next cycle */ + if (port->builder.state.offset + + sizeof(struct spa_pod_control) + + MAX_EVENT_SIZE > port->buffer->buf->datas0.maxsize) + goto done; } done: @@ -819,7 +802,6 @@ const void *c_body; uint64_t out_time; snd_seq_real_time_t out_rt; - bool first = true; if (io->status != SPA_STATUS_HAVE_DATA || io->buffer_id >= port->n_buffers) @@ -844,9 +826,6 @@ size_t body_size; uint8_t *body; - if (c.type != SPA_CONTROL_UMP) - continue; - body = (uint8_t*)c_body; body_size = c.value.size; @@ -861,6 +840,9 @@ #ifdef HAVE_ALSA_UMP snd_seq_ump_event_t ev; + if (c.type != SPA_CONTROL_UMP) + continue; + snd_seq_ump_ev_clear(&ev); snd_seq_ev_set_ump_data(&ev, body, SPA_MIN(sizeof(ev.ump), (size_t)body_size)); snd_seq_ev_set_source(&ev, state->event.addr.port); @@ -878,26 +860,26 @@ #endif } else { snd_seq_event_t ev; - uint8_t dataMAX_EVENT_SIZE; - int size; - uint64_t st = 0; + int size = 0; + long s; - while (body_size > 0) { - if ((size = spa_ump_to_midi((const uint32_t **)&body, &body_size, - data, sizeof(data), &st)) <= 0) - break; + if (c.type != SPA_CONTROL_Midi) + continue; - if (first) + while (body_size > 0) { + if (size == 0) snd_seq_ev_clear(&ev); - if ((size = snd_midi_event_encode(stream->codec, data, size, &ev)) < 0) { + if ((s = snd_midi_event_encode(stream->codec, body, body_size, &ev)) < 0) { spa_log_warn(state->log, "failed to encode event: %s", snd_strerror(size)); snd_midi_event_reset_encode(stream->codec); - first = true; + size = 0; continue; } - first = false; + body += s; + body_size -= s; + size += s; if (ev.type == SND_SEQ_EVENT_NONE) /* this can happen when the event is not complete yet, like * a sysex message and we need to encode some more data. */ @@ -913,7 +895,7 @@ spa_log_warn(state->log, "failed to output event: %s", snd_strerror(err)); } - first = true; + size = 0; } } }
View file
_service:download_files:pipewire-1.6.2.tar.bz2/spa/plugins/alsa/alsa-seq.h -> _service:download_files:pipewire-1.6.3.tar.bz2/spa/plugins/alsa/alsa-seq.h
Changed
@@ -82,6 +82,8 @@ struct spa_pod_builder builder; struct spa_pod_frame frame; + uint32_t control_types; + struct spa_audio_info current_format; unsigned int have_format:1; unsigned int active:1;
View file
_service:download_files:pipewire-1.6.2.tar.bz2/spa/plugins/audioconvert/channelmix-ops.c -> _service:download_files:pipewire-1.6.3.tar.bz2/spa/plugins/audioconvert/channelmix-ops.c
Changed
@@ -720,7 +720,7 @@ if (src_paired == 0) src_paired = ~0LU; - for (jc = 0, ic = 0, i = 0; ic < dst_chan; i++) { + for (jc = 0, ic = 0, i = 0; ic < dst_chan && i < MAX_CHANNELS; i++) { float sum = 0.0f; char str11024, str21024; struct spa_strbuf sb1, sb2; @@ -730,7 +730,7 @@ if (i < CHANNEL_BITS && (dst_paired & (1UL << i)) == 0) continue; - for (jc = 0, j = 0; jc < src_chan; j++) { + for (jc = 0, j = 0; jc < src_chan && j < MAX_CHANNELS; j++) { if (j < CHANNEL_BITS && (src_paired & (1UL << j)) == 0) continue;
View file
_service:download_files:pipewire-1.6.2.tar.bz2/spa/plugins/bluez5/a2dp-codec-aac.c -> _service:download_files:pipewire-1.6.3.tar.bz2/spa/plugins/bluez5/a2dp-codec-aac.c
Changed
@@ -106,8 +106,8 @@ static const struct media_codec_config aac_frequencies = { - { AAC_SAMPLING_FREQ_48000, 48000, 11 }, { AAC_SAMPLING_FREQ_44100, 44100, 10 }, + { AAC_SAMPLING_FREQ_48000, 48000, 11 }, { AAC_SAMPLING_FREQ_96000, 96000, 9 }, { AAC_SAMPLING_FREQ_88200, 88200, 8 }, { AAC_SAMPLING_FREQ_64000, 64000, 7 }, @@ -194,75 +194,6 @@ return sizeof(conf); } -static int codec_enum_config(const struct media_codec *codec, uint32_t flags, - const void *caps, size_t caps_size, uint32_t id, uint32_t idx, - struct spa_pod_builder *b, struct spa_pod **param) -{ - a2dp_aac_t conf; - struct spa_pod_frame f2; - struct spa_pod_choice *choice; - uint32_t position2; - uint32_t i = 0; - - if (caps_size < sizeof(conf)) - return -EINVAL; - - memcpy(&conf, caps, sizeof(conf)); - - if (idx > 0) - return 0; - - spa_pod_builder_push_object(b, &f0, SPA_TYPE_OBJECT_Format, id); - spa_pod_builder_add(b, - SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_audio), - SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw), - SPA_FORMAT_AUDIO_format, SPA_POD_Id(SPA_AUDIO_FORMAT_S16), - 0); - spa_pod_builder_prop(b, SPA_FORMAT_AUDIO_rate, 0); - - spa_pod_builder_push_choice(b, &f1, SPA_CHOICE_None, 0); - choice = (struct spa_pod_choice*)spa_pod_builder_frame(b, &f1); - i = 0; - SPA_FOR_EACH_ELEMENT_VAR(aac_frequencies, f) { - if (AAC_GET_FREQUENCY(conf) & f->config) { - if (i++ == 0) - spa_pod_builder_int(b, f->value); - spa_pod_builder_int(b, f->value); - } - } - if (i > 1) - choice->body.type = SPA_CHOICE_Enum; - spa_pod_builder_pop(b, &f1); - - if (i == 0) - return -EINVAL; - - if (SPA_FLAG_IS_SET(conf.channels, AAC_CHANNELS_1 | AAC_CHANNELS_2)) { - spa_pod_builder_add(b, - SPA_FORMAT_AUDIO_channels, SPA_POD_CHOICE_RANGE_Int(2, 1, 2), - 0); - } else if (conf.channels & AAC_CHANNELS_1) { - position0 = SPA_AUDIO_CHANNEL_MONO; - spa_pod_builder_add(b, - SPA_FORMAT_AUDIO_channels, SPA_POD_Int(1), - SPA_FORMAT_AUDIO_position, SPA_POD_Array(sizeof(uint32_t), - SPA_TYPE_Id, 1, position), - 0); - } else if (conf.channels & AAC_CHANNELS_2) { - position0 = SPA_AUDIO_CHANNEL_FL; - position1 = SPA_AUDIO_CHANNEL_FR; - spa_pod_builder_add(b, - SPA_FORMAT_AUDIO_channels, SPA_POD_Int(2), - SPA_FORMAT_AUDIO_position, SPA_POD_Array(sizeof(uint32_t), - SPA_TYPE_Id, 2, position), - 0); - } else - return -EINVAL; - - *param = spa_pod_builder_pop(b, &f0); - return *param == NULL ? -EIO : 1; -} - static int codec_validate_config(const struct media_codec *codec, uint32_t flags, const void *caps, size_t caps_size, struct spa_audio_info *info) @@ -283,8 +214,10 @@ /* * A2DP v1.3.2, 4.5.2: only one bit shall be set in bitfields. * However, there is a report (#1342) of device setting multiple - * bits for AAC object type. It's not clear if this was due to - * a BlueZ bug, but we can be lax here and below in codec_init. + * bits for AAC object type. In addition AirPods set multiple bits. + * + * Some devices also set multiple bits in frequencies & channels. + * For these, pick a "preferred" choice. */ if (!(conf.object_type & (AAC_OBJECT_TYPE_MPEG2_AAC_LC | AAC_OBJECT_TYPE_MPEG4_AAC_LC | @@ -315,6 +248,35 @@ return 0; } +static int codec_enum_config(const struct media_codec *codec, uint32_t flags, + const void *caps, size_t caps_size, uint32_t id, uint32_t idx, + struct spa_pod_builder *b, struct spa_pod **param) +{ + struct spa_audio_info info; + struct spa_pod_frame f1; + int res; + + if ((res = codec_validate_config(codec, flags, caps, caps_size, &info)) < 0) + return res; + + if (idx > 0) + return 0; + + spa_pod_builder_push_object(b, &f0, SPA_TYPE_OBJECT_Format, id); + spa_pod_builder_add(b, + SPA_FORMAT_mediaType, SPA_POD_Id(info.media_type), + SPA_FORMAT_mediaSubtype, SPA_POD_Id(info.media_subtype), + SPA_FORMAT_AUDIO_format, SPA_POD_Id(info.info.raw.format), + SPA_FORMAT_AUDIO_rate, SPA_POD_Int(info.info.raw.rate), + SPA_FORMAT_AUDIO_channels, SPA_POD_Int(info.info.raw.channels), + SPA_FORMAT_AUDIO_position, SPA_POD_Array(sizeof(uint32_t), + SPA_TYPE_Id, info.info.raw.channels, info.info.raw.position), + 0); + + *param = spa_pod_builder_pop(b, &f0); + return *param == NULL ? -EIO : 1; +} + static void *codec_init_props(const struct media_codec *codec, uint32_t flags, const struct spa_dict *settings) { struct props *p = calloc(1, sizeof(struct props)); @@ -369,14 +331,14 @@ goto error; /* If object type has multiple bits set (invalid per spec, see above), - * assume the device usually means AAC-LC. + * assume the device usually means MPEG2 AAC LC which is mandatory. */ - if (conf->object_type & AAC_OBJECT_TYPE_MPEG4_AAC_LC) { - res = aacEncoder_SetParam(this->aacenc, AACENC_AOT, AOT_AAC_LC); + if (conf->object_type & AAC_OBJECT_TYPE_MPEG2_AAC_LC) { + res = aacEncoder_SetParam(this->aacenc, AACENC_AOT, AOT_MP2_AAC_LC); if (res != AACENC_OK) goto error; - } else if (conf->object_type & AAC_OBJECT_TYPE_MPEG2_AAC_LC) { - res = aacEncoder_SetParam(this->aacenc, AACENC_AOT, AOT_MP2_AAC_LC); + } else if (conf->object_type & AAC_OBJECT_TYPE_MPEG4_AAC_LC) { + res = aacEncoder_SetParam(this->aacenc, AACENC_AOT, AOT_AAC_LC); if (res != AACENC_OK) goto error; } else if (conf->object_type & AAC_OBJECT_TYPE_MPEG4_AAC_ELD) {
View file
_service:download_files:pipewire-1.6.2.tar.bz2/spa/plugins/bluez5/a2dp-codec-sbc.c -> _service:download_files:pipewire-1.6.3.tar.bz2/spa/plugins/bluez5/a2dp-codec-sbc.c
Changed
@@ -343,77 +343,27 @@ const void *caps, size_t caps_size, uint32_t id, uint32_t idx, struct spa_pod_builder *b, struct spa_pod **param) { - a2dp_sbc_t conf; - struct spa_pod_frame f2; - struct spa_pod_choice *choice; - uint32_t i = 0; - uint32_t position2; - - if (caps_size < sizeof(conf)) - return -EINVAL; + struct spa_audio_info info; + struct spa_pod_frame f1; + int res; - memcpy(&conf, caps, sizeof(conf)); + if ((res = codec_validate_config(codec, flags, caps, caps_size, &info)) < 0) + return res; if (idx > 0) return 0; spa_pod_builder_push_object(b, &f0, SPA_TYPE_OBJECT_Format, id); spa_pod_builder_add(b, - SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_audio), - SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw), - SPA_FORMAT_AUDIO_format, SPA_POD_Id(SPA_AUDIO_FORMAT_S16), + SPA_FORMAT_mediaType, SPA_POD_Id(info.media_type), + SPA_FORMAT_mediaSubtype, SPA_POD_Id(info.media_subtype), + SPA_FORMAT_AUDIO_format, SPA_POD_Id(info.info.raw.format), + SPA_FORMAT_AUDIO_rate, SPA_POD_Int(info.info.raw.rate), + SPA_FORMAT_AUDIO_channels, SPA_POD_Int(info.info.raw.channels), + SPA_FORMAT_AUDIO_position, SPA_POD_Array(sizeof(uint32_t), + SPA_TYPE_Id, info.info.raw.channels, info.info.raw.position), 0); - spa_pod_builder_prop(b, SPA_FORMAT_AUDIO_rate, 0); - - spa_pod_builder_push_choice(b, &f1, SPA_CHOICE_None, 0); - choice = (struct spa_pod_choice*)spa_pod_builder_frame(b, &f1); - i = 0; - if (conf.frequency & SBC_SAMPLING_FREQ_48000) { - if (i++ == 0) - spa_pod_builder_int(b, 48000); - spa_pod_builder_int(b, 48000); - } - if (conf.frequency & SBC_SAMPLING_FREQ_44100) { - if (i++ == 0) - spa_pod_builder_int(b, 44100); - spa_pod_builder_int(b, 44100); - } - if (conf.frequency & SBC_SAMPLING_FREQ_32000) { - if (i++ == 0) - spa_pod_builder_int(b, 32000); - spa_pod_builder_int(b, 32000); - } - if (conf.frequency & SBC_SAMPLING_FREQ_16000) { - if (i++ == 0) - spa_pod_builder_int(b, 16000); - spa_pod_builder_int(b, 16000); - } - if (i > 1) - choice->body.type = SPA_CHOICE_Enum; - spa_pod_builder_pop(b, &f1); - - if (conf.channel_mode & SBC_CHANNEL_MODE_MONO && - conf.channel_mode & (SBC_CHANNEL_MODE_JOINT_STEREO | - SBC_CHANNEL_MODE_STEREO | SBC_CHANNEL_MODE_DUAL_CHANNEL)) { - spa_pod_builder_add(b, - SPA_FORMAT_AUDIO_channels, SPA_POD_CHOICE_RANGE_Int(2, 1, 2), - 0); - } else if (conf.channel_mode & SBC_CHANNEL_MODE_MONO) { - position0 = SPA_AUDIO_CHANNEL_MONO; - spa_pod_builder_add(b, - SPA_FORMAT_AUDIO_channels, SPA_POD_Int(1), - SPA_FORMAT_AUDIO_position, SPA_POD_Array(sizeof(uint32_t), - SPA_TYPE_Id, 1, position), - 0); - } else { - position0 = SPA_AUDIO_CHANNEL_FL; - position1 = SPA_AUDIO_CHANNEL_FR; - spa_pod_builder_add(b, - SPA_FORMAT_AUDIO_channels, SPA_POD_Int(2), - SPA_FORMAT_AUDIO_position, SPA_POD_Array(sizeof(uint32_t), - SPA_TYPE_Id, 2, position), - 0); - } + *param = spa_pod_builder_pop(b, &f0); return *param == NULL ? -EIO : 1; }
View file
_service:download_files:pipewire-1.6.2.tar.bz2/spa/plugins/bluez5/backend-native.c -> _service:download_files:pipewire-1.6.3.tar.bz2/spa/plugins/bluez5/backend-native.c
Changed
@@ -1969,6 +1969,9 @@ struct updated_call *updated_call; bool found; + if (!rfcomm->telephony_ag) + return; + spa_list_for_each_safe(call, call_tmp, &rfcomm->telephony_ag->call_list, link) { found = false; spa_list_for_each(updated_call, &rfcomm->updated_call_list, link) { @@ -2097,6 +2100,8 @@ if (spa_streq(rfcomm->hf_indicatorsindicator, "battchg")) { spa_bt_device_report_battery_level(rfcomm->device, value * 100 / 5); + } else if (!rfcomm->telephony_ag) { + /* noop */ } else if (spa_streq(rfcomm->hf_indicatorsindicator, "callsetup")) { if (rfcomm->hfp_hf_clcc) { rfcomm_send_cmd(rfcomm, hfp_hf_clcc_update, NULL, "AT+CLCC"); @@ -2245,7 +2250,8 @@ rfcomm->hfp_hf_in_progress = false; } } - } else if (sscanf(token, "+CLIP: \"%16^\"\",%u", number, &type) == 2) { + } else if (sscanf(token, "+CLIP: \"%16^\"\",%u", number, &type) == 2 + && rfcomm->telephony_ag) { struct spa_bt_telephony_call *call; spa_list_for_each(call, &rfcomm->telephony_ag->call_list, link) { if (call->state == CALL_STATE_INCOMING && !spa_streq(number, call->line_identification)) { @@ -2256,7 +2262,8 @@ break; } } - } else if (sscanf(token, "+CCWA: \"%16^\"\",%u", number, &type) == 2) { + } else if (sscanf(token, "+CCWA: \"%16^\"\",%u", number, &type) == 2 + && rfcomm->telephony_ag) { struct spa_bt_telephony_call *call; bool found = false; @@ -2273,7 +2280,7 @@ if (call == NULL) spa_log_warn(backend->log, "failed to create waiting call"); } - } else if (spa_strstartswith(token, "+CLCC:")) { + } else if (spa_strstartswith(token, "+CLCC:") && rfcomm->telephony_ag) { struct spa_bt_telephony_call *call; size_t pos; char *token_end; @@ -2421,17 +2428,19 @@ } } - rfcomm->telephony_ag = telephony_ag_new(backend->telephony, 0); - rfcomm->telephony_ag->address = strdup(rfcomm->device->address); - rfcomm->telephony_ag->volumeSPA_BT_VOLUME_ID_RX = rfcomm->volumesSPA_BT_VOLUME_ID_RX.hw_volume = backend->hfp_default_speaker_volume; - rfcomm->telephony_ag->volumeSPA_BT_VOLUME_ID_TX = rfcomm->volumesSPA_BT_VOLUME_ID_TX.hw_volume = backend->hfp_default_mic_volume; - telephony_ag_set_callbacks(rfcomm->telephony_ag, + if (backend->telephony) { + rfcomm->telephony_ag = telephony_ag_new(backend->telephony, 0); + rfcomm->telephony_ag->address = strdup(rfcomm->device->address); + rfcomm->telephony_ag->volumeSPA_BT_VOLUME_ID_RX = rfcomm->volumesSPA_BT_VOLUME_ID_RX.hw_volume = backend->hfp_default_speaker_volume; + rfcomm->telephony_ag->volumeSPA_BT_VOLUME_ID_TX = rfcomm->volumesSPA_BT_VOLUME_ID_TX.hw_volume = backend->hfp_default_mic_volume; + telephony_ag_set_callbacks(rfcomm->telephony_ag, &telephony_ag_callbacks, rfcomm); - if (rfcomm->transport) { - rfcomm->telephony_ag->transport.codec = rfcomm->transport->media_codec->codec_id; - rfcomm->telephony_ag->transport.state = rfcomm->transport->state; + if (rfcomm->transport) { + rfcomm->telephony_ag->transport.codec = rfcomm->transport->media_codec->codec_id; + rfcomm->telephony_ag->transport.state = rfcomm->transport->state; + } + telephony_ag_register(rfcomm->telephony_ag); } - telephony_ag_register(rfcomm->telephony_ag); rfcomm_send_cmd(rfcomm, hfp_hf_clip, NULL, "AT+CLIP=1"); break; @@ -2478,7 +2487,7 @@ break; case hfp_hf_chld1_hangup: /* For HFP/HF/TWC/BV-03-C - see 0e92ab9307e05758b3f70b4c0648e29c1d1e50be */ - if (!rfcomm->hfp_hf_clcc) { + if (!rfcomm->hfp_hf_clcc && rfcomm->telephony_ag) { struct spa_bt_telephony_call *call, *tcall; spa_list_for_each_safe(call, tcall, &rfcomm->telephony_ag->call_list, link) { if (call->state == CALL_STATE_ACTIVE) {
View file
_service:download_files:pipewire-1.6.2.tar.bz2/spa/plugins/bluez5/bap-codec-lc3.c -> _service:download_files:pipewire-1.6.3.tar.bz2/spa/plugins/bluez5/bap-codec-lc3.c
Changed
@@ -126,22 +126,22 @@ BAP_QOS("48_6_1", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_10, false, 155, 5, 20, 40000, 27, "low-latency"), /* 48_6_1 */ /* BAP v1.0.1 Table 5.2; high-reliability */ - BAP_QOS("8_1_2", LC3_CONFIG_FREQ_8KHZ, LC3_CONFIG_DURATION_7_5, false, 26, 13, 75, 40000, 10, "high-reliabilty"), /* 8_1_2 */ - BAP_QOS("8_2_2", LC3_CONFIG_FREQ_8KHZ, LC3_CONFIG_DURATION_10, false, 30, 13, 95, 40000, 0, "high-reliabilty"), /* 8_2_2 */ - BAP_QOS("16_1_2", LC3_CONFIG_FREQ_16KHZ, LC3_CONFIG_DURATION_7_5, false, 30, 13, 75, 40000, 11, "high-reliabilty"), /* 16_1_2 */ - BAP_QOS("16_2_2", LC3_CONFIG_FREQ_16KHZ, LC3_CONFIG_DURATION_10, false, 40, 13, 95, 40000, 1, "high-reliabilty"), /* 16_2_2 */ - BAP_QOS("24_1_2", LC3_CONFIG_FREQ_24KHZ, LC3_CONFIG_DURATION_7_5, false, 45, 13, 75, 40000, 12, "high-reliabilty"), /* 24_1_2 */ - BAP_QOS("24_2_2", LC3_CONFIG_FREQ_24KHZ, LC3_CONFIG_DURATION_10, false, 60, 13, 95, 40000, 2, "high-reliabilty"), /* 24_2_2 */ - BAP_QOS("32_1_2", LC3_CONFIG_FREQ_32KHZ, LC3_CONFIG_DURATION_7_5, false, 60, 13, 75, 40000, 13, "high-reliabilty"), /* 32_1_2 */ - BAP_QOS("32_2_2", LC3_CONFIG_FREQ_32KHZ, LC3_CONFIG_DURATION_10, false, 80, 13, 95, 40000, 3, "high-reliabilty"), /* 32_2_2 */ - BAP_QOS("441_1_2", LC3_CONFIG_FREQ_44KHZ, LC3_CONFIG_DURATION_7_5, true, 97, 13, 80, 40000, 54, "high-reliabilty"), /* 441_1_2 */ - BAP_QOS("441_2_2", LC3_CONFIG_FREQ_44KHZ, LC3_CONFIG_DURATION_10, true, 130, 13, 85, 40000, 44, "high-reliabilty"), /* 441_2_2 */ - BAP_QOS("48_1_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_7_5, false, 75, 13, 75, 40000, 55, "high-reliabilty"), /* 48_1_2 */ - BAP_QOS("48_2_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_10, false, 100, 13, 95, 40000, 45, "high-reliabilty"), /* 48_2_2 */ - BAP_QOS("48_3_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_7_5, false, 90, 13, 75, 40000, 56, "high-reliabilty"), /* 48_3_2 */ - BAP_QOS("48_4_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_10, false, 120, 13, 100, 40000, 46, "high-reliabilty"), /* 48_4_2 */ - BAP_QOS("48_5_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_7_5, false, 117, 13, 75, 40000, 57, "high-reliabilty"), /* 48_5_2 */ - BAP_QOS("48_6_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_10, false, 155, 13, 100, 40000, 47, "high-reliabilty"), /* 48_6_2 */ + BAP_QOS("8_1_2", LC3_CONFIG_FREQ_8KHZ, LC3_CONFIG_DURATION_7_5, false, 26, 13, 75, 40000, 10, "high-reliability"), /* 8_1_2 */ + BAP_QOS("8_2_2", LC3_CONFIG_FREQ_8KHZ, LC3_CONFIG_DURATION_10, false, 30, 13, 95, 40000, 0, "high-reliability"), /* 8_2_2 */ + BAP_QOS("16_1_2", LC3_CONFIG_FREQ_16KHZ, LC3_CONFIG_DURATION_7_5, false, 30, 13, 75, 40000, 11, "high-reliability"), /* 16_1_2 */ + BAP_QOS("16_2_2", LC3_CONFIG_FREQ_16KHZ, LC3_CONFIG_DURATION_10, false, 40, 13, 95, 40000, 1, "high-reliability"), /* 16_2_2 */ + BAP_QOS("24_1_2", LC3_CONFIG_FREQ_24KHZ, LC3_CONFIG_DURATION_7_5, false, 45, 13, 75, 40000, 12, "high-reliability"), /* 24_1_2 */ + BAP_QOS("24_2_2", LC3_CONFIG_FREQ_24KHZ, LC3_CONFIG_DURATION_10, false, 60, 13, 95, 40000, 2, "high-reliability"), /* 24_2_2 */ + BAP_QOS("32_1_2", LC3_CONFIG_FREQ_32KHZ, LC3_CONFIG_DURATION_7_5, false, 60, 13, 75, 40000, 13, "high-reliability"), /* 32_1_2 */ + BAP_QOS("32_2_2", LC3_CONFIG_FREQ_32KHZ, LC3_CONFIG_DURATION_10, false, 80, 13, 95, 40000, 3, "high-reliability"), /* 32_2_2 */ + BAP_QOS("441_1_2", LC3_CONFIG_FREQ_44KHZ, LC3_CONFIG_DURATION_7_5, true, 97, 13, 80, 40000, 54, "high-reliability"), /* 441_1_2 */ + BAP_QOS("441_2_2", LC3_CONFIG_FREQ_44KHZ, LC3_CONFIG_DURATION_10, true, 130, 13, 85, 40000, 44, "high-reliability"), /* 441_2_2 */ + BAP_QOS("48_1_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_7_5, false, 75, 13, 75, 40000, 55, "high-reliability"), /* 48_1_2 */ + BAP_QOS("48_2_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_10, false, 100, 13, 95, 40000, 45, "high-reliability"), /* 48_2_2 */ + BAP_QOS("48_3_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_7_5, false, 90, 13, 75, 40000, 56, "high-reliability"), /* 48_3_2 */ + BAP_QOS("48_4_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_10, false, 120, 13, 100, 40000, 46, "high-reliability"), /* 48_4_2 */ + BAP_QOS("48_5_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_7_5, false, 117, 13, 75, 40000, 57, "high-reliability"), /* 48_5_2 */ + BAP_QOS("48_6_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_10, false, 155, 13, 100, 40000, 47, "high-reliability"), /* 48_6_2 */ }; static const struct bap_qos bap_bcast_qos_configs = { @@ -167,22 +167,22 @@ BAP_QOS("48_6_1", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_10, false, 155, 4, 20, 40000, 27, "low-latency"), /* 48_6_1 */ /* BAP v1.0.1 Table 6.4; high-reliability */ - BAP_QOS("8_1_2", LC3_CONFIG_FREQ_8KHZ, LC3_CONFIG_DURATION_7_5, false, 26, 4, 45, 40000, 10, "high-reliabilty"), /* 8_1_2 */ - BAP_QOS("8_2_2", LC3_CONFIG_FREQ_8KHZ, LC3_CONFIG_DURATION_10, false, 30, 4, 60, 40000, 0, "high-reliabilty"), /* 8_2_2 */ - BAP_QOS("16_1_2", LC3_CONFIG_FREQ_16KHZ, LC3_CONFIG_DURATION_7_5, false, 30, 4, 45, 40000, 11, "high-reliabilty"), /* 16_1_2 */ - BAP_QOS("16_2_2", LC3_CONFIG_FREQ_16KHZ, LC3_CONFIG_DURATION_10, false, 40, 4, 60, 40000, 1, "high-reliabilty"), /* 16_2_2 */ - BAP_QOS("24_1_2", LC3_CONFIG_FREQ_24KHZ, LC3_CONFIG_DURATION_7_5, false, 45, 4, 45, 40000, 12, "high-reliabilty"), /* 24_1_2 */ - BAP_QOS("24_2_2", LC3_CONFIG_FREQ_24KHZ, LC3_CONFIG_DURATION_10, false, 60, 4, 60, 40000, 2, "high-reliabilty"), /* 24_2_2 */ - BAP_QOS("32_1_2", LC3_CONFIG_FREQ_32KHZ, LC3_CONFIG_DURATION_7_5, false, 60, 4, 45, 40000, 13, "high-reliabilty"), /* 32_1_2 */ - BAP_QOS("32_2_2", LC3_CONFIG_FREQ_32KHZ, LC3_CONFIG_DURATION_10, false, 80, 4, 60, 40000, 3, "high-reliabilty"), /* 32_2_2 */ - BAP_QOS("441_1_2", LC3_CONFIG_FREQ_44KHZ, LC3_CONFIG_DURATION_7_5, true, 97, 4, 54, 40000, 14, "high-reliabilty"), /* 441_1_2 */ - BAP_QOS("441_2_2", LC3_CONFIG_FREQ_44KHZ, LC3_CONFIG_DURATION_10, true, 130, 4, 60, 40000, 4, "high-reliabilty"), /* 441_2_2 */ - BAP_QOS("48_1_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_7_5, false, 75, 4, 50, 40000, 15, "high-reliabilty"), /* 48_1_2 */ - BAP_QOS("48_2_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_10, false, 100, 4, 65, 40000, 5, "high-reliabilty"), /* 48_2_2 */ - BAP_QOS("48_3_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_7_5, false, 90, 4, 50, 40000, 16, "high-reliabilty"), /* 48_3_2 */ - BAP_QOS("48_4_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_10, false, 120, 4, 65, 40000, 6, "high-reliabilty"), /* 48_4_2 */ - BAP_QOS("48_5_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_7_5, false, 117, 4, 50, 40000, 17, "high-reliabilty"), /* 48_5_2 */ - BAP_QOS("48_6_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_10, false, 155, 4, 65, 40000, 7, "high-reliabilty"), /* 48_6_2 */ + BAP_QOS("8_1_2", LC3_CONFIG_FREQ_8KHZ, LC3_CONFIG_DURATION_7_5, false, 26, 4, 45, 40000, 10, "high-reliability"), /* 8_1_2 */ + BAP_QOS("8_2_2", LC3_CONFIG_FREQ_8KHZ, LC3_CONFIG_DURATION_10, false, 30, 4, 60, 40000, 0, "high-reliability"), /* 8_2_2 */ + BAP_QOS("16_1_2", LC3_CONFIG_FREQ_16KHZ, LC3_CONFIG_DURATION_7_5, false, 30, 4, 45, 40000, 11, "high-reliability"), /* 16_1_2 */ + BAP_QOS("16_2_2", LC3_CONFIG_FREQ_16KHZ, LC3_CONFIG_DURATION_10, false, 40, 4, 60, 40000, 1, "high-reliability"), /* 16_2_2 */ + BAP_QOS("24_1_2", LC3_CONFIG_FREQ_24KHZ, LC3_CONFIG_DURATION_7_5, false, 45, 4, 45, 40000, 12, "high-reliability"), /* 24_1_2 */ + BAP_QOS("24_2_2", LC3_CONFIG_FREQ_24KHZ, LC3_CONFIG_DURATION_10, false, 60, 4, 60, 40000, 2, "high-reliability"), /* 24_2_2 */ + BAP_QOS("32_1_2", LC3_CONFIG_FREQ_32KHZ, LC3_CONFIG_DURATION_7_5, false, 60, 4, 45, 40000, 13, "high-reliability"), /* 32_1_2 */ + BAP_QOS("32_2_2", LC3_CONFIG_FREQ_32KHZ, LC3_CONFIG_DURATION_10, false, 80, 4, 60, 40000, 3, "high-reliability"), /* 32_2_2 */ + BAP_QOS("441_1_2", LC3_CONFIG_FREQ_44KHZ, LC3_CONFIG_DURATION_7_5, true, 97, 4, 54, 40000, 14, "high-reliability"), /* 441_1_2 */ + BAP_QOS("441_2_2", LC3_CONFIG_FREQ_44KHZ, LC3_CONFIG_DURATION_10, true, 130, 4, 60, 40000, 4, "high-reliability"), /* 441_2_2 */ + BAP_QOS("48_1_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_7_5, false, 75, 4, 50, 40000, 15, "high-reliability"), /* 48_1_2 */ + BAP_QOS("48_2_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_10, false, 100, 4, 65, 40000, 5, "high-reliability"), /* 48_2_2 */ + BAP_QOS("48_3_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_7_5, false, 90, 4, 50, 40000, 16, "high-reliability"), /* 48_3_2 */ + BAP_QOS("48_4_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_10, false, 120, 4, 65, 40000, 6, "high-reliability"), /* 48_4_2 */ + BAP_QOS("48_5_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_7_5, false, 117, 4, 50, 40000, 17, "high-reliability"), /* 48_5_2 */ + BAP_QOS("48_6_2", LC3_CONFIG_FREQ_48KHZ, LC3_CONFIG_DURATION_10, false, 155, 4, 65, 40000, 7, "high-reliability"), /* 48_6_2 */ }; static unsigned int get_rate_mask(uint8_t rate) {
View file
_service:download_files:pipewire-1.6.2.tar.bz2/spa/plugins/bluez5/bluez5-dbus.c -> _service:download_files:pipewire-1.6.3.tar.bz2/spa/plugins/bluez5/bluez5-dbus.c
Changed
@@ -587,18 +587,35 @@ { switch (direction) { case SPA_BT_MEDIA_SOURCE: - return codec->kind == MEDIA_CODEC_BAP ? SPA_BT_PROFILE_BAP_SOURCE : SPA_BT_PROFILE_A2DP_SOURCE; + if (codec->kind == MEDIA_CODEC_A2DP) + return SPA_BT_PROFILE_A2DP_SOURCE; + else if (codec->kind == MEDIA_CODEC_BAP) + return SPA_BT_PROFILE_BAP_SOURCE; + else if (codec->kind == MEDIA_CODEC_HFP) + return SPA_BT_PROFILE_HEADSET_AUDIO; + else + return SPA_BT_PROFILE_NULL; case SPA_BT_MEDIA_SINK: - if (codec->kind == MEDIA_CODEC_ASHA) + if (codec->kind == MEDIA_CODEC_A2DP) + return SPA_BT_PROFILE_A2DP_SINK; + else if (codec->kind == MEDIA_CODEC_ASHA) return SPA_BT_PROFILE_ASHA_SINK; else if (codec->kind == MEDIA_CODEC_BAP) return SPA_BT_PROFILE_BAP_SINK; + else if (codec->kind == MEDIA_CODEC_HFP) + return SPA_BT_PROFILE_HEADSET_AUDIO; else - return SPA_BT_PROFILE_A2DP_SINK; + return SPA_BT_PROFILE_NULL; case SPA_BT_MEDIA_SOURCE_BROADCAST: - return SPA_BT_PROFILE_BAP_BROADCAST_SOURCE; + if (codec->kind == MEDIA_CODEC_BAP) + return SPA_BT_PROFILE_BAP_BROADCAST_SOURCE; + else + return SPA_BT_PROFILE_NULL; case SPA_BT_MEDIA_SINK_BROADCAST: - return SPA_BT_PROFILE_BAP_BROADCAST_SINK; + if (codec->kind == MEDIA_CODEC_BAP) + return SPA_BT_PROFILE_BAP_BROADCAST_SINK; + else + return SPA_BT_PROFILE_NULL; default: spa_assert_not_reached(); } @@ -2777,16 +2794,18 @@ bool is_bap = codec->kind == MEDIA_CODEC_BAP; size_t i; - codec_target_profile = get_codec_target_profile(monitor, codec); - if (!codec_target_profile) - return false; - if (codec->kind == MEDIA_CODEC_HFP) { if (!(profile & SPA_BT_PROFILE_HEADSET_AUDIO)) return false; + if (!is_media_codec_enabled(monitor, codec)) + return false; return spa_bt_backend_supports_codec(monitor->backend, device, codec->codec_id) == 1; } + codec_target_profile = get_codec_target_profile(monitor, codec); + if (!codec_target_profile) + return false; + if (!device->adapter->a2dp_application_registered && is_a2dp) { /* Codec switching not supported: only plain SBC allowed */ return (codec->codec_id == A2DP_CODEC_SBC && spa_streq(codec->name, "sbc") && @@ -7078,7 +7097,7 @@ memcpy(big_entry->broadcast_code, bcode, strlen(bcode)); spa_log_debug(monitor->log, "big_entry->broadcast_code %s", big_entry->broadcast_code); } else if (spa_streq(key, "adapter")) { - if (spa_json_get_string(&it1, big_entry->adapter, sizeof(big_entry->adapter)) <= 0) + if (spa_json_get_string(&it0, big_entry->adapter, sizeof(big_entry->adapter)) <= 0) goto parse_failed; spa_log_debug(monitor->log, "big_entry->adapter %s", big_entry->adapter); } else if (spa_streq(key, "encryption")) {
View file
_service:download_files:pipewire-1.6.2.tar.bz2/spa/plugins/bluez5/media-source.c -> _service:download_files:pipewire-1.6.3.tar.bz2/spa/plugins/bluez5/media-source.c
Changed
@@ -1784,7 +1784,7 @@ static void update_target_latency(struct impl *this) { struct port *port = &this->port; - int32_t target; + int32_t target = 0; int samples; if (this->transport == NULL || !port->have_format) @@ -1803,7 +1803,7 @@ */ if (this->decode_buffer_target) target = this->decode_buffer_target; - else + else if (this->transport->iso_io) target = spa_bt_iso_io_get_source_target_latency(this->transport->iso_io); spa_bt_decode_buffer_set_target_latency(&port->buffer, target);
View file
_service:download_files:pipewire-1.6.2.tar.bz2/spa/plugins/bluez5/midi-node.c -> _service:download_files:pipewire-1.6.3.tar.bz2/spa/plugins/bluez5/midi-node.c
Changed
@@ -23,7 +23,6 @@ #include <spa/utils/ringbuffer.h> #include <spa/monitor/device.h> #include <spa/control/control.h> -#include <spa/control/ump-utils.h> #include <spa/node/node.h> #include <spa/node/utils.h> @@ -450,7 +449,7 @@ struct impl *this = user_data; struct port *port = &this->portsPORT_OUT; struct time_sync *sync = &port->sync; - uint64_t time, state = 0; + uint64_t time; int res; spa_assert(size > 0); @@ -460,19 +459,11 @@ spa_log_trace(this->log, "%p: event:0x%x size:%d timestamp:%d time:%"PRIu64"", this, (int)data0, (int)size, (int)timestamp, (uint64_t)time); - while (size > 0) { - uint32_t ump4; - int ump_size = spa_ump_from_midi(&data, &size, - ump, sizeof(ump), 0, &state); - if (ump_size <= 0) - break; - - res = midi_event_ringbuffer_push(&this->event_rbuf, time, (uint8_t*)ump, ump_size); - if (res < 0) { - midi_event_ringbuffer_init(&this->event_rbuf); - spa_log_warn(this->log, "%p: MIDI receive buffer overflow: %s", - this, spa_strerror(res)); - } + res = midi_event_ringbuffer_push(&this->event_rbuf, time, data, size); + if (res < 0) { + midi_event_ringbuffer_init(&this->event_rbuf); + spa_log_warn(this->log, "%p: MIDI receive buffer overflow: %s", + this, spa_strerror(res)); } } @@ -713,7 +704,7 @@ offset = time * this->rate / SPA_NSEC_PER_SEC; offset = SPA_CLAMP(offset, 0u, this->duration - 1); - spa_pod_builder_control(&port->builder, offset, SPA_CONTROL_UMP); + spa_pod_builder_control(&port->builder, offset, SPA_CONTROL_Midi); buf = spa_pod_builder_reserve_bytes(&port->builder, size); if (buf) { midi_event_ringbuffer_pop(&this->event_rbuf, buf, size); @@ -786,37 +777,28 @@ time = 0; while (spa_pod_parser_get_control_body(&parser, &c, &c_body) >= 0) { - int size; - uint8_t event32; - const uint32_t *ump = c_body; - size_t ump_size = c.value.size; - uint64_t state = 0; + const uint8_t *event = c_body; + uint32_t size = c.value.size; - if (c.type != SPA_CONTROL_UMP) + if (c.type != SPA_CONTROL_Midi) continue; time = SPA_MAX(time, this->current_time + c.offset * SPA_NSEC_PER_SEC / this->rate); - while (ump_size > 0) { - size = spa_ump_to_midi(&ump, &ump_size, event, sizeof(event), &state); - if (size <= 0) - break; + spa_log_trace(this->log, "%p: output event:0x%x time:%"PRIu64, this, + (size > 0) ? event0 : 0, time); - spa_log_trace(this->log, "%p: output event:0x%x time:%"PRIu64, this, - (size > 0) ? event0 : 0, time); - - do { - res = spa_bt_midi_writer_write(&this->writer, - time, event, size); - if (res < 0) { - return res; - } else if (res) { - int res2; - if ((res2 = flush_packet(this)) < 0) - return res2; - } - } while (res); - } + do { + res = spa_bt_midi_writer_write(&this->writer, + time, event, size); + if (res < 0) { + return res; + } else if (res) { + int res2; + if ((res2 = flush_packet(this)) < 0) + return res2; + } + } while (res); } if ((res = flush_packet(this)) < 0)
View file
_service:download_files:pipewire-1.6.2.tar.bz2/spa/plugins/control/mixer.c -> _service:download_files:pipewire-1.6.3.tar.bz2/spa/plugins/control/mixer.c
Changed
@@ -72,6 +72,7 @@ struct spa_node node; uint32_t quantum_limit; + uint32_t control_types; struct spa_log *log; @@ -473,9 +474,9 @@ if (!port->have_format) { this->n_formats++; port->have_format = true; - port->types = types; - spa_log_debug(this->log, "%p: set format on port %d:%d", - this, direction, port_id); + port->types = types == 0 ? this->control_types : types; + spa_log_debug(this->log, "%p: set format on port %d:%d types:%08x %08x", + this, direction, port_id, port->types, this->control_types); } } port->info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS; @@ -589,7 +590,7 @@ port->io0 = info->data; port->io1 = info->data; } - if (!port->active) { + if (port->direction == SPA_DIRECTION_INPUT && !port->active) { spa_list_append(&info->impl->mix_list, &port->mix_link); port->active = true; } @@ -955,6 +956,8 @@ } this->quantum_limit = 8192; + /* by default we convert to midi1 */ + this->control_types = 1u<<SPA_CONTROL_Midi; for (i = 0; info && i < info->n_items; i++) { const char *k = info->itemsi.key; @@ -962,6 +965,14 @@ if (spa_streq(k, "clock.quantum-limit")) { spa_atou32(s, &this->quantum_limit, 0); } + else if (spa_streq(k, "control.ump")) { + if (spa_atob(s)) + /* we convert to UMP when forced */ + this->control_types = 1u<<SPA_CONTROL_UMP; + else + /* when unforced we let both midi1 and UMP through */ + this->control_types = 0; + } } spa_hook_list_init(&this->hooks);
View file
_service:download_files:pipewire-1.6.2.tar.bz2/spa/plugins/filter-graph/filter-graph.c -> _service:download_files:pipewire-1.6.3.tar.bz2/spa/plugins/filter-graph/filter-graph.c
Changed
@@ -552,19 +552,25 @@ struct descriptor *desc = node->desc; const struct spa_fga_descriptor *d = desc->desc; struct spa_fga_port *p = &d->portsport->p; + float v, min, max; if (node->name0 != '\0') snprintf(name, sizeof(name), "%s:%s", node->name, p->name); else snprintf(name, sizeof(name), "%s", p->name); + if (port->control_initialized) + v = port->control_current; + else + get_ranges(impl, p, &v, &min, &max); + spa_pod_builder_string(b, name); if (p->hint & SPA_FGA_HINT_BOOLEAN) { - spa_pod_builder_bool(b, port->control_data0 <= 0.0f ? false : true); + spa_pod_builder_bool(b, v <= 0.0f ? false : true); } else if (p->hint & SPA_FGA_HINT_INTEGER) { - spa_pod_builder_int(b, (int32_t)port->control_data0); + spa_pod_builder_int(b, (int32_t)v); } else { - spa_pod_builder_float(b, port->control_data0); + spa_pod_builder_float(b, v); } } spa_pod_builder_pop(b, &f1);
View file
_service:download_files:pipewire-1.6.2.tar.bz2/spa/plugins/filter-graph/plugin_ladspa.c -> _service:download_files:pipewire-1.6.3.tar.bz2/spa/plugins/filter-graph/plugin_ladspa.c
Changed
@@ -233,43 +233,49 @@ return s; } -static int load_ladspa_plugin(struct plugin *impl, const char *path) +static void make_search_paths(const char **path, const char **search_dirs) { - int res = -ENOENT; + const char *p; + + while ((p = strstr(*path, "../")) != NULL) + *path = p + 3; - if (path0 != '/') { - const char *search_dirs, *p, *state = NULL; - char filenamePATH_MAX; - size_t len; + *search_dirs = getenv("LADSPA_PATH"); + if (!*search_dirs) + *search_dirs = "/usr/lib64/ladspa:/usr/lib/ladspa:" LIBDIR; +} - search_dirs = getenv("LADSPA_PATH"); - if (!search_dirs) - search_dirs = "/usr/lib64/ladspa:/usr/lib/ladspa:" LIBDIR; +static int load_ladspa_plugin(struct plugin *impl, const char *path, const char *search_dirs) +{ + int res = -ENOENT; + const char *p, *state = NULL; + char filenamePATH_MAX; + size_t len; - /* - * set the errno for the case when `ladspa_handle_load_by_path()` - * is never called, which can only happen if the supplied - * LADSPA_PATH contains too long paths - */ - res = -ENAMETOOLONG; + /* + * set the errno for the case when `ladspa_handle_load_by_path()` + * is never called, which can only happen if the supplied + * LADSPA_PATH contains too long paths + */ + res = -ENAMETOOLONG; - while ((p = split_walk(search_dirs, ":", &len, &state))) { - int namelen; + while ((p = split_walk(search_dirs, ":", &len, &state))) { + int namelen; - if (len >= sizeof(filename)) - continue; + if (len == 0 || len >= sizeof(filename)) + continue; + if (strncmp(path, p, len) == 0 && pathlen == '/') + namelen = snprintf(filename, sizeof(filename), "%s", path); + else namelen = snprintf(filename, sizeof(filename), "%.*s/%s.so", (int) len, p, path); - if (namelen < 0 || (size_t) namelen >= sizeof(filename)) - continue; - res = ladspa_handle_load_by_path(impl, filename); - if (res >= 0) - break; - } - } - else { - res = ladspa_handle_load_by_path(impl, path); + if (namelen < 0 || (size_t) namelen >= sizeof(filename)) + continue; + + res = ladspa_handle_load_by_path(impl, filename); + if (res >= 0) + break; } return res; } @@ -317,7 +323,7 @@ struct plugin *impl; uint32_t i; int res; - const char *path = NULL; + const char *path = NULL, *search_dirs; handle->get_interface = impl_get_interface; handle->clear = impl_clear; @@ -335,9 +341,11 @@ if (path == NULL) return -EINVAL; - if ((res = load_ladspa_plugin(impl, path)) < 0) { - spa_log_error(impl->log, "failed to load plugin '%s': %s", - path, spa_strerror(res)); + make_search_paths(&path, &search_dirs); + + if ((res = load_ladspa_plugin(impl, path, search_dirs)) < 0) { + spa_log_error(impl->log, "failed to load plugin '%s' in '%s': %s", + path, search_dirs, spa_strerror(res)); return res; }
View file
_service:download_files:pipewire-1.6.2.tar.bz2/spa/plugins/libcamera/libcamera-device.cpp -> _service:download_files:pipewire-1.6.3.tar.bz2/spa/plugins/libcamera/libcamera-device.cpp
Changed
@@ -5,6 +5,7 @@ /* SPDX-License-Identifier: MIT */ #include <cstddef> +#include <span> #include <sstream> #include <spa/support/plugin.h> @@ -25,7 +26,6 @@ #include <libcamera/camera.h> #include <libcamera/property_ids.h> -#include <libcamera/base/span.h> using namespace libcamera; @@ -50,7 +50,7 @@ std::string device_id); }; -const libcamera::Span<const int64_t> cameraDevice(const Camera& camera) +std::span<const int64_t> cameraDevice(const Camera& camera) { if (auto devices = camera.properties().get(properties::SystemDevices)) return devices.value();
View file
_service:download_files:pipewire-1.6.2.tar.bz2/src/daemon/filter-chain/source-rnnoise.conf -> _service:download_files:pipewire-1.6.3.tar.bz2/src/daemon/filter-chain/source-rnnoise.conf
Changed
@@ -21,7 +21,6 @@ # listed in the environment variable LADSPA_PATH or # /usr/lib64/ladspa, /usr/lib/ladspa or the system library directory # as a fallback. - # You might want to use an absolute path here to avoid problems. plugin = "librnnoise_ladspa" label = noise_suppressor_stereo control = {
View file
_service:download_files:pipewire-1.6.2.tar.bz2/src/modules/module-ffado-driver.c -> _service:download_files:pipewire-1.6.3.tar.bz2/src/modules/module-ffado-driver.c
Changed
@@ -345,34 +345,26 @@ p->event_pos = 0; while (spa_pod_parser_get_control_body(&parser, &c, &c_body) >= 0) { - uint8_t data16; - int j, size; - size_t c_size = c.value.size; - uint64_t state = 0; + uint32_t j, size = c.value.size; + const uint8_t *data = c_body; - if (c.type != SPA_CONTROL_UMP) + if (c.type != SPA_CONTROL_Midi) continue; if (index < c.offset) index = SPA_ROUND_UP_N(c.offset, 8); - while (c_size > 0) { - size = spa_ump_to_midi((const uint32_t**)&c_body, &c_size, data, sizeof(data), &state); - if (size <= 0) - break; - - for (j = 0; j < size; j++) { - if (index >= n_samples) { - /* keep events that don't fit for the next cycle */ - if (p->event_pos < sizeof(p->event_buffer)) - p->event_bufferp->event_pos++ = dataj; - else - unhandled++; - } + for (j = 0; j < size; j++) { + if (index >= n_samples) { + /* keep events that don't fit for the next cycle */ + if (p->event_pos < sizeof(p->event_buffer)) + p->event_bufferp->event_pos++ = dataj; else - dstindex = 0x01000000 | (uint32_t) dataj; - index += 8; + unhandled++; } + else + dstindex = 0x01000000 | (uint32_t) dataj; + index += 8; } } if (unhandled > 0) @@ -497,16 +489,8 @@ continue; if (process_byte(p, i, data & 0xff, &frame, &bytes, &size)) { - uint64_t state = 0; - while (size > 0) { - uint32_t ev4; - int ev_size = spa_ump_from_midi(&bytes, &size, ev, sizeof(ev), 0, &state); - if (ev_size <= 0) - break; - - spa_pod_builder_control(&b, frame, SPA_CONTROL_UMP); - spa_pod_builder_bytes(&b, ev, ev_size); - } + spa_pod_builder_control(&b, frame, SPA_CONTROL_Midi); + spa_pod_builder_bytes(&b, bytes, size); } } spa_pod_builder_pop(&b, &f);
View file
_service:download_files:pipewire-1.6.2.tar.bz2/src/modules/module-filter-chain.c -> _service:download_files:pipewire-1.6.3.tar.bz2/src/modules/module-filter-chain.c
Changed
@@ -128,7 +128,7 @@ * # an example ladspa plugin * type = ladspa * name = pitch - * plugin = "/usr/lib64/ladspa/ladspa-rubberband.so" + * plugin = "ladspa-rubberband" * label = "rubberband-r3-pitchshifter-mono" * control = { * # controls are using the ladspa port names as seen in analyseplugin @@ -1702,6 +1702,19 @@ spa_process_latency_build(&b.b, SPA_PARAM_ProcessLatency, &impl->process_latency); + + if (impl->capture || impl->playback) { + if ((offs = pw_array_add(&offsets, sizeof(uint32_t))) != NULL) + *offs = b.b.state.offset; + + if (impl->capture) + spa_format_audio_raw_build(&b.b, + SPA_PARAM_EnumFormat, &impl->capture_info); + else + spa_format_audio_raw_build(&b.b, + SPA_PARAM_EnumFormat, &impl->playback_info); + } + n_params = pw_array_get_len(&offsets, uint32_t); if (n_params == 0) { res = -ENOMEM; @@ -1717,8 +1730,6 @@ paramsi = spa_pod_builder_deref(&b.b, offsi); if (impl->capture) { - paramsn_params++ = spa_format_audio_raw_build(&b.b, - SPA_PARAM_EnumFormat, &impl->capture_info); flags = PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_MAP_BUFFERS | PW_STREAM_FLAG_RT_PROCESS; @@ -1739,8 +1750,9 @@ spa_pod_dynamic_builder_init(&b, NULL, 0, 4096); } if (impl->playback) { - paramsn_params++ = spa_format_audio_raw_build(&b.b, - SPA_PARAM_EnumFormat, &impl->playback_info); + if (n_params == 0) + paramsn_params++ = spa_format_audio_raw_build(&b.b, + SPA_PARAM_EnumFormat, &impl->playback_info); flags = PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_MAP_BUFFERS |
View file
_service:download_files:pipewire-1.6.2.tar.bz2/src/modules/module-jack-tunnel.c -> _service:download_files:pipewire-1.6.3.tar.bz2/src/modules/module-jack-tunnel.c
Changed
@@ -50,7 +50,6 @@ * * - `jack.library`: the libjack to load, by default libjack.so.0 is searched in * LIBJACK_PATH directories and then some standard library paths. - * Can be an absolute path. * - `jack.server`: the name of the JACK server to tunnel to. * - `jack.client-name`: the name of the JACK client. * - `jack.connect`: if jack ports should be connected automatically. Can also be @@ -243,13 +242,16 @@ } } -static inline void fix_midi_event(uint8_t *data, size_t size) +static inline bool fix_midi_event(const uint8_t *data, size_t size, uint8_t dst3) { /* fixup NoteOn with vel 0 */ if (size > 2 && (data0 & 0xF0) == 0x90 && data2 == 0x00) { - data0 = 0x80 + (data0 & 0x0F); - data2 = 0x40; + dst0 = 0x80 + (data0 & 0x0F); + dst1 = data1; + dst2 = 0x40; + return true; } + return false; } static void midi_to_jack(struct impl *impl, float *dst, float *src, uint32_t n_samples) @@ -260,9 +262,6 @@ struct spa_pod_control c; const void *seq_body, *c_body; int res; - bool in_sysex = false; - uint8_t tmpn_samples * 4; - size_t tmp_size = 0; jack.midi_clear_buffer(dst); if (src == NULL) @@ -274,36 +273,20 @@ return; while (spa_pod_parser_get_control_body(&parser, &c, &c_body) >= 0) { - int size; - size_t c_size = c.value.size; - uint64_t state = 0; + uint32_t size = c.value.size; + const uint8_t *data = c_body; + uint8_t tmp3; - if (c.type != SPA_CONTROL_UMP) + if (c.type != SPA_CONTROL_Midi) continue; - while (c_size > 0) { - size = spa_ump_to_midi((const uint32_t**)&c_body, &c_size, - &tmptmp_size, sizeof(tmp) - tmp_size, &state); - if (size <= 0) - break; - - if (impl->fix_midi) - fix_midi_event(&tmptmp_size, size); - - if (!in_sysex && tmptmp_size == 0xf0) - in_sysex = true; - - tmp_size += size; - if (in_sysex && tmptmp_size-1 == 0xf7) - in_sysex = false; - - if (!in_sysex) { - if ((res = jack.midi_event_write(dst, c.offset, tmp, tmp_size)) < 0) - pw_log_warn("midi %p: can't write event: %s", dst, - spa_strerror(res)); - tmp_size = 0; - } + if (impl->fix_midi && fix_midi_event(data, size, tmp)) { + data = tmp; + size = 3; } + if ((res = jack.midi_event_write(dst, c.offset, data, size)) < 0) + pw_log_warn("midi %p: can't write event: %s", dst, + spa_strerror(res)); } } @@ -319,19 +302,11 @@ spa_pod_builder_push_sequence(&b, &f, 0); for (i = 0; i < count; i++) { jack_midi_event_t ev; - uint64_t state = 0; jack.midi_event_get(&ev, src, i); - while (ev.size > 0) { - uint32_t ump4; - int ump_size = spa_ump_from_midi(&ev.buffer, &ev.size, ump, sizeof(ump), 0, &state); - if (ump_size <= 0) - break; - - spa_pod_builder_control(&b, ev.time, SPA_CONTROL_UMP); - spa_pod_builder_bytes(&b, ump, ump_size); - } + spa_pod_builder_control(&b, ev.time, SPA_CONTROL_Midi); + spa_pod_builder_bytes(&b, ev.buffer, ev.size); } spa_pod_builder_pop(&b, &f); }
View file
_service:download_files:pipewire-1.6.2.tar.bz2/src/modules/module-jack-tunnel/weakjack.h -> _service:download_files:pipewire-1.6.3.tar.bz2/src/modules/module-jack-tunnel/weakjack.h
Changed
@@ -158,34 +158,36 @@ static inline int weakjack_load(struct weakjack *jack, const char *lib) { int res = -ENOENT; + const char *search_dirs, *p, *state = NULL; + char pathPATH_MAX; + size_t len; - if (lib0 != '/') { - const char *search_dirs, *p, *state = NULL; - char pathPATH_MAX; - size_t len; + while ((p = strstr(lib, "../")) != NULL) + lib = p + 3; - search_dirs = getenv("LIBJACK_PATH"); - if (!search_dirs) - search_dirs = PREFIX "/lib64/:" PREFIX "/lib/:" - "/usr/lib64/:/usr/lib/:" LIBDIR; + search_dirs = getenv("LIBJACK_PATH"); + if (!search_dirs) + search_dirs = PREFIX "/lib64/:" PREFIX "/lib/:" + "/usr/lib64/:/usr/lib/:" LIBDIR; - while ((p = pw_split_walk(search_dirs, ":", &len, &state))) { - int pathlen; + res = -ENAMETOOLONG; - if (len >= sizeof(path)) { - res = -ENAMETOOLONG; - continue; - } + while ((p = pw_split_walk(search_dirs, ":", &len, &state))) { + int pathlen; + + if (len == 0 || len >= sizeof(path)) + continue; + + if (strncmp(lib, p, len) == 0 && liblen == '/') + pathlen = snprintf(path, sizeof(path), "%s", lib); + else pathlen = snprintf(path, sizeof(path), "%.*s/%s", (int) len, p, lib); - if (pathlen < 0 || (size_t) pathlen >= sizeof(path)) { - res = -ENAMETOOLONG; - continue; - } - if ((res = weakjack_load_by_path(jack, path)) == 0) - break; - } - } else { - res = weakjack_load_by_path(jack, lib); + + if (pathlen < 0 || (size_t) pathlen >= sizeof(path)) + continue; + + if ((res = weakjack_load_by_path(jack, path)) == 0) + break; } return res; }
View file
_service:download_files:pipewire-1.6.2.tar.bz2/src/modules/module-netjack2/peer.c -> _service:download_files:pipewire-1.6.3.tar.bz2/src/modules/module-netjack2/peer.c
Changed
@@ -273,37 +273,16 @@ } static inline void n2j_midi_buffer_write(struct nj2_midi_buffer *buf, - uint32_t offset, void *data, uint32_t size) + uint32_t offset, const void *data, uint32_t size, bool fix) { - void *ptr = n2j_midi_buffer_reserve(buf, offset, size); - if (ptr != NULL) + uint8_t *ptr = n2j_midi_buffer_reserve(buf, offset, size); + if (ptr != NULL) { memcpy(ptr, data, size); - else - buf->lost_events++; -} - -static inline void n2j_midi_buffer_append(struct nj2_midi_buffer *buf, - void *data, uint32_t size) -{ - struct nj2_midi_event *ev; - uint32_t old_size; - uint8_t *old_ptr, *new_ptr; - - ev = &buf->event--buf->event_count; - old_size = ev->size; - if (old_size <= MIDI_INLINE_MAX) { - old_ptr = ev->buffer; - } else { - buf->write_pos -= old_size; - old_ptr = SPA_PTROFF(buf, ev->offset, void); + if (fix) + fix_midi_event(ptr, size); } - new_ptr = n2j_midi_buffer_reserve(buf, ev->time, old_size + size); - if (new_ptr == NULL) { + else buf->lost_events++; - } else { - memmove(new_ptr, old_ptr, old_size); - memcpy(new_ptr+old_size, data, size); - } } static void midi_to_netjack2(struct netjack2_peer *peer, @@ -314,7 +293,6 @@ struct spa_pod_sequence seq; struct spa_pod_control c; const void *seq_body, *c_body; - bool in_sysex = false; buf->magic = MIDI_BUFFER_MAGIC; buf->buffer_size = peer->params.period_size * sizeof(float); @@ -332,39 +310,17 @@ return; while (spa_pod_parser_get_control_body(&parser, &c, &c_body) >= 0) { - int size; - uint8_t data16; - bool was_sysex = in_sysex; - size_t c_size = c.value.size; - uint64_t state = 0; + uint32_t size = c.value.size; + const uint8_t *data = c_body; - if (c.type != SPA_CONTROL_UMP) + if (c.type != SPA_CONTROL_Midi) continue; - while (c_size > 0) { - size = spa_ump_to_midi((const uint32_t**)&c_body, &c_size, data, sizeof(data), &state); - if (size <= 0) - break; - - if (c.offset >= n_samples) { - buf->lost_events++; - continue; - } - - if (!in_sysex && data0 == 0xf0) - in_sysex = true; - - if (!in_sysex && peer->fix_midi) - fix_midi_event(data, size); - - if (in_sysex && datasize-1 == 0xf7) - in_sysex = false; - - if (was_sysex) - n2j_midi_buffer_append(buf, data, size); - else - n2j_midi_buffer_write(buf, c.offset, data, size); + if (c.offset >= n_samples) { + buf->lost_events++; + continue; } + n2j_midi_buffer_write(buf, c.offset, data, size, peer->fix_midi); } if (buf->write_pos > 0) memmove(SPA_PTROFF(buf, sizeof(*buf) + buf->event_count * sizeof(struct nj2_midi_event), void), @@ -395,8 +351,6 @@ for (i = 0; i < buf->event_count; i++) { struct nj2_midi_event *ev = &buf->eventi; uint8_t *data; - size_t s; - uint64_t state = 0; if (ev->size <= MIDI_INLINE_MAX) data = ev->buffer; @@ -405,17 +359,8 @@ else continue; - s = ev->size; - while (s > 0) { - uint32_t ump4; - int ump_size = spa_ump_from_midi(&data, &s, ump, sizeof(ump), 0, &state); - if (ump_size <= 0) { - pw_log_warn("invalid MIDI received: %s", spa_strerror(ump_size)); - break; - } - spa_pod_builder_control(&b, ev->time, SPA_CONTROL_UMP); - spa_pod_builder_bytes(&b, ump, ump_size); - } + spa_pod_builder_control(&b, ev->time, SPA_CONTROL_Midi); + spa_pod_builder_bytes(&b, data, ev->size); } spa_pod_builder_pop(&b, &f); }
View file
_service:download_files:pipewire-1.6.2.tar.bz2/src/modules/module-protocol-native/connection.c -> _service:download_files:pipewire-1.6.3.tar.bz2/src/modules/module-protocol-native/connection.c
Changed
@@ -536,7 +536,7 @@ size -= impl->hdr_size; buf->msg.fds = &buf->fdsbuf->fds_offset; - if (buf->msg.n_fds + buf->fds_offset > MAX_FDS) + if (buf->msg.n_fds + buf->fds_offset > buf->n_fds) return -EPROTO; if (size < len)
View file
_service:download_files:pipewire-1.6.2.tar.bz2/src/modules/module-raop-sink.c -> _service:download_files:pipewire-1.6.3.tar.bz2/src/modules/module-raop-sink.c
Changed
@@ -130,11 +130,6 @@ PW_LOG_TOPIC(mod_topic, "mod." NAME); #define PW_LOG_TOPIC_DEFAULT mod_topic -#define BUFFER_SIZE (1u<<22) -#define BUFFER_MASK (BUFFER_SIZE-1) -#define BUFFER_SIZE2 (BUFFER_SIZE>>1) -#define BUFFER_MASK2 (BUFFER_SIZE2-1) - #define FRAMES_PER_TCP_PACKET 4096 #define FRAMES_PER_UDP_PACKET 352 @@ -273,13 +268,6 @@ bool mute; float volume; - - struct spa_ringbuffer ring; - uint8_t bufferBUFFER_SIZE; - - struct spa_io_position *io_position; - - uint32_t filled; }; static inline void bit_writer(uint8_t **p, int *pos, uint8_t data, int len) @@ -357,7 +345,7 @@ res = sendmsg(impl->control_fd, &msg, MSG_NOSIGNAL); if (res < 0) { res = -errno; - pw_log_warn("error sending control packet: %d", res); + pw_log_warn("error sending control packet: %d (%m)", res); } pw_log_debug("raop control sync: first:%d latency:%u now:%"PRIx64" rtptime:%u",
View file
_service:download_files:pipewire-1.6.2.tar.bz2/src/modules/module-rtp/audio.c -> _service:download_files:pipewire-1.6.3.tar.bz2/src/modules/module-rtp/audio.c
Changed
@@ -546,7 +546,7 @@ else header.m = 0; - rtp_timestamp = impl->ts_offset + (set_timestamp ? set_timestamp : timestamp); + rtp_timestamp = impl->ts_offset + impl->ts_align + (set_timestamp ? set_timestamp : timestamp); header.sequence_number = htons(impl->seq); header.timestamp = htonl(rtp_timestamp); @@ -556,12 +556,12 @@ ((uint64_t)timestamp * stride) % impl->actual_max_buffer_size, &iov1, tosend * stride); - pw_log_trace("sending %d packet:%d ts_offset:%d timestamp:%u (%f s)", + pw_log_trace_fp("sending %d packet:%d ts_offset:%d timestamp:%u (%f s)", tosend, num_packets, impl->ts_offset, timestamp, (double)timestamp * impl->io_position->clock.rate.num / impl->io_position->clock.rate.denom); - rtp_stream_emit_send_packet(impl, iov, 3); + rtp_stream_call_send_packet(impl, iov, 3); impl->seq++; impl->first = false; @@ -705,8 +705,10 @@ * that resynchronization is needed, then this will be done immediately below. */ if (!impl->have_sync) { - pw_log_info("(re)sync to timestamp:%u seq:%u ts_offset:%u SSRC:%u", - actual_timestamp, impl->seq, impl->ts_offset, impl->ssrc); + if (!impl->direct_timestamp) + impl->ts_align = actual_timestamp - impl->ring.readindex; + pw_log_info("(re)sync to timestamp:%u seq:%u ts_offset:%u ts_align:%u SSRC:%u", + actual_timestamp, impl->seq, impl->ts_offset, impl->ts_align, impl->ssrc); spa_ringbuffer_read_update(&impl->ring, actual_timestamp); spa_ringbuffer_write_update(&impl->ring, actual_timestamp); memset(impl->buffer, 0, BUFFER_SIZE);
View file
_service:download_files:pipewire-1.6.2.tar.bz2/src/modules/module-rtp/midi.c -> _service:download_files:pipewire-1.6.3.tar.bz2/src/modules/module-rtp/midi.c
Changed
@@ -151,7 +151,7 @@ return -EINVAL; j = (struct rtp_midi_journal*)packet; uint16_t seqnum = ntohs(j->checkpoint_seqnum); - rtp_stream_emit_send_feedback(impl, seqnum); + rtp_stream_call_send_feedback(impl, seqnum); return 0; } @@ -271,9 +271,6 @@ while (offs < end) { uint32_t delta; int size; - uint64_t state = 0; - uint8_t *d; - size_t s; if (first && !hdr.z) delta = 0; @@ -294,17 +291,9 @@ return -EINVAL; } - d = &packetoffs; - s = size; - while (s > 0) { - uint32_t ump4; - int ump_size = spa_ump_from_midi(&d, &s, ump, sizeof(ump), 0, &state); - if (ump_size <= 0) - break; + spa_pod_builder_control(&b, timestamp, SPA_CONTROL_Midi); + spa_pod_builder_bytes(&b, &packetoffs, size); - spa_pod_builder_control(&b, timestamp, SPA_CONTROL_UMP); - spa_pod_builder_bytes(&b, ump, ump_size); - } offs += size; first = false; } @@ -378,7 +367,7 @@ return -EINVAL; } -static int write_event(uint8_t *p, uint32_t buffer_size, uint32_t value, void *ev, uint32_t size) +static int write_event(uint8_t *p, uint32_t buffer_size, uint32_t value, const void *ev, uint32_t size) { uint64_t buffer; uint8_t b; @@ -437,62 +426,54 @@ while (spa_pod_parser_get_control_body(parser, &c, &c_body) >= 0) { uint32_t delta, offset; - uint8_t event16; - int size; - size_t c_size = c.value.size; - uint64_t state = 0; + uint32_t size = c.value.size; + const uint8_t *data = c_body; - if (c.type != SPA_CONTROL_UMP) + if (c.type != SPA_CONTROL_Midi) continue; - while (c_size > 0) { - size = spa_ump_to_midi((const uint32_t **)&c_body, &c_size, event, sizeof(event), &state); - if (size <= 0) - break; - - offset = c.offset * impl->rate / rate; - - if (len > 0 && (len + size > max_size || - offset - base > impl->psamples)) { - /* flush packet when we have one and when it's either - * too large or has too much data. */ - if (len < 16) { - midi_header.b = 0; - midi_header.len = len; - iov1.iov_len = sizeof(midi_header) - 1; - } else { - midi_header.b = 1; - midi_header.len = (len >> 8) & 0xf; - midi_header.len_b = len & 0xff; - iov1.iov_len = sizeof(midi_header); - } - iov2.iov_len = len; - - pw_log_trace("sending %d timestamp:%d %u %u", - len, timestamp + base, - offset, impl->psamples); - rtp_stream_emit_send_packet(impl, iov, 3); - - impl->seq++; - len = 0; - } - if ((unsigned int)size > BUFFER_SIZE || len > BUFFER_SIZE - size) { - pw_log_error("Buffer overflow prevented!"); - return; // FIXME: what to do instead? - } - if (len == 0) { - /* start new packet */ - base = prev_offset = offset; - header.sequence_number = htons(impl->seq); - header.timestamp = htonl(impl->ts_offset + timestamp + base); - - memcpy(&impl->bufferlen, event, size); - len += size; + offset = c.offset * impl->rate / rate; + + if (len > 0 && (len + size > max_size || + offset - base > impl->psamples)) { + /* flush packet when we have one and when it's either + * too large or has too much data. */ + if (len < 16) { + midi_header.b = 0; + midi_header.len = len; + iov1.iov_len = sizeof(midi_header) - 1; } else { - delta = offset - prev_offset; - prev_offset = offset; - len += write_event(&impl->bufferlen, BUFFER_SIZE - len, delta, event, size); + midi_header.b = 1; + midi_header.len = (len >> 8) & 0xf; + midi_header.len_b = len & 0xff; + iov1.iov_len = sizeof(midi_header); } + iov2.iov_len = len; + + pw_log_trace("sending %d timestamp:%d %u %u", + len, timestamp + base, + offset, impl->psamples); + rtp_stream_call_send_packet(impl, iov, 3); + + impl->seq++; + len = 0; + } + if ((unsigned int)size > BUFFER_SIZE || len > BUFFER_SIZE - size) { + pw_log_error("Buffer overflow prevented!"); + return; // FIXME: what to do instead? + } + if (len == 0) { + /* start new packet */ + base = prev_offset = offset; + header.sequence_number = htons(impl->seq); + header.timestamp = htonl(impl->ts_offset + timestamp + base); + + memcpy(&impl->bufferlen, data, size); + len += size; + } else { + delta = offset - prev_offset; + prev_offset = offset; + len += write_event(&impl->bufferlen, BUFFER_SIZE - len, delta, data, size); } } if (len > 0) { @@ -510,7 +491,7 @@ iov2.iov_len = len; pw_log_trace("sending %d timestamp:%d", len, base); - rtp_stream_emit_send_packet(impl, iov, 3); + rtp_stream_call_send_packet(impl, iov, 3); impl->seq++; } }
View file
_service:download_files:pipewire-1.6.2.tar.bz2/src/modules/module-rtp/opus.c -> _service:download_files:pipewire-1.6.3.tar.bz2/src/modules/module-rtp/opus.c
Changed
@@ -252,7 +252,7 @@ pw_log_trace("sending %d len:%d timestamp:%d", tosend, res, timestamp); iov1.iov_len = res; - rtp_stream_emit_send_packet(impl, iov, 2); + rtp_stream_call_send_packet(impl, iov, 2); impl->seq++; timestamp += tosend;
View file
_service:download_files:pipewire-1.6.2.tar.bz2/src/modules/module-rtp/stream.c -> _service:download_files:pipewire-1.6.3.tar.bz2/src/modules/module-rtp/stream.c
Changed
@@ -48,8 +48,11 @@ #define rtp_stream_emit_open_connection(s,r) rtp_stream_emit(s, open_connection, 0,r) #define rtp_stream_emit_close_connection(s,r) rtp_stream_emit(s, close_connection, 0,r) #define rtp_stream_emit_param_changed(s,i,p) rtp_stream_emit(s, param_changed,0,i,p) -#define rtp_stream_emit_send_packet(s,i,l) rtp_stream_emit(s, send_packet,0,i,l) -#define rtp_stream_emit_send_feedback(s,seq) rtp_stream_emit(s, send_feedback,0,seq) + +#define rtp_stream_call(s,m,v,...) spa_callbacks_call_fast(&s->rtp_callbacks, \ + struct rtp_stream_events, m, v, ##__VA_ARGS__) +#define rtp_stream_call_send_packet(s,i,l) rtp_stream_call(s, send_packet,0,i,l) +#define rtp_stream_call_send_feedback(s,seq) rtp_stream_call(s, send_feedback,0,seq) enum rtp_stream_internal_state { /* The state when the stream is idle / stopped. The background @@ -85,6 +88,8 @@ struct spa_hook stream_listener; struct pw_stream_events stream_events; + struct spa_callbacks rtp_callbacks; + struct spa_hook_list listener_list; struct spa_hook listener; @@ -109,6 +114,7 @@ uint32_t mtu; uint32_t header_size; uint32_t payload_size; + uint32_t ts_align; struct spa_ringbuffer ring; uint8_t bufferBUFFER_SIZE; @@ -426,7 +432,7 @@ * because a stop involves closing the connection. If the timer is still * running, it needs an open connection for sending out remaining packets. */ if (!timer_running) { - int res; + int res = 0; pw_log_info("closing connection as part of stopping the stream"); rtp_stream_emit_close_connection(impl, &res); if (res > 0) { @@ -1002,6 +1008,7 @@ (res = stream_start(impl)) < 0) goto out; + impl->rtp_callbacks = SPA_CALLBACKS_INIT(events, data); spa_hook_list_append(&impl->listener_list, &impl->listener, events, data); return (struct rtp_stream*)impl;
View file
_service:download_files:pipewire-1.6.2.tar.bz2/src/modules/module-vban/midi.c -> _service:download_files:pipewire-1.6.3.tar.bz2/src/modules/module-vban/midi.c
Changed
@@ -163,9 +163,6 @@ while (offs < plen) { int size; - uint8_t *midi_data; - size_t midi_size; - uint64_t midi_state = 0; size = get_midi_size(&packetoffs, plen - offs); if (size <= 0 || offs + size > plen) { @@ -174,18 +171,9 @@ break; } - midi_data = &packetoffs; - midi_size = size; - while (midi_size > 0) { - uint32_t ump4; - int ump_size = spa_ump_from_midi(&midi_data, &midi_size, - ump, sizeof(ump), 0, &midi_state); - if (ump_size <= 0) - break; - - spa_pod_builder_control(&b, timestamp, SPA_CONTROL_UMP); - spa_pod_builder_bytes(&b, ump, ump_size); - } + spa_pod_builder_control(&b, timestamp, SPA_CONTROL_Midi); + spa_pod_builder_bytes(&b, &packetoffs, size); + offs += size; } spa_pod_builder_pop(&b, &f0); @@ -237,34 +225,25 @@ len = 0; while (spa_pod_parser_get_control_body(parser, &c, &c_body) >= 0) { - int size; - uint8_t event16; - uint64_t state = 0; - size_t c_size = c.value.size; + uint32_t size = c.value.size; + const void *data = c_body; - if (c.type != SPA_CONTROL_UMP) + if (c.type != SPA_CONTROL_Midi) continue; - while (c_size > 0) { - size = spa_ump_to_midi((const uint32_t**)&c_body, - &c_size, event, sizeof(event), &state); - if (size <= 0) - break; - - if (len == 0) { - /* start new packet */ - header.n_frames++; - } else if (len + size > impl->mtu) { - /* flush packet when we have one and when it's too large */ - iov1.iov_len = len; - - pw_log_debug("sending %d", len); - vban_stream_emit_send_packet(impl, iov, 2); - len = 0; - } - memcpy(&impl->bufferlen, event, size); - len += size; + if (len == 0) { + /* start new packet */ + header.n_frames++; + } else if (len + size > impl->mtu) { + /* flush packet when we have one and when it's too large */ + iov1.iov_len = len; + + pw_log_debug("sending %d", len); + vban_stream_emit_send_packet(impl, iov, 2); + len = 0; } + memcpy(&impl->bufferlen, data, size); + len += size; } if (len > 0) { /* flush last packet */
View file
_service:download_files:pipewire-1.6.2.tar.bz2/src/pipewire/filter.c -> _service:download_files:pipewire-1.6.3.tar.bz2/src/pipewire/filter.c
Changed
@@ -692,7 +692,10 @@ void *ptr; struct pw_map_range range; - pw_map_range_init(&range, data->mapoffset, data->maxsize, impl->context->sc_pagesize); + if (pw_map_range_init(&range, data->mapoffset, data->maxsize, impl->context->sc_pagesize) < 0) { + pw_log_error("%p: invalid buffer map range", impl); + return -EOVERFLOW; + } ptr = mmap(NULL, range.size, prot, MAP_SHARED, data->fd, range.offset); if (ptr == MAP_FAILED) { @@ -721,7 +724,8 @@ { struct pw_map_range range; - pw_map_range_init(&range, data->mapoffset, data->maxsize, impl->context->sc_pagesize); + if (pw_map_range_init(&range, data->mapoffset, data->maxsize, impl->context->sc_pagesize) < 0) + return -EOVERFLOW; if (munmap(SPA_PTROFF(data->data, -range.start, void), range.size) < 0) pw_log_warn("%p: failed to unmap: %m", impl); @@ -1793,11 +1797,13 @@ SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_application), SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_control), 0); +#if 0 if (types != 0) { spa_pod_builder_add(&b, SPA_FORMAT_CONTROL_types, SPA_POD_CHOICE_FLAGS_Int(types), 0); } +#endif add_param(impl, port, SPA_PARAM_EnumFormat, PARAM_FLAG_LOCKED, spa_pod_builder_pop(&b, &f0)); } @@ -1857,10 +1863,13 @@ add_video_dsp_port_params(impl, p); else if (spa_streq(str, "8 bit raw midi")) add_control_dsp_port_params(impl, p, 1u << SPA_CONTROL_Midi); - else if (spa_streq(str, "8 bit raw control")) + else if (spa_streq(str, "8 bit raw control")) { add_control_dsp_port_params(impl, p, 0); + pw_properties_set(props, "control.ump", "false"); + } else if (spa_streq(str, "32 bit raw UMP")) { add_control_dsp_port_params(impl, p, 1u << SPA_CONTROL_UMP); + pw_properties_set(props, "control.ump", "true"); pw_properties_set(props, PW_KEY_FORMAT_DSP, "8 bit raw midi"); } }
View file
_service:download_files:pipewire-1.6.2.tar.bz2/src/pipewire/impl-module.c -> _service:download_files:pipewire-1.6.3.tar.bz2/src/pipewire/impl-module.c
Changed
@@ -154,6 +154,9 @@ NULL }; + while ((p = strstr(name, "../")) != NULL) + name = p + 3; + pw_log_info("%p: name:%s args:%s", context, name, args); module_dir = getenv("PIPEWIRE_MODULE_DIR");
View file
_service:download_files:pipewire-1.6.2.tar.bz2/src/pipewire/impl-node.c -> _service:download_files:pipewire-1.6.3.tar.bz2/src/pipewire/impl-node.c
Changed
@@ -537,21 +537,6 @@ if (this->info.state > 0 && this->info.state <= PW_NODE_STATE_SUSPENDED) return 0; - spa_list_for_each(p, &this->input_ports, link) { - if (p->busy_count > 0) { - pw_log_debug("%p: can't suspend, input port %d busy:%d", - this, p->port_id, p->busy_count); - return -EBUSY; - } - } - spa_list_for_each(p, &this->output_ports, link) { - if (p->busy_count > 0) { - pw_log_debug("%p: can't suspend, output port %d busy:%d", - this, p->port_id, p->busy_count); - return -EBUSY; - } - } - node_deactivate(this); pw_log_debug("%p: suspend node driving:%d driver:%d prepared:%d", this,
View file
_service:download_files:pipewire-1.6.2.tar.bz2/src/pipewire/impl-port.c -> _service:download_files:pipewire-1.6.3.tar.bz2/src/pipewire/impl-port.c
Changed
@@ -1087,11 +1087,11 @@ static int setup_mixer(struct pw_impl_port *port, const struct spa_pod *param) { - uint32_t media_type, media_subtype; + uint32_t media_type, media_subtype, n_items; int res; - const char *fallback_lib, *factory_name; + const char *fallback_lib, *factory_name, *str; struct spa_handle *handle; - struct spa_dict_item items3; + struct spa_dict_item items4; char quantum_limit16; void *iface; struct pw_context *context = port->node->context; @@ -1143,14 +1143,17 @@ return -ENOTSUP; } - items0 = SPA_DICT_ITEM_INIT(SPA_KEY_LIBRARY_NAME, fallback_lib); + n_items = 0; + itemsn_items++ = SPA_DICT_ITEM_INIT(SPA_KEY_LIBRARY_NAME, fallback_lib); spa_scnprintf(quantum_limit, sizeof(quantum_limit), "%u", context->settings.clock_quantum_limit); - items1 = SPA_DICT_ITEM_INIT("clock.quantum-limit", quantum_limit); - items2 = SPA_DICT_ITEM_INIT(PW_KEY_NODE_LOOP_NAME, port->node->data_loop->name); + itemsn_items++ = SPA_DICT_ITEM_INIT("clock.quantum-limit", quantum_limit); + itemsn_items++ = SPA_DICT_ITEM_INIT(PW_KEY_NODE_LOOP_NAME, port->node->data_loop->name); + if ((str = pw_properties_get(port->properties, "control.ump")) != NULL) + itemsn_items++ = SPA_DICT_ITEM_INIT("control.ump", str); handle = pw_context_load_spa_handle(context, factory_name, - &SPA_DICT_INIT_ARRAY(items)); + &SPA_DICT_INIT(items, n_items)); if (handle == NULL) return -errno;
View file
_service:download_files:pipewire-1.6.2.tar.bz2/src/pipewire/mem.c -> _service:download_files:pipewire-1.6.3.tar.bz2/src/pipewire/mem.c
Changed
@@ -420,7 +420,10 @@ m = memblock_find_mapping(b, flags, offset, size); if (m == NULL) { struct pw_map_range range; - pw_map_range_init(&range, offset, size, p->pagesize); + if (pw_map_range_init(&range, offset, size, p->pagesize) < 0) { + errno = EOVERFLOW; + return NULL; + } m = memblock_map(b, flags, range.offset, range.size); if (m == NULL)
View file
_service:download_files:pipewire-1.6.2.tar.bz2/src/pipewire/mem.h -> _service:download_files:pipewire-1.6.3.tar.bz2/src/pipewire/mem.h
Changed
@@ -178,14 +178,21 @@ #define PW_MAP_RANGE_INIT (struct pw_map_range){ 0, } /** Calculate parameters to mmap() memory into \a range so that - * \a size bytes at \a offset can be mapped with mmap(). */ -PW_API_MEM void pw_map_range_init(struct pw_map_range *range, + * \a size bytes at \a offset can be mapped with mmap(). + * Returns 0 on success, -EOVERFLOW if offset + size overflows. */ +PW_API_MEM int pw_map_range_init(struct pw_map_range *range, uint32_t offset, uint32_t size, uint32_t page_size) { range->offset = SPA_ROUND_DOWN_N(offset, page_size); range->start = offset - range->offset; + if (size > UINT32_MAX - range->start) + return -EOVERFLOW; + /* Check that rounding up to page_size won't overflow */ + if (range->start + size > UINT32_MAX - (page_size - 1)) + return -EOVERFLOW; range->size = SPA_ROUND_UP_N(range->start + size, page_size); + return 0; } /**
View file
_service:download_files:pipewire-1.6.2.tar.bz2/src/pipewire/pipewire.c -> _service:download_files:pipewire-1.6.3.tar.bz2/src/pipewire/pipewire.c
Changed
@@ -232,6 +232,9 @@ if (lib == NULL) lib = sup->support_lib; + while ((p = strstr(lib, "../")) != NULL) + lib = p + 3; + pw_log_debug("load lib:'%s' factory-name:'%s'", lib, factory_name); plugin = NULL;
View file
_service:download_files:pipewire-1.6.2.tar.bz2/src/pipewire/stream.c -> _service:download_files:pipewire-1.6.3.tar.bz2/src/pipewire/stream.c
Changed
@@ -807,7 +807,10 @@ void *ptr; struct pw_map_range range; - pw_map_range_init(&range, data->mapoffset, data->maxsize, impl->context->sc_pagesize); + if (pw_map_range_init(&range, data->mapoffset, data->maxsize, impl->context->sc_pagesize) < 0) { + pw_log_error("%p: invalid buffer map range", impl); + return -EOVERFLOW; + } ptr = mmap(NULL, range.size, prot, MAP_SHARED, data->fd, range.offset); if (ptr == MAP_FAILED) { @@ -837,7 +840,8 @@ { struct pw_map_range range; - pw_map_range_init(&range, data->mapoffset, data->maxsize, impl->context->sc_pagesize); + if (pw_map_range_init(&range, data->mapoffset, data->maxsize, impl->context->sc_pagesize) < 0) + return -EOVERFLOW; if (munmap(SPA_PTROFF(data->data, -range.start, void), range.size) < 0) pw_log_warn("%p: failed to unmap: %m", impl);
View file
_service:download_files:pipewire-1.6.2.tar.bz2/src/tools/pw-mididump.c -> _service:download_files:pipewire-1.6.3.tar.bz2/src/tools/pw-mididump.c
Changed
@@ -33,7 +33,7 @@ struct pw_filter *filter; struct port *in_port; int64_t clock_time; - bool opt_midi1; + bool force_ump; }; @@ -174,7 +174,8 @@ PW_FILTER_PORT_FLAG_MAP_BUFFERS, sizeof(struct port), pw_properties_new( - PW_KEY_FORMAT_DSP, data->opt_midi1 ? "8 bit raw midi" : "32 bit raw UMP", + PW_KEY_FORMAT_DSP, + data->force_ump ? "32 bit raw UMP" : "8 bit raw midi", PW_KEY_PORT_NAME, "input", NULL), NULL, 0); @@ -198,7 +199,7 @@ " -h, --help Show this help\n" " --version Show version\n" " -r, --remote Remote daemon name\n" - " -M, --force-midi Force midi format, one of \"midi\" or \"ump\",(default ump)\n", + " -M, --force-midi Force midi format, one of \"midi\" or \"ump\",(default midi)\n", name); } @@ -238,9 +239,9 @@ case 'M': if (spa_streq(optarg, "midi")) - data.opt_midi1 = true; + data.force_ump = false; else if (spa_streq(optarg, "ump")) - data.opt_midi1 = false; + data.force_ump = true; else { fprintf(stderr, "error: bad force-midi %s\n", optarg); show_help(argv0, true);
View file
_service:download_files:pipewire-1.6.2.tar.bz2/test/test-mempool.c -> _service:download_files:pipewire-1.6.3.tar.bz2/test/test-mempool.c
Changed
@@ -41,9 +41,74 @@ return PWTEST_PASS; } +PWTEST(map_range_overflow) +{ + /* + * Test that pw_map_range_init rejects offset + size combinations + * that would overflow uint32_t, which could cause mmap with a + * truncated size and subsequent out-of-bounds access. + */ + struct pw_map_range range; + uint32_t page_size = 4096; + int res; + + /* Normal case: should succeed */ + res = pw_map_range_init(&range, 0, 4096, page_size); + pwtest_int_eq(res, 0); + pwtest_int_eq(range.offset, 0u); + pwtest_int_eq(range.start, 0u); + pwtest_int_eq(range.size, 4096u); + + /* Page-aligned offset: should succeed */ + res = pw_map_range_init(&range, 4096, 4096, page_size); + pwtest_int_eq(res, 0); + pwtest_int_eq(range.offset, 4096u); + pwtest_int_eq(range.start, 0u); + pwtest_int_eq(range.size, 4096u); + + /* Non-aligned offset: start gets the remainder */ + res = pw_map_range_init(&range, 100, 4096, page_size); + pwtest_int_eq(res, 0); + pwtest_int_eq(range.offset, 0u); + pwtest_int_eq(range.start, 100u); + + /* size=0: should succeed */ + res = pw_map_range_init(&range, 0, 0, page_size); + pwtest_int_eq(res, 0); + + /* Overflow: non-aligned offset causes start > 0, then start + size wraps */ + res = pw_map_range_init(&range, 4095, 0xFFFFF002, page_size); + pwtest_int_lt(res, 0); + + /* Overflow: max size with any non-zero start */ + res = pw_map_range_init(&range, 1, UINT32_MAX, page_size); + pwtest_int_lt(res, 0); + + /* Both large but page-aligned: start=0, start+size=0x80000000, + * round-up doesn't overflow, so this should succeed */ + res = pw_map_range_init(&range, 0x80000000, 0x80000000, page_size); + pwtest_int_eq(res, 0); + + /* Non-aligned offset but still fits: start=1, start+size=0x80000001 */ + res = pw_map_range_init(&range, 0x80000001, 0x80000000, page_size); + pwtest_int_eq(res, 0); + + /* Overflow: round-up of start+size would exceed uint32 */ + res = pw_map_range_init(&range, 1, UINT32_MAX - 1, page_size); + pwtest_int_lt(res, 0); + + /* start=0, size=UINT32_MAX: start + size doesn't wrap, but + * SPA_ROUND_UP_N to page_size would overflow, so must fail */ + res = pw_map_range_init(&range, 0, UINT32_MAX, page_size); + pwtest_int_lt(res, 0); + + return PWTEST_PASS; +} + PWTEST_SUITE(pw_mempool) { pwtest_add(mempool_issue4884, PWTEST_NOARG); + pwtest_add(map_range_overflow, PWTEST_NOARG); return PWTEST_PASS; }
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.