LCOV - code coverage report
Current view: top level - src/media/audio/audio-processing - speex.h (source / functions) Hit Total Coverage
Test: jami-coverage-filtered.info Lines: 0 1 0.0 %
Date: 2024-11-15 09:04:49 Functions: 0 2 0.0 %

          Line data    Source code
       1             : /*
       2             :  *  Copyright (C) 2004-2024 Savoir-faire Linux Inc.
       3             :  *
       4             :  *  This program is free software: you can redistribute it and/or modify
       5             :  *  it under the terms of the GNU General Public License as published by
       6             :  *  the Free Software Foundation, either version 3 of the License, or
       7             :  *  (at your option) any later version.
       8             :  *
       9             :  *  This program is distributed in the hope that it will be useful,
      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      12             :  *  GNU General Public License for more details.
      13             :  *
      14             :  *  You should have received a copy of the GNU General Public License
      15             :  *  along with this program. If not, see <https://www.gnu.org/licenses/>.
      16             :  */
      17             : #pragma once
      18             : 
      19             : #include "audio_processor.h"
      20             : 
      21             : // typedef speex C structs
      22             : extern "C" {
      23             : struct SpeexEchoState_;
      24             : typedef struct SpeexEchoState_ SpeexEchoState;
      25             : struct SpeexPreprocessState_;
      26             : typedef struct SpeexPreprocessState_ SpeexPreprocessState;
      27             : }
      28             : 
      29             : namespace jami {
      30             : 
      31             : class SpeexAudioProcessor final : public AudioProcessor
      32             : {
      33             : public:
      34             :     SpeexAudioProcessor(AudioFormat format, unsigned frameSize);
      35           0 :     ~SpeexAudioProcessor() = default;
      36             : 
      37             :     std::shared_ptr<AudioFrame> getProcessed() override;
      38             : 
      39             :     void enableEchoCancel(bool enabled) override;
      40             :     void enableNoiseSuppression(bool enabled) override;
      41             :     void enableAutomaticGainControl(bool enabled) override;
      42             :     void enableVoiceActivityDetection(bool enabled) override;
      43             : 
      44             : private:
      45             :     using SpeexEchoStatePtr = std::unique_ptr<SpeexEchoState, void (*)(SpeexEchoState*)>;
      46             :     using SpeexPreprocessStatePtr
      47             :         = std::unique_ptr<SpeexPreprocessState, void (*)(SpeexPreprocessState*)>;
      48             : 
      49             :     // multichannel, one for the entire audio processor
      50             :     SpeexEchoStatePtr echoState;
      51             : 
      52             :     // one for each channel
      53             :     std::vector<SpeexPreprocessStatePtr> preprocessorStates;
      54             : 
      55             :     std::unique_ptr<AudioFrame> procBuffer {};
      56             :     Resampler deinterleaveResampler;
      57             :     Resampler interleaveResampler;
      58             : 
      59             :     // if we should do echo cancellation
      60             :     bool shouldAEC {false};
      61             : 
      62             :     // if we should do voice activity detection
      63             :     // preprocess_run returns 1 if vad is disabled, so we have to know whether or not to ignore it
      64             :     bool shouldDetectVoice {false};
      65             : };
      66             : } // namespace jami

Generated by: LCOV version 1.14