Commit 16960316 authored by Taiko2k's avatar Taiko2k Committed by David Reid

Tweak pulseaudio stream flags

parent 90bdda29
...@@ -30304,6 +30304,7 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi ...@@ -30304,6 +30304,7 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi
if (pDescriptorCapture->sampleRate != 0) { if (pDescriptorCapture->sampleRate != 0) {
ss.rate = pDescriptorCapture->sampleRate; ss.rate = pDescriptorCapture->sampleRate;
} }
streamFlags = MA_PA_STREAM_START_CORKED | MA_PA_STREAM_ADJUST_LATENCY;
if (ma_format_from_pulse(ss.format) == ma_format_unknown) { if (ma_format_from_pulse(ss.format) == ma_format_unknown) {
if (ma_is_little_endian()) { if (ma_is_little_endian()) {
...@@ -30311,14 +30312,17 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi ...@@ -30311,14 +30312,17 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi
} else { } else {
ss.format = MA_PA_SAMPLE_FLOAT32BE; ss.format = MA_PA_SAMPLE_FLOAT32BE;
} }
streamFlags |= MA_PA_STREAM_FIX_FORMAT;
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] sample_spec.format not supported by miniaudio. Defaulting to PA_SAMPLE_FLOAT32.\n"); ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] sample_spec.format not supported by miniaudio. Defaulting to PA_SAMPLE_FLOAT32.\n");
} }
if (ss.rate == 0) { if (ss.rate == 0) {
ss.rate = MA_DEFAULT_SAMPLE_RATE; ss.rate = MA_DEFAULT_SAMPLE_RATE;
streamFlags |= MA_PA_STREAM_FIX_RATE;
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] sample_spec.rate = 0. Defaulting to %d.\n", ss.rate); ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] sample_spec.rate = 0. Defaulting to %d.\n", ss.rate);
} }
if (ss.channels == 0) { if (ss.channels == 0) {
ss.channels = MA_DEFAULT_CHANNELS; ss.channels = MA_DEFAULT_CHANNELS;
streamFlags |= MA_PA_STREAM_FIX_CHANNELS;
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] sample_spec.channels = 0. Defaulting to %d.\n", ss.channels); ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] sample_spec.channels = 0. Defaulting to %d.\n", ss.channels);
} }
...@@ -30347,7 +30351,6 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi ...@@ -30347,7 +30351,6 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi
/* Connect after we've got all of our internal state set up. */ /* Connect after we've got all of our internal state set up. */
streamFlags = MA_PA_STREAM_START_CORKED | MA_PA_STREAM_ADJUST_LATENCY | MA_PA_STREAM_FIX_FORMAT | MA_PA_STREAM_FIX_RATE | MA_PA_STREAM_FIX_CHANNELS;
if (devCapture != NULL) { if (devCapture != NULL) {
streamFlags |= MA_PA_STREAM_DONT_MOVE; streamFlags |= MA_PA_STREAM_DONT_MOVE;
} }
...@@ -30450,20 +30453,24 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi ...@@ -30450,20 +30453,24 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi
ss.rate = pDescriptorPlayback->sampleRate; ss.rate = pDescriptorPlayback->sampleRate;
} }
streamFlags = MA_PA_STREAM_START_CORKED | MA_PA_STREAM_ADJUST_LATENCY;
if (ma_format_from_pulse(ss.format) == ma_format_unknown) { if (ma_format_from_pulse(ss.format) == ma_format_unknown) {
if (ma_is_little_endian()) { if (ma_is_little_endian()) {
ss.format = MA_PA_SAMPLE_FLOAT32LE; ss.format = MA_PA_SAMPLE_FLOAT32LE;
} else { } else {
ss.format = MA_PA_SAMPLE_FLOAT32BE; ss.format = MA_PA_SAMPLE_FLOAT32BE;
} }
streamFlags |= MA_PA_STREAM_FIX_FORMAT;
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] sample_spec.format not supported by miniaudio. Defaulting to PA_SAMPLE_FLOAT32.\n"); ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] sample_spec.format not supported by miniaudio. Defaulting to PA_SAMPLE_FLOAT32.\n");
} }
if (ss.rate == 0) { if (ss.rate == 0) {
ss.rate = MA_DEFAULT_SAMPLE_RATE; ss.rate = MA_DEFAULT_SAMPLE_RATE;
streamFlags |= MA_PA_STREAM_FIX_RATE;
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] sample_spec.rate = 0. Defaulting to %d.\n", ss.rate); ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] sample_spec.rate = 0. Defaulting to %d.\n", ss.rate);
} }
if (ss.channels == 0) { if (ss.channels == 0) {
ss.channels = MA_DEFAULT_CHANNELS; ss.channels = MA_DEFAULT_CHANNELS;
streamFlags |= MA_PA_STREAM_FIX_CHANNELS;
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] sample_spec.channels = 0. Defaulting to %d.\n", ss.channels); ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] sample_spec.channels = 0. Defaulting to %d.\n", ss.channels);
} }
...@@ -30496,7 +30503,6 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi ...@@ -30496,7 +30503,6 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi
/* Connect after we've got all of our internal state set up. */ /* Connect after we've got all of our internal state set up. */
streamFlags = MA_PA_STREAM_START_CORKED | MA_PA_STREAM_ADJUST_LATENCY | MA_PA_STREAM_FIX_FORMAT | MA_PA_STREAM_FIX_RATE | MA_PA_STREAM_FIX_CHANNELS;
if (devPlayback != NULL) { if (devPlayback != NULL) {
streamFlags |= MA_PA_STREAM_DONT_MOVE; streamFlags |= MA_PA_STREAM_DONT_MOVE;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment