diff --git a/sunshine/platform/linux/audio.cpp b/sunshine/platform/linux/audio.cpp index 99fc02a8..facb5f3b 100644 --- a/sunshine/platform/linux/audio.cpp +++ b/sunshine/platform/linux/audio.cpp @@ -65,7 +65,7 @@ struct mic_attr_t : public mic_t { } }; -std::unique_ptr microphone(const std::uint8_t *mapping, int channels, std::uint32_t sample_rate) { +std::unique_ptr microphone(const std::uint8_t *mapping, int channels, std::uint32_t sample_rate, std::uint32_t frame_size) { auto mic = std::make_unique(); pa_sample_spec ss { PA_SAMPLE_S16LE, sample_rate, (std::uint8_t)channels }; @@ -76,6 +76,9 @@ std::unique_ptr microphone(const std::uint8_t *mapping, int channels, std channel = position_mapping[*mapping++]; }); + pa_buffer_attr pa_attr = {}; + pa_attr.maxlength = frame_size * 8; + int status; const char *audio_sink = "@DEFAULT_MONITOR@"; @@ -86,7 +89,7 @@ std::unique_ptr microphone(const std::uint8_t *mapping, int channels, std mic->mic.reset( pa_simple_new(nullptr, "sunshine", pa_stream_direction_t::PA_STREAM_RECORD, audio_sink, - "sunshine-record", &ss, &pa_map, nullptr, &status)); + "sunshine-record", &ss, &pa_map, &pa_attr, &status)); if(!mic->mic) { auto err_str = pa_strerror(status); @@ -380,7 +383,7 @@ public: } std::unique_ptr microphone(const std::uint8_t *mapping, int channels, std::uint32_t sample_rate, std::uint32_t frame_size) override { - return ::platf::microphone(mapping, channels, sample_rate); + return ::platf::microphone(mapping, channels, sample_rate, frame_size); } int set_sink(const std::string &sink) override {