1 /*
2  *  Copyright (c) 2012 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_VOICE_ENGINE_VOE_EXTERNAL_MEDIA_IMPL_H
12 #define WEBRTC_VOICE_ENGINE_VOE_EXTERNAL_MEDIA_IMPL_H
13 
14 #include "webrtc/voice_engine/include/voe_external_media.h"
15 
16 #include "webrtc/voice_engine/shared_data.h"
17 
18 namespace webrtc {
19 
20 class VoEExternalMediaImpl : public VoEExternalMedia
21 {
22 public:
23     virtual int RegisterExternalMediaProcessing(
24         int channel,
25         ProcessingTypes type,
26         VoEMediaProcess& processObject);
27 
28     virtual int DeRegisterExternalMediaProcessing(
29         int channel,
30         ProcessingTypes type);
31 
32     virtual int SetExternalRecordingStatus(bool enable);
33 
34     virtual int SetExternalPlayoutStatus(bool enable);
35 
36     virtual int ExternalRecordingInsertData(
37         const int16_t speechData10ms[],
38         int lengthSamples,
39         int samplingFreqHz,
40         int current_delay_ms);
41 
42     // Insertion of far-end data as actually played out to the OS audio driver
43     virtual int ExternalPlayoutData(
44         int16_t speechData10ms[],
45         int samplingFreqHz,
46         int num_channels,
47         int current_delay_ms,
48         int& lengthSamples);
49 
50     virtual int ExternalPlayoutGetData(int16_t speechData10ms[],
51                                        int samplingFreqHz,
52                                        int current_delay_ms,
53                                        int& lengthSamples);
54 
55     virtual int GetAudioFrame(int channel, int desired_sample_rate_hz,
56                               AudioFrame* frame);
57 
58     virtual int SetExternalMixing(int channel, bool enable);
59 
60 protected:
61     VoEExternalMediaImpl(voe::SharedData* shared);
62     virtual ~VoEExternalMediaImpl();
63 
64 private:
65 #ifdef WEBRTC_VOE_EXTERNAL_REC_AND_PLAYOUT
66     int playout_delay_ms_;
67 #endif
68     voe::SharedData* shared_;
69 };
70 
71 }  // namespace webrtc
72 
73 #endif  // WEBRTC_VOICE_ENGINE_VOE_EXTERNAL_MEDIA_IMPL_H
74