LCOV - code coverage report
Current view: top level - src/media/audio/audio-processing - speex.h (source / functions) Coverage Total Hit
Test: jami-coverage-filtered.info Lines: 0.0 % 1 0
Test Date: 2026-06-13 09:18:46 Functions: 0.0 % 2 0

            Line data    Source code
       1              : /*
       2              :  *  Copyright (C) 2004-2026 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 = std::unique_ptr<SpeexPreprocessState, void (*)(SpeexPreprocessState*)>;
      47              : 
      48              :     // multichannel, one for the entire audio processor
      49              :     SpeexEchoStatePtr echoState;
      50              : 
      51              :     // one for each channel
      52              :     std::vector<SpeexPreprocessStatePtr> preprocessorStates;
      53              : 
      54              :     std::unique_ptr<AudioFrame> procBuffer {};
      55              :     Resampler deinterleaveResampler;
      56              :     Resampler interleaveResampler;
      57              : 
      58              :     // if we should do echo cancellation
      59              :     bool shouldAEC {false};
      60              : 
      61              :     // if we should do voice activity detection
      62              :     // preprocess_run returns 1 if vad is disabled, so we have to know whether or not to ignore it
      63              :     bool shouldDetectVoice {false};
      64              : };
      65              : } // namespace jami
        

Generated by: LCOV version 2.0-1