mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-17 22:23:31 +00:00
Performance tweaks to PortAudio renderer
This commit is contained in:
@@ -70,14 +70,6 @@ bool PortAudioRenderer::prepareForPlayback(const OPUS_MULTISTREAM_CONFIGURATION*
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = Pa_StartStream(m_Stream);
|
|
||||||
if (error != paNoError) {
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"Pa_StartStream() failed: %s",
|
|
||||||
Pa_GetErrorText(error));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,6 +93,17 @@ void PortAudioRenderer::submitAudio(short* audioBuffer, int audioSize)
|
|||||||
// race since we'll either read the original value of m_WriteIndex (which is safe,
|
// race since we'll either read the original value of m_WriteIndex (which is safe,
|
||||||
// we just won't consider this sample) or the new value of m_WriteIndex
|
// we just won't consider this sample) or the new value of m_WriteIndex
|
||||||
m_WriteIndex = (m_WriteIndex + 1) % CIRCULAR_BUFFER_SIZE;
|
m_WriteIndex = (m_WriteIndex + 1) % CIRCULAR_BUFFER_SIZE;
|
||||||
|
|
||||||
|
// Start the stream after we've written the first sample to it
|
||||||
|
if (Pa_IsStreamStopped(m_Stream) == 1) {
|
||||||
|
PaError error = Pa_StartStream(m_Stream);
|
||||||
|
if (error != paNoError) {
|
||||||
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Pa_StartStream() failed: %s",
|
||||||
|
Pa_GetErrorText(error));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PortAudioRenderer::testAudio(int audioConfiguration)
|
bool PortAudioRenderer::testAudio(int audioConfiguration)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "renderer.h"
|
#include "renderer.h"
|
||||||
|
|
||||||
#define CIRCULAR_BUFFER_SIZE 32
|
#define CIRCULAR_BUFFER_SIZE 16
|
||||||
#define MAX_CHANNEL_COUNT 6
|
#define MAX_CHANNEL_COUNT 6
|
||||||
|
|
||||||
#define CIRCULAR_BUFFER_STRIDE (MAX_CHANNEL_COUNT * SAMPLES_PER_FRAME)
|
#define CIRCULAR_BUFFER_STRIDE (MAX_CHANNEL_COUNT * SAMPLES_PER_FRAME)
|
||||||
|
|||||||
Reference in New Issue
Block a user