Remove the audio codec factory methods that don't take AudioCodecPairId

Bug: webrtc:9062
Change-Id: I929097f45986335633ccf01462348c9d24202424
Reviewed-on: https://webrtc-review.googlesource.com/74441
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23487}
This commit is contained in:
Karl Wiberg
2018-06-01 11:24:55 +02:00
committed by Commit Bot
parent c4b7f037b7
commit f1c470e9fb
7 changed files with 4 additions and 145 deletions

View File

@ -19,12 +19,10 @@ rtc_source_set("audio_codecs_api") {
"audio_codec_pair_id.h",
"audio_decoder.cc",
"audio_decoder.h",
"audio_decoder_factory.cc",
"audio_decoder_factory.h",
"audio_decoder_factory_template.h",
"audio_encoder.cc",
"audio_encoder.h",
"audio_encoder_factory.cc",
"audio_encoder_factory.h",
"audio_encoder_factory_template.h",
"audio_format.cc",

View File

@ -1,26 +0,0 @@
/*
* Copyright (c) 2018 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.
*/
#include "api/audio_codecs/audio_decoder_factory.h"
namespace webrtc {
std::unique_ptr<AudioDecoder> AudioDecoderFactory::MakeAudioDecoder(
const SdpAudioFormat& format,
rtc::Optional<AudioCodecPairId> codec_pair_id) {
return MakeAudioDecoder(format);
}
std::unique_ptr<AudioDecoder> AudioDecoderFactory::MakeAudioDecoder(
const SdpAudioFormat& format) {
return MakeAudioDecoder(format, rtc::nullopt);
}
} // namespace webrtc

View File

@ -41,11 +41,7 @@ class AudioDecoderFactory : public rtc::RefCountInterface {
// work.
virtual std::unique_ptr<AudioDecoder> MakeAudioDecoder(
const SdpAudioFormat& format,
rtc::Optional<AudioCodecPairId> codec_pair_id);
// Deprecated version of the above.
virtual std::unique_ptr<AudioDecoder> MakeAudioDecoder(
const SdpAudioFormat& format);
rtc::Optional<AudioCodecPairId> codec_pair_id) = 0;
};
} // namespace webrtc

View File

@ -22,22 +22,6 @@ namespace webrtc {
namespace audio_decoder_factory_template_impl {
template <typename T, typename ConfigT>
class MakeAudioDecoderTakesTwoArgs {
private:
template <typename U>
static auto Test(int) -> decltype(
U::MakeAudioDecoder(std::declval<ConfigT>(),
std::declval<rtc::Optional<AudioCodecPairId>>()),
std::true_type());
template <typename U>
static std::false_type Test(...);
public:
static constexpr bool value = decltype(Test<T>(0))::value;
};
template <typename... Ts>
struct Helper;
@ -73,26 +57,9 @@ struct Helper<T, Ts...> {
const SdpAudioFormat& format,
rtc::Optional<AudioCodecPairId> codec_pair_id) {
auto opt_config = T::SdpToConfig(format);
return opt_config ? CallMakeAudioDecoder(*opt_config, codec_pair_id)
return opt_config ? T::MakeAudioDecoder(*opt_config, codec_pair_id)
: Helper<Ts...>::MakeAudioDecoder(format, codec_pair_id);
}
template <
typename ConfigT,
typename std::enable_if<
!MakeAudioDecoderTakesTwoArgs<T, ConfigT>::value>::type* = nullptr>
static decltype(T::MakeAudioDecoder(std::declval<ConfigT>()))
CallMakeAudioDecoder(const ConfigT& config,
rtc::Optional<AudioCodecPairId> codec_pair_id) {
return T::MakeAudioDecoder(config);
}
template <typename ConfigT>
static decltype(
T::MakeAudioDecoder(std::declval<ConfigT>(),
std::declval<rtc::Optional<AudioCodecPairId>>()))
CallMakeAudioDecoder(const ConfigT& config,
rtc::Optional<AudioCodecPairId> codec_pair_id) {
return T::MakeAudioDecoder(config, codec_pair_id);
}
};
template <typename... Ts>
@ -133,8 +100,6 @@ class AudioDecoderFactoryT : public AudioDecoderFactory {
//
// // Creates an AudioDecoder for the specified format. Used to implement
// // AudioDecoderFactory::MakeAudioDecoder().
// std::unique_ptr<AudioDecoder> MakeAudioDecoder(const ConfigType& config);
// OR
// std::unique_ptr<AudioDecoder> MakeAudioDecoder(
// const ConfigType& config,
// rtc::Optional<AudioCodecPairId> codec_pair_id);

View File

@ -1,28 +0,0 @@
/*
* Copyright (c) 2018 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.
*/
#include "api/audio_codecs/audio_encoder_factory.h"
namespace webrtc {
std::unique_ptr<AudioEncoder> AudioEncoderFactory::MakeAudioEncoder(
int payload_type,
const SdpAudioFormat& format,
rtc::Optional<AudioCodecPairId> codec_pair_id) {
return MakeAudioEncoder(payload_type, format);
}
std::unique_ptr<AudioEncoder> AudioEncoderFactory::MakeAudioEncoder(
int payload_type,
const SdpAudioFormat& format) {
return MakeAudioEncoder(payload_type, format, rtc::nullopt);
}
} // namespace webrtc

View File

@ -50,12 +50,7 @@ class AudioEncoderFactory : public rtc::RefCountInterface {
virtual std::unique_ptr<AudioEncoder> MakeAudioEncoder(
int payload_type,
const SdpAudioFormat& format,
rtc::Optional<AudioCodecPairId> codec_pair_id);
// Deprecated version of the above.
virtual std::unique_ptr<AudioEncoder> MakeAudioEncoder(
int payload_type,
const SdpAudioFormat& format);
rtc::Optional<AudioCodecPairId> codec_pair_id) = 0;
};
} // namespace webrtc

View File

@ -22,23 +22,6 @@ namespace webrtc {
namespace audio_encoder_factory_template_impl {
template <typename T, typename ConfigT>
class MakeAudioEncoderTakesThreeArgs {
private:
template <typename U>
static auto Test(int) -> decltype(
U::MakeAudioEncoder(std::declval<ConfigT>(),
std::declval<int>(),
std::declval<rtc::Optional<AudioCodecPairId>>()),
std::true_type());
template <typename U>
static std::false_type Test(...);
public:
static constexpr bool value = decltype(Test<T>(0))::value;
};
template <typename... Ts>
struct Helper;
@ -83,33 +66,12 @@ struct Helper<T, Ts...> {
rtc::Optional<AudioCodecPairId> codec_pair_id) {
auto opt_config = T::SdpToConfig(format);
if (opt_config) {
return CallMakeAudioEncoder(*opt_config, payload_type, codec_pair_id);
return T::MakeAudioEncoder(*opt_config, payload_type, codec_pair_id);
} else {
return Helper<Ts...>::MakeAudioEncoder(payload_type, format,
codec_pair_id);
}
}
template <
typename ConfigT,
typename std::enable_if<
!MakeAudioEncoderTakesThreeArgs<T, ConfigT>::value>::type* = nullptr>
static decltype(T::MakeAudioEncoder(std::declval<ConfigT>(),
std::declval<int>()))
CallMakeAudioEncoder(const ConfigT& config,
int payload_type,
rtc::Optional<AudioCodecPairId> codec_pair_id) {
return T::MakeAudioEncoder(config, payload_type);
}
template <typename ConfigT>
static decltype(
T::MakeAudioEncoder(std::declval<ConfigT>(),
std::declval<int>(),
std::declval<rtc::Optional<AudioCodecPairId>>()))
CallMakeAudioEncoder(const ConfigT& config,
int payload_type,
rtc::Optional<AudioCodecPairId> codec_pair_id) {
return T::MakeAudioEncoder(config, payload_type, codec_pair_id);
}
};
template <typename... Ts>
@ -156,9 +118,6 @@ class AudioEncoderFactoryT : public AudioEncoderFactory {
//
// // Creates an AudioEncoder for the specified format. Used to implement
// // AudioEncoderFactory::MakeAudioEncoder().
// std::unique_ptr<AudioEncoder> MakeAudioEncoder(const ConfigType& config,
// int payload_type);
// OR
// std::unique_ptr<AudioDecoder> MakeAudioEncoder(
// const ConfigType& config,
// int payload_type,