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-05-10 07:56:25 Functions: 0 2 0.0 %

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

Generated by: LCOV version 1.14