[microphone] Bugfix: protect against starting mic if already started (#8656)

This commit is contained in:
Kevin Ahrendt 2025-04-30 19:45:33 -05:00 committed by GitHub
parent cdc77506de
commit bf527b0331
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,13 +14,17 @@ void MicrophoneSource::add_data_callback(std::function<void(const std::vector<ui
}
void MicrophoneSource::start() {
if (!this->enabled_) {
this->enabled_ = true;
this->mic_->start();
}
}
void MicrophoneSource::stop() {
if (this->enabled_) {
this->enabled_ = false;
this->mic_->stop();
}
}
std::vector<uint8_t> MicrophoneSource::process_audio_(const std::vector<uint8_t> &data) {
// Bit depth conversions are obtained by truncating bits or padding with zeros - no dithering is applied.