voip_codec.h 1.8 KB

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