VideoEncoderFactoryTemplate cleanup.
Bug: webrtc:13573 Change-Id: Id70e64adba6c5d76132dc0edb0c93937e3e894f8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/268542 Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> Commit-Queue: Philip Eliasson <philipel@webrtc.org> Cr-Commit-Position: refs/heads/main@{#37524}
This commit is contained in:
parent
f0232f31fb
commit
98c78cdd20
@ -46,9 +46,7 @@ template <typename... Ts>
|
||||
class VideoEncoderFactoryTemplate : public VideoEncoderFactory {
|
||||
public:
|
||||
std::vector<SdpVideoFormat> GetSupportedFormats() const override {
|
||||
std::vector<SdpVideoFormat> formats;
|
||||
GetSupportedFormatsInternal<Ts...>(formats);
|
||||
return formats;
|
||||
return GetSupportedFormatsInternal<Ts...>();
|
||||
}
|
||||
|
||||
std::unique_ptr<VideoEncoder> CreateVideoEncoder(
|
||||
@ -86,17 +84,20 @@ class VideoEncoderFactoryTemplate : public VideoEncoderFactory {
|
||||
}
|
||||
|
||||
template <typename V, typename... Vs>
|
||||
void GetSupportedFormatsInternal(std::vector<SdpVideoFormat>& formats) const {
|
||||
std::vector<SdpVideoFormat> GetSupportedFormatsInternal() const {
|
||||
auto supported_formats = V::SupportedFormats();
|
||||
for (const auto& format : supported_formats) {
|
||||
if (!IsFormatInList(format, formats)) {
|
||||
formats.push_back(format);
|
||||
|
||||
if constexpr (sizeof...(Vs) > 0) {
|
||||
// Supported formats may overlap between implementations, so duplicates
|
||||
// should be filtered out.
|
||||
for (const auto& other_format : GetSupportedFormatsInternal<Vs...>()) {
|
||||
if (!IsFormatInList(other_format, supported_formats)) {
|
||||
supported_formats.push_back(other_format);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if constexpr (sizeof...(Vs) > 0) {
|
||||
return GetSupportedFormatsInternal<Vs...>(formats);
|
||||
}
|
||||
return supported_formats;
|
||||
}
|
||||
|
||||
template <typename V, typename... Vs>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user