1 /*
2  *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_MAIN_SOURCE_ECHO_CONTROL_MOBILE_IMPL_H_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_MAIN_SOURCE_ECHO_CONTROL_MOBILE_IMPL_H_
13 
14 #include "audio_processing.h"
15 #include "processing_component.h"
16 
17 namespace webrtc {
18 class AudioProcessingImpl;
19 class AudioBuffer;
20 
21 class EchoControlMobileImpl : public EchoControlMobile,
22                               public ProcessingComponent {
23  public:
24   explicit EchoControlMobileImpl(const AudioProcessingImpl* apm);
25   virtual ~EchoControlMobileImpl();
26 
27   int ProcessRenderAudio(const AudioBuffer* audio);
28   int ProcessCaptureAudio(AudioBuffer* audio);
29 
30   // EchoControlMobile implementation.
31   virtual bool is_enabled() const;
32 
33   // ProcessingComponent implementation.
34   virtual int Initialize();
35   virtual int get_version(char* version, int version_len_bytes) const;
36 
37  private:
38   // EchoControlMobile implementation.
39   virtual int Enable(bool enable);
40   virtual int set_routing_mode(RoutingMode mode);
41   virtual RoutingMode routing_mode() const;
42   virtual int enable_comfort_noise(bool enable);
43   virtual bool is_comfort_noise_enabled() const;
44   virtual int SetEchoPath(const void* echo_path, size_t size_bytes);
45   virtual int GetEchoPath(void* echo_path, size_t size_bytes) const;
46 
47   // ProcessingComponent implementation.
48   virtual void* CreateHandle() const;
49   virtual int InitializeHandle(void* handle) const;
50   virtual int ConfigureHandle(void* handle) const;
51   virtual int DestroyHandle(void* handle) const;
52   virtual int num_handles_required() const;
53   virtual int GetHandleError(void* handle) const;
54 
55   const AudioProcessingImpl* apm_;
56   RoutingMode routing_mode_;
57   bool comfort_noise_enabled_;
58   unsigned char* external_echo_path_;
59 };
60 }  // namespace webrtc
61 
62 #endif  // WEBRTC_MODULES_AUDIO_PROCESSING_MAIN_SOURCE_ECHO_CONTROL_MOBILE_IMPL_H_
63