webrtc_m130/media/base/codec_comparators.h
Harald Alvestrand 19bbd6f02f Move some codec-comparing functions to a single file.
This CL is a pure move; later CLs will try to increase consistency
between the functions.

Bug: webrtc:360058654
Change-Id: I6662b3d35f8e2dab60c2778a4755454fe3029fe2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/365100
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43210}
2024-10-09 22:10:36 +00:00

40 lines
1.3 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 MEDIA_BASE_CODEC_COMPARATORS_H_
#define MEDIA_BASE_CODEC_COMPARATORS_H_
#include <optional>
#include <vector>
#include "media/base/codec.h"
namespace webrtc {
// Comparison used in the PayloadTypePicker
bool MatchesForSdp(const cricket::Codec& codec_1,
const cricket::Codec& codec_2);
// Comparison used for the Codec::Matches function
bool MatchesWithCodecRules(const cricket::Codec& left_codec,
const cricket::Codec& codec);
// Finds a codec in `codecs2` that matches `codec_to_match`, which is
// a member of `codecs1`. If `codec_to_match` is an RED or RTX codec, both
// the codecs themselves and their associated codecs must match.
std::optional<cricket::Codec> FindMatchingCodec(
const std::vector<cricket::Codec>& codecs1,
const std::vector<cricket::Codec>& codecs2,
const cricket::Codec& codec_to_match);
} // namespace webrtc
#endif // MEDIA_BASE_CODEC_COMPARATORS_H_