mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
PulseAudio: Try fixing a channel mapping bug.
Public issue https://github.com/mackron/miniaudio/issues/811
This commit is contained in:
+17
-4
@@ -30388,6 +30388,7 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi
|
|||||||
ma_pa_buffer_attr attr;
|
ma_pa_buffer_attr attr;
|
||||||
const ma_pa_sample_spec* pActualSS = NULL;
|
const ma_pa_sample_spec* pActualSS = NULL;
|
||||||
const ma_pa_buffer_attr* pActualAttr = NULL;
|
const ma_pa_buffer_attr* pActualAttr = NULL;
|
||||||
|
const ma_pa_channel_map* pActualChannelMap = NULL;
|
||||||
ma_uint32 iChannel;
|
ma_uint32 iChannel;
|
||||||
ma_pa_stream_flags_t streamFlags;
|
ma_pa_stream_flags_t streamFlags;
|
||||||
|
|
||||||
@@ -30537,7 +30538,12 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi
|
|||||||
goto on_error4;
|
goto on_error4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Internal channel map. */
|
/* Internal channel map. */
|
||||||
|
pActualChannelMap = ((ma_pa_stream_get_channel_map_proc)pDevice->pContext->pulse.pa_stream_get_channel_map)((ma_pa_stream*)pDevice->pulse.pStreamCapture);
|
||||||
|
if (pActualChannelMap == NULL) {
|
||||||
|
pActualChannelMap = &cmap; /* Fallback just in case. */
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Bug in PipeWire. There have been reports that PipeWire is returning AUX channels when reporting
|
Bug in PipeWire. There have been reports that PipeWire is returning AUX channels when reporting
|
||||||
@@ -30547,8 +30553,8 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi
|
|||||||
fixed sooner than later. I might remove this hack later.
|
fixed sooner than later. I might remove this hack later.
|
||||||
*/
|
*/
|
||||||
if (pDescriptorCapture->channels > 2) {
|
if (pDescriptorCapture->channels > 2) {
|
||||||
for (iChannel = 0; iChannel < pDescriptorCapture->channels; ++iChannel) {
|
for (iChannel = 0; iChannel < pDescriptorCapture->channels; iChannel += 1) {
|
||||||
pDescriptorCapture->channelMap[iChannel] = ma_channel_position_from_pulse(cmap.map[iChannel]);
|
pDescriptorCapture->channelMap[iChannel] = ma_channel_position_from_pulse(pActualChannelMap->map[iChannel]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Hack for mono and stereo. */
|
/* Hack for mono and stereo. */
|
||||||
@@ -30689,7 +30695,12 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi
|
|||||||
goto on_error4;
|
goto on_error4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Internal channel map. */
|
/* Internal channel map. */
|
||||||
|
pActualChannelMap = ((ma_pa_stream_get_channel_map_proc)pDevice->pContext->pulse.pa_stream_get_channel_map)((ma_pa_stream*)pDevice->pulse.pStreamPlayback);
|
||||||
|
if (pActualChannelMap == NULL) {
|
||||||
|
pActualChannelMap = &cmap; /* Fallback just in case. */
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Bug in PipeWire. There have been reports that PipeWire is returning AUX channels when reporting
|
Bug in PipeWire. There have been reports that PipeWire is returning AUX channels when reporting
|
||||||
@@ -30699,8 +30710,8 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi
|
|||||||
fixed sooner than later. I might remove this hack later.
|
fixed sooner than later. I might remove this hack later.
|
||||||
*/
|
*/
|
||||||
if (pDescriptorPlayback->channels > 2) {
|
if (pDescriptorPlayback->channels > 2) {
|
||||||
for (iChannel = 0; iChannel < pDescriptorPlayback->channels; ++iChannel) {
|
for (iChannel = 0; iChannel < pDescriptorPlayback->channels; iChannel += 1) {
|
||||||
pDescriptorPlayback->channelMap[iChannel] = ma_channel_position_from_pulse(cmap.map[iChannel]);
|
pDescriptorPlayback->channelMap[iChannel] = ma_channel_position_from_pulse(pActualChannelMap->map[iChannel]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Hack for mono and stereo. */
|
/* Hack for mono and stereo. */
|
||||||
@@ -72068,6 +72079,8 @@ static ma_uint16 ma_node_config_get_cache_size_in_frames(const ma_node_config* p
|
|||||||
{
|
{
|
||||||
ma_uint32 cacheSizeInFrames;
|
ma_uint32 cacheSizeInFrames;
|
||||||
|
|
||||||
|
(void)pConfig;
|
||||||
|
|
||||||
if (pNodeGraph->processingSizeInFrames > 0) {
|
if (pNodeGraph->processingSizeInFrames > 0) {
|
||||||
cacheSizeInFrames = pNodeGraph->processingSizeInFrames;
|
cacheSizeInFrames = pNodeGraph->processingSizeInFrames;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user