Merge generic part of Android microphone changes (#5624)

This commit is contained in:
xperia64 2020-12-31 00:21:03 +00:00 committed by GitHub
parent e6ef00b41d
commit 5f1eb7146d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 9 deletions

View file

@ -86,7 +86,7 @@ void CubebInput::StartSampling(const Frontend::Mic::Parameters& params) {
input_params.format = CUBEB_SAMPLE_S16LE;
input_params.rate = params.sample_rate;
u32 latency_frames;
u32 latency_frames = 512; // Firefox default
if (cubeb_get_min_latency(impl->ctx, &input_params, &latency_frames) != CUBEB_OK) {
LOG_ERROR(Audio, "Could not get minimum latency");
}
@ -189,4 +189,11 @@ std::vector<std::string> ListCubebInputDevices() {
cubeb_destroy(ctx);
return device_list;
}
CubebFactory::~CubebFactory() = default;
std::unique_ptr<Frontend::Mic::Interface> CubebFactory::Create(std::string mic_device_name) {
return std::make_unique<CubebInput>(std::move(mic_device_name));
}
} // namespace AudioCore

View file

@ -31,4 +31,11 @@ private:
std::vector<std::string> ListCubebInputDevices();
class CubebFactory final : public Frontend::Mic::RealMicFactory {
public:
~CubebFactory() override;
std::unique_ptr<Frontend::Mic::Interface> Create(std::string mic_device_name) override;
};
} // namespace AudioCore