Extract common codec fields into RtpCodec
This creates the RtpCodec structure for the common fields used in RtpCodecParameters and RtpCodecCapability. Remove the unused fields from both that were defined from ORTC and never implemented as well. Bug: webrtc:15064 Change-Id: I37b4c83e2051a888fc99cc0d9f7aeb8d74f0421d Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/301182 Commit-Queue: Florent Castelli <orphis@webrtc.org> Reviewed-by: Per Kjellander <perkj@webrtc.org> Cr-Commit-Position: refs/heads/main@{#39862}
This commit is contained in:
parent
58e8cb0553
commit
0a4a9846fc
@ -44,6 +44,9 @@ RtcpFeedback::RtcpFeedback(RtcpFeedbackType type,
|
||||
RtcpFeedback::RtcpFeedback(const RtcpFeedback& rhs) = default;
|
||||
RtcpFeedback::~RtcpFeedback() = default;
|
||||
|
||||
RtpCodec::RtpCodec() = default;
|
||||
RtpCodec::RtpCodec(const RtpCodec&) = default;
|
||||
RtpCodec::~RtpCodec() = default;
|
||||
RtpCodecCapability::RtpCodecCapability() = default;
|
||||
RtpCodecCapability::~RtpCodecCapability() = default;
|
||||
|
||||
|
||||
@ -122,12 +122,10 @@ struct RTC_EXPORT RtcpFeedback {
|
||||
bool operator!=(const RtcpFeedback& o) const { return !(*this == o); }
|
||||
};
|
||||
|
||||
// RtpCodecCapability is to RtpCodecParameters as RtpCapabilities is to
|
||||
// RtpParameters. This represents the static capabilities of an endpoint's
|
||||
// implementation of a codec.
|
||||
struct RTC_EXPORT RtpCodecCapability {
|
||||
RtpCodecCapability();
|
||||
~RtpCodecCapability();
|
||||
struct RTC_EXPORT RtpCodec {
|
||||
RtpCodec();
|
||||
RtpCodec(const RtpCodec&);
|
||||
virtual ~RtpCodec();
|
||||
|
||||
// Build MIME "type/subtype" string from `name` and `kind`.
|
||||
std::string mime_type() const { return MediaTypeToString(kind) + "/" + name; }
|
||||
@ -138,25 +136,18 @@ struct RTC_EXPORT RtpCodecCapability {
|
||||
// The media type of this codec. Equivalent to MIME top-level type.
|
||||
cricket::MediaType kind = cricket::MEDIA_TYPE_AUDIO;
|
||||
|
||||
// Clock rate in Hertz. If unset, the codec is applicable to any clock rate.
|
||||
// If unset, the implementation default is used.
|
||||
absl::optional<int> clock_rate;
|
||||
|
||||
// Default payload type for this codec. Mainly needed for codecs that use
|
||||
// that have statically assigned payload types.
|
||||
absl::optional<int> preferred_payload_type;
|
||||
|
||||
// Maximum packetization time supported by an RtpReceiver for this codec.
|
||||
// TODO(deadbeef): Not implemented.
|
||||
absl::optional<int> max_ptime;
|
||||
|
||||
// Preferred packetization time for an RtpReceiver or RtpSender of this codec.
|
||||
// TODO(deadbeef): Not implemented.
|
||||
absl::optional<int> ptime;
|
||||
|
||||
// The number of audio channels supported. Unused for video codecs.
|
||||
// The number of audio channels used. Unset for video codecs. If unset for
|
||||
// audio, the implementation default is used.
|
||||
// TODO(deadbeef): The "implementation default" part isn't fully implemented.
|
||||
// Only defaults to 1, even though some codecs (such as opus) should really
|
||||
// default to 2.
|
||||
absl::optional<int> num_channels;
|
||||
|
||||
// Feedback mechanisms supported for this codec.
|
||||
// Feedback mechanisms to be used for this codec.
|
||||
// TODO(deadbeef): Not implemented with PeerConnection senders/receivers.
|
||||
std::vector<RtcpFeedback> rtcp_feedback;
|
||||
|
||||
// Codec-specific parameters that must be signaled to the remote party.
|
||||
@ -168,39 +159,31 @@ struct RTC_EXPORT RtpCodecCapability {
|
||||
// Boolean values are represented by the string "1".
|
||||
std::map<std::string, std::string> parameters;
|
||||
|
||||
// Codec-specific parameters that may optionally be signaled to the remote
|
||||
// party.
|
||||
// TODO(deadbeef): Not implemented.
|
||||
std::map<std::string, std::string> options;
|
||||
bool operator==(const RtpCodec& o) const {
|
||||
return name == o.name && kind == o.kind && clock_rate == o.clock_rate &&
|
||||
num_channels == o.num_channels && rtcp_feedback == o.rtcp_feedback &&
|
||||
parameters == o.parameters;
|
||||
}
|
||||
bool operator!=(const RtpCodec& o) const { return !(*this == o); }
|
||||
};
|
||||
|
||||
// Maximum number of temporal layer extensions supported by this codec.
|
||||
// For example, a value of 1 indicates that 2 total layers are supported.
|
||||
// TODO(deadbeef): Not implemented.
|
||||
int max_temporal_layer_extensions = 0;
|
||||
// RtpCodecCapability is to RtpCodecParameters as RtpCapabilities is to
|
||||
// RtpParameters. This represents the static capabilities of an endpoint's
|
||||
// implementation of a codec.
|
||||
struct RTC_EXPORT RtpCodecCapability : public RtpCodec {
|
||||
RtpCodecCapability();
|
||||
virtual ~RtpCodecCapability();
|
||||
|
||||
// Maximum number of spatial layer extensions supported by this codec.
|
||||
// For example, a value of 1 indicates that 2 total layers are supported.
|
||||
// TODO(deadbeef): Not implemented.
|
||||
int max_spatial_layer_extensions = 0;
|
||||
// Default payload type for this codec. Mainly needed for codecs that have
|
||||
// statically assigned payload types.
|
||||
absl::optional<int> preferred_payload_type;
|
||||
|
||||
// Whether the implementation can send/receive SVC layers with distinct SSRCs.
|
||||
// Always false for audio codecs. True for video codecs that support scalable
|
||||
// video coding with MRST.
|
||||
// TODO(deadbeef): Not implemented.
|
||||
bool svc_multi_stream_support = false;
|
||||
|
||||
// https://w3c.github.io/webrtc-svc/#dom-rtcrtpcodeccapability-scalabilitymodes
|
||||
// List of scalability modes supported by the video codec.
|
||||
absl::InlinedVector<ScalabilityMode, kScalabilityModeCount> scalability_modes;
|
||||
|
||||
bool operator==(const RtpCodecCapability& o) const {
|
||||
return name == o.name && kind == o.kind && clock_rate == o.clock_rate &&
|
||||
return RtpCodec::operator==(o) &&
|
||||
preferred_payload_type == o.preferred_payload_type &&
|
||||
max_ptime == o.max_ptime && ptime == o.ptime &&
|
||||
num_channels == o.num_channels && rtcp_feedback == o.rtcp_feedback &&
|
||||
parameters == o.parameters && options == o.options &&
|
||||
max_temporal_layer_extensions == o.max_temporal_layer_extensions &&
|
||||
max_spatial_layer_extensions == o.max_spatial_layer_extensions &&
|
||||
svc_multi_stream_support == o.svc_multi_stream_support &&
|
||||
scalability_modes == o.scalability_modes;
|
||||
}
|
||||
bool operator!=(const RtpCodecCapability& o) const { return !(*this == o); }
|
||||
@ -554,63 +537,18 @@ struct RTC_EXPORT RtpEncodingParameters {
|
||||
}
|
||||
};
|
||||
|
||||
struct RTC_EXPORT RtpCodecParameters {
|
||||
struct RTC_EXPORT RtpCodecParameters : public RtpCodec {
|
||||
RtpCodecParameters();
|
||||
RtpCodecParameters(const RtpCodecParameters&);
|
||||
~RtpCodecParameters();
|
||||
|
||||
// Build MIME "type/subtype" string from `name` and `kind`.
|
||||
std::string mime_type() const { return MediaTypeToString(kind) + "/" + name; }
|
||||
|
||||
// Used to identify the codec. Equivalent to MIME subtype.
|
||||
std::string name;
|
||||
|
||||
// The media type of this codec. Equivalent to MIME top-level type.
|
||||
cricket::MediaType kind = cricket::MEDIA_TYPE_AUDIO;
|
||||
virtual ~RtpCodecParameters();
|
||||
|
||||
// Payload type used to identify this codec in RTP packets.
|
||||
// This must always be present, and must be unique across all codecs using
|
||||
// the same transport.
|
||||
int payload_type = 0;
|
||||
|
||||
// If unset, the implementation default is used.
|
||||
absl::optional<int> clock_rate;
|
||||
|
||||
// The number of audio channels used. Unset for video codecs. If unset for
|
||||
// audio, the implementation default is used.
|
||||
// TODO(deadbeef): The "implementation default" part isn't fully implemented.
|
||||
// Only defaults to 1, even though some codecs (such as opus) should really
|
||||
// default to 2.
|
||||
absl::optional<int> num_channels;
|
||||
|
||||
// The maximum packetization time to be used by an RtpSender.
|
||||
// If `ptime` is also set, this will be ignored.
|
||||
// TODO(deadbeef): Not implemented.
|
||||
absl::optional<int> max_ptime;
|
||||
|
||||
// The packetization time to be used by an RtpSender.
|
||||
// If unset, will use any time up to max_ptime.
|
||||
// TODO(deadbeef): Not implemented.
|
||||
absl::optional<int> ptime;
|
||||
|
||||
// Feedback mechanisms to be used for this codec.
|
||||
// TODO(deadbeef): Not implemented with PeerConnection senders/receivers.
|
||||
std::vector<RtcpFeedback> rtcp_feedback;
|
||||
|
||||
// Codec-specific parameters that must be signaled to the remote party.
|
||||
//
|
||||
// Corresponds to "a=fmtp" parameters in SDP.
|
||||
//
|
||||
// Contrary to ORTC, these parameters are named using all lowercase strings.
|
||||
// This helps make the mapping to SDP simpler, if an application is using SDP.
|
||||
// Boolean values are represented by the string "1".
|
||||
std::map<std::string, std::string> parameters;
|
||||
|
||||
bool operator==(const RtpCodecParameters& o) const {
|
||||
return name == o.name && kind == o.kind && payload_type == o.payload_type &&
|
||||
clock_rate == o.clock_rate && num_channels == o.num_channels &&
|
||||
max_ptime == o.max_ptime && ptime == o.ptime &&
|
||||
rtcp_feedback == o.rtcp_feedback && parameters == o.parameters;
|
||||
return RtpCodec::operator==(o) && payload_type == o.payload_type;
|
||||
}
|
||||
bool operator!=(const RtpCodecParameters& o) const { return !(*this == o); }
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user