From f1c470e9fbf24909e6c9d60929452414f581e759 Mon Sep 17 00:00:00 2001 From: Karl Wiberg Date: Fri, 1 Jun 2018 11:24:55 +0200 Subject: [PATCH] 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 Reviewed-by: Fredrik Solenberg Cr-Commit-Position: refs/heads/master@{#23487} --- api/audio_codecs/BUILD.gn | 2 - api/audio_codecs/audio_decoder_factory.cc | 26 ----------- api/audio_codecs/audio_decoder_factory.h | 6 +-- .../audio_decoder_factory_template.h | 37 +--------------- api/audio_codecs/audio_encoder_factory.cc | 28 ------------ api/audio_codecs/audio_encoder_factory.h | 7 +-- .../audio_encoder_factory_template.h | 43 +------------------ 7 files changed, 4 insertions(+), 145 deletions(-) delete mode 100644 api/audio_codecs/audio_decoder_factory.cc delete mode 100644 api/audio_codecs/audio_encoder_factory.cc diff --git a/api/audio_codecs/BUILD.gn b/api/audio_codecs/BUILD.gn index ee943a1c1f..3206a74caa 100644 --- a/api/audio_codecs/BUILD.gn +++ b/api/audio_codecs/BUILD.gn @@ -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", diff --git a/api/audio_codecs/audio_decoder_factory.cc b/api/audio_codecs/audio_decoder_factory.cc deleted file mode 100644 index 08dbe788af..0000000000 --- a/api/audio_codecs/audio_decoder_factory.cc +++ /dev/null @@ -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 AudioDecoderFactory::MakeAudioDecoder( - const SdpAudioFormat& format, - rtc::Optional codec_pair_id) { - return MakeAudioDecoder(format); -} - -std::unique_ptr AudioDecoderFactory::MakeAudioDecoder( - const SdpAudioFormat& format) { - return MakeAudioDecoder(format, rtc::nullopt); -} - -} // namespace webrtc diff --git a/api/audio_codecs/audio_decoder_factory.h b/api/audio_codecs/audio_decoder_factory.h index 9954f314a6..fb1c965767 100644 --- a/api/audio_codecs/audio_decoder_factory.h +++ b/api/audio_codecs/audio_decoder_factory.h @@ -41,11 +41,7 @@ class AudioDecoderFactory : public rtc::RefCountInterface { // work. virtual std::unique_ptr MakeAudioDecoder( const SdpAudioFormat& format, - rtc::Optional codec_pair_id); - - // Deprecated version of the above. - virtual std::unique_ptr MakeAudioDecoder( - const SdpAudioFormat& format); + rtc::Optional codec_pair_id) = 0; }; } // namespace webrtc diff --git a/api/audio_codecs/audio_decoder_factory_template.h b/api/audio_codecs/audio_decoder_factory_template.h index 20a56d3771..4adac213d3 100644 --- a/api/audio_codecs/audio_decoder_factory_template.h +++ b/api/audio_codecs/audio_decoder_factory_template.h @@ -22,22 +22,6 @@ namespace webrtc { namespace audio_decoder_factory_template_impl { -template -class MakeAudioDecoderTakesTwoArgs { - private: - template - static auto Test(int) -> decltype( - U::MakeAudioDecoder(std::declval(), - std::declval>()), - std::true_type()); - - template - static std::false_type Test(...); - - public: - static constexpr bool value = decltype(Test(0))::value; -}; - template struct Helper; @@ -73,26 +57,9 @@ struct Helper { const SdpAudioFormat& format, rtc::Optional 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::MakeAudioDecoder(format, codec_pair_id); } - template < - typename ConfigT, - typename std::enable_if< - !MakeAudioDecoderTakesTwoArgs::value>::type* = nullptr> - static decltype(T::MakeAudioDecoder(std::declval())) - CallMakeAudioDecoder(const ConfigT& config, - rtc::Optional codec_pair_id) { - return T::MakeAudioDecoder(config); - } - template - static decltype( - T::MakeAudioDecoder(std::declval(), - std::declval>())) - CallMakeAudioDecoder(const ConfigT& config, - rtc::Optional codec_pair_id) { - return T::MakeAudioDecoder(config, codec_pair_id); - } }; template @@ -133,8 +100,6 @@ class AudioDecoderFactoryT : public AudioDecoderFactory { // // // Creates an AudioDecoder for the specified format. Used to implement // // AudioDecoderFactory::MakeAudioDecoder(). -// std::unique_ptr MakeAudioDecoder(const ConfigType& config); -// OR // std::unique_ptr MakeAudioDecoder( // const ConfigType& config, // rtc::Optional codec_pair_id); diff --git a/api/audio_codecs/audio_encoder_factory.cc b/api/audio_codecs/audio_encoder_factory.cc deleted file mode 100644 index b5c7110644..0000000000 --- a/api/audio_codecs/audio_encoder_factory.cc +++ /dev/null @@ -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 AudioEncoderFactory::MakeAudioEncoder( - int payload_type, - const SdpAudioFormat& format, - rtc::Optional codec_pair_id) { - return MakeAudioEncoder(payload_type, format); -} - -std::unique_ptr AudioEncoderFactory::MakeAudioEncoder( - int payload_type, - const SdpAudioFormat& format) { - return MakeAudioEncoder(payload_type, format, rtc::nullopt); -} - -} // namespace webrtc diff --git a/api/audio_codecs/audio_encoder_factory.h b/api/audio_codecs/audio_encoder_factory.h index 02bdfd9234..782595307d 100644 --- a/api/audio_codecs/audio_encoder_factory.h +++ b/api/audio_codecs/audio_encoder_factory.h @@ -50,12 +50,7 @@ class AudioEncoderFactory : public rtc::RefCountInterface { virtual std::unique_ptr MakeAudioEncoder( int payload_type, const SdpAudioFormat& format, - rtc::Optional codec_pair_id); - - // Deprecated version of the above. - virtual std::unique_ptr MakeAudioEncoder( - int payload_type, - const SdpAudioFormat& format); + rtc::Optional codec_pair_id) = 0; }; } // namespace webrtc diff --git a/api/audio_codecs/audio_encoder_factory_template.h b/api/audio_codecs/audio_encoder_factory_template.h index 6d4d9d61b0..f76677da71 100644 --- a/api/audio_codecs/audio_encoder_factory_template.h +++ b/api/audio_codecs/audio_encoder_factory_template.h @@ -22,23 +22,6 @@ namespace webrtc { namespace audio_encoder_factory_template_impl { -template -class MakeAudioEncoderTakesThreeArgs { - private: - template - static auto Test(int) -> decltype( - U::MakeAudioEncoder(std::declval(), - std::declval(), - std::declval>()), - std::true_type()); - - template - static std::false_type Test(...); - - public: - static constexpr bool value = decltype(Test(0))::value; -}; - template struct Helper; @@ -83,33 +66,12 @@ struct Helper { rtc::Optional 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::MakeAudioEncoder(payload_type, format, codec_pair_id); } } - template < - typename ConfigT, - typename std::enable_if< - !MakeAudioEncoderTakesThreeArgs::value>::type* = nullptr> - static decltype(T::MakeAudioEncoder(std::declval(), - std::declval())) - CallMakeAudioEncoder(const ConfigT& config, - int payload_type, - rtc::Optional codec_pair_id) { - return T::MakeAudioEncoder(config, payload_type); - } - template - static decltype( - T::MakeAudioEncoder(std::declval(), - std::declval(), - std::declval>())) - CallMakeAudioEncoder(const ConfigT& config, - int payload_type, - rtc::Optional codec_pair_id) { - return T::MakeAudioEncoder(config, payload_type, codec_pair_id); - } }; template @@ -156,9 +118,6 @@ class AudioEncoderFactoryT : public AudioEncoderFactory { // // // Creates an AudioEncoder for the specified format. Used to implement // // AudioEncoderFactory::MakeAudioEncoder(). -// std::unique_ptr MakeAudioEncoder(const ConfigType& config, -// int payload_type); -// OR // std::unique_ptr MakeAudioEncoder( // const ConfigType& config, // int payload_type,