Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/extern
diff options
context:
space:
mode:
authorJörg Müller <nexyon@gmail.com>2021-08-18 23:22:21 +0300
committerJörg Müller <nexyon@gmail.com>2021-08-18 23:22:21 +0300
commita217e043be2d06320800621043d49d002f9081db (patch)
tree6ad1e3c511605661da84b69fbb0e1d6863ea8bad /extern
parent55f9014616c9a45cb17eab325617e4912d58c10f (diff)
Audaspace: porting PulseAudio fixes from upstream.
Diffstat (limited to 'extern')
-rw-r--r--extern/audaspace/plugins/pulseaudio/PulseAudioDevice.cpp19
-rw-r--r--extern/audaspace/plugins/pulseaudio/PulseAudioDevice.h2
2 files changed, 15 insertions, 6 deletions
diff --git a/extern/audaspace/plugins/pulseaudio/PulseAudioDevice.cpp b/extern/audaspace/plugins/pulseaudio/PulseAudioDevice.cpp
index cbfb5e96e6c..bf3fad82620 100644
--- a/extern/audaspace/plugins/pulseaudio/PulseAudioDevice.cpp
+++ b/extern/audaspace/plugins/pulseaudio/PulseAudioDevice.cpp
@@ -32,17 +32,24 @@ void PulseAudioDevice::PulseAudio_state_callback(pa_context *context, void *data
device->m_state = AUD_pa_context_get_state(context);
}
-void PulseAudioDevice::PulseAudio_request(pa_stream *stream, size_t num_bytes, void *data)
+void PulseAudioDevice::PulseAudio_request(pa_stream *stream, size_t total_bytes, void *data)
{
PulseAudioDevice* device = (PulseAudioDevice*)data;
void* buffer;
- AUD_pa_stream_begin_write(stream, &buffer, &num_bytes);
+ while(total_bytes > 0)
+ {
+ size_t num_bytes = total_bytes;
+
+ AUD_pa_stream_begin_write(stream, &buffer, &num_bytes);
+
+ device->mix((data_t*)buffer, num_bytes / AUD_DEVICE_SAMPLE_SIZE(device->m_specs));
- device->mix((data_t*)buffer, num_bytes / AUD_DEVICE_SAMPLE_SIZE(device->m_specs));
+ AUD_pa_stream_write(stream, buffer, num_bytes, nullptr, 0, PA_SEEK_RELATIVE);
- AUD_pa_stream_write(stream, buffer, num_bytes, nullptr, 0, PA_SEEK_RELATIVE);
+ total_bytes -= num_bytes;
+ }
}
void PulseAudioDevice::PulseAudio_underflow(pa_stream *stream, void *data)
@@ -96,7 +103,6 @@ void PulseAudioDevice::runMixingThread()
PulseAudioDevice::PulseAudioDevice(std::string name, DeviceSpecs specs, int buffersize) :
m_state(PA_CONTEXT_UNCONNECTED),
- m_buffersize(buffersize),
m_underflows(0)
{
m_mainloop = AUD_pa_mainloop_new();
@@ -187,6 +193,9 @@ PulseAudioDevice::PulseAudioDevice(std::string name, DeviceSpecs specs, int buff
AUD_pa_stream_set_write_callback(m_stream, PulseAudio_request, this);
AUD_pa_stream_set_underflow_callback(m_stream, PulseAudio_underflow, this);
+ buffersize *= AUD_DEVICE_SAMPLE_SIZE(m_specs);
+ m_buffersize = buffersize;
+
pa_buffer_attr buffer_attr;
buffer_attr.fragsize = -1U;
diff --git a/extern/audaspace/plugins/pulseaudio/PulseAudioDevice.h b/extern/audaspace/plugins/pulseaudio/PulseAudioDevice.h
index be34cc9032b..45b813a5755 100644
--- a/extern/audaspace/plugins/pulseaudio/PulseAudioDevice.h
+++ b/extern/audaspace/plugins/pulseaudio/PulseAudioDevice.h
@@ -59,7 +59,7 @@ private:
* \param num_bytes The length in bytes to be supplied.
* \param data The PulseAudio device.
*/
- AUD_LOCAL static void PulseAudio_request(pa_stream* stream, size_t num_bytes, void* data);
+ AUD_LOCAL static void PulseAudio_request(pa_stream* stream, size_t total_bytes, void* data);
/**
* Reports an underflow from the PulseAudio server.