• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2020 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 API_VOIP_VOIP_CODEC_H_
12 #define API_VOIP_VOIP_CODEC_H_
13 
14 #include <map>
15 
16 #include "api/audio_codecs/audio_format.h"
17 #include "api/voip/voip_base.h"
18 
19 namespace webrtc {
20 
21 // VoipCodec interface currently provides any codec related interface
22 // such as setting encoder and decoder types that are negotiated with
23 // remote endpoint.  Typically after SDP offer and answer exchange,
24 // the local endpoint understands what are the codec payload types that
25 // are used with negotiated codecs.  This interface is subject to expand
26 // as needed in future.
27 //
28 // This interface requires a channel id created via VoipBase interface.
29 class VoipCodec {
30  public:
31   // Set encoder type here along with its payload type to use.
32   virtual void SetSendCodec(ChannelId channel_id,
33                             int payload_type,
34                             const SdpAudioFormat& encoder_spec) = 0;
35 
36   // Set decoder payload type here. In typical offer and answer model,
37   // this should be called after payload type has been agreed in media
38   // session.  Note that payload type can differ with same codec in each
39   // direction.
40   virtual void SetReceiveCodecs(
41       ChannelId channel_id,
42       const std::map<int, SdpAudioFormat>& decoder_specs) = 0;
43 
44  protected:
45   virtual ~VoipCodec() = default;
46 };
47 
48 }  // namespace webrtc
49 
50 #endif  // API_VOIP_VOIP_CODEC_H_
51