webrtc/call/payload_type.h
Harald Alvestrand c17ca01f54 Move the payload type picker to call/
Since media/ and pc/ both have to use this, and both
depend on call/, this seems to be the right place to put it.

Also factor out the interface that media will use in a separate
interface class.

Bug: webrtc:360058654
Change-Id: I34acbecc618f23e19542ce4b0110d0e8ed9e55ee
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361281
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Auto-Submit: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42933}
2024-09-03 12:36:50 +00:00

44 lines
1.5 KiB
C++

/*
* Copyright 2024 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 CALL_PAYLOAD_TYPE_H_
#define CALL_PAYLOAD_TYPE_H_
#include <cstdint>
#include <string>
#include "api/rtc_error.h"
#include "media/base/codec.h"
#include "rtc_base/strong_alias.h"
namespace webrtc {
class PayloadType : public StrongAlias<class PayloadTypeTag, uint8_t> {
public:
// Non-explicit conversions from and to ints are to be deprecated and
// removed once calling code is upgraded.
PayloadType(uint8_t pt) { value_ = pt; } // NOLINT: explicit
constexpr operator uint8_t() const& { return value_; } // NOLINT: Explicit
};
class PayloadTypeSuggester {
public:
virtual ~PayloadTypeSuggester() = default;
// Suggest a payload type for a given codec on a given media section.
// Media section is indicated by MID.
// The function will either return a PT already in use on the connection
// or a newly suggested one.
virtual RTCErrorOr<PayloadType> SuggestPayloadType(const std::string& mid,
cricket::Codec codec) = 0;
};
} // namespace webrtc
#endif // CALL_PAYLOAD_TYPE_H_