summaryrefslogtreecommitdiff
path: root/voice_engine/voe_codec_impl.h
blob: 8c0c9a8913da5d31a2216eb5f934e85e45a55658 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
 *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#ifndef WEBRTC_VOICE_ENGINE_VOE_CODEC_IMPL_H
#define WEBRTC_VOICE_ENGINE_VOE_CODEC_IMPL_H

#include "voe_codec.h"

#include "shared_data.h"

namespace webrtc
{

class VoECodecImpl: public VoECodec
{
public:
    virtual int NumOfCodecs();

    virtual int GetCodec(int index, CodecInst& codec);

    virtual int SetSendCodec(int channel, const CodecInst& codec);

    virtual int GetSendCodec(int channel, CodecInst& codec);

    virtual int GetRecCodec(int channel, CodecInst& codec);

    virtual int SetAMREncFormat(int channel,
                                AmrMode mode = kRfc3267BwEfficient);

    virtual int SetAMRDecFormat(int channel,
                                AmrMode mode = kRfc3267BwEfficient);

    virtual int SetAMRWbEncFormat(int channel,
                                  AmrMode mode = kRfc3267BwEfficient);

    virtual int SetAMRWbDecFormat(int channel,
                                  AmrMode mode = kRfc3267BwEfficient);

    virtual int SetSendCNPayloadType(
        int channel, int type,
        PayloadFrequencies frequency = kFreq16000Hz);

    virtual int SetRecPayloadType(int channel,
                                  const CodecInst& codec);

    virtual int GetRecPayloadType(int channel, CodecInst& codec);

    virtual int SetISACInitTargetRate(int channel,
                                      int rateBps,
                                      bool useFixedFrameSize = false);

    virtual int SetISACMaxRate(int channel, int rateBps);

    virtual int SetISACMaxPayloadSize(int channel, int sizeBytes);

    virtual int SetVADStatus(int channel,
                             bool enable,
                             VadModes mode = kVadConventional,
                             bool disableDTX = false);

    virtual int GetVADStatus(int channel,
                             bool& enabled,
                             VadModes& mode,
                             bool& disabledDTX);

    // Dual-streaming
    virtual int SetSecondarySendCodec(int channel, const CodecInst& codec,
                                      int red_payload_type);

    virtual int RemoveSecondarySendCodec(int channel);

    virtual int GetSecondarySendCodec(int channel, CodecInst& codec);

protected:
    VoECodecImpl(voe::SharedData* shared);
    virtual ~VoECodecImpl();

private:
    void ACMToExternalCodecRepresentation(CodecInst& toInst,
                                          const CodecInst& fromInst);

    void ExternalToACMCodecRepresentation(CodecInst& toInst,
                                          const CodecInst& fromInst);

    voe::SharedData* _shared;
};

} // namespace webrtc

#endif  // WEBRTC_VOICE_ENGINE_VOE_CODEC_IMPL_H