Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Unified Diff: webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h

Issue 2695243005: Injectable audio encoders: BuiltinAudioEncoderFactory (Closed)
Patch Set: Fix build problems on Windows, Android and downstream. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h
diff --git a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h
index 8f5bba6e8bc41cd9f597e808f03deea01d647f6b..3d3597bfd9d4789e64faf7cbf141ee85d73c1b0c 100644
--- a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h
+++ b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h
@@ -16,12 +16,13 @@
#include <string>
#include <vector>
+#include "webrtc/api/audio_codecs/audio_format.h"
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/optional.h"
#include "webrtc/common_audio/smoothing_filter.h"
#include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor.h"
-#include "webrtc/modules/audio_coding/codecs/opus/opus_interface.h"
#include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
+#include "webrtc/modules/audio_coding/codecs/opus/opus_interface.h"
namespace webrtc {
@@ -50,7 +51,8 @@ class AudioEncoderOpus final : public AudioEncoder {
// current bitrate is above or below complexity_threshold_bps.
rtc::Optional<int> GetNewComplexity() const;
- int frame_size_ms = 20;
+ static constexpr int kDefaultFrameSizeMs = 20;
+ int frame_size_ms = kDefaultFrameSizeMs;
size_t num_channels = 1;
int payload_type = 120;
ApplicationMode application = kVoip;
@@ -79,6 +81,9 @@ class AudioEncoderOpus final : public AudioEncoder {
#endif
};
+ static Config CreateConfig(int payload_type, const SdpAudioFormat& format);
+ static Config CreateConfig(const CodecInst& codec_inst);
+
using AudioNetworkAdaptorCreator =
std::function<std::unique_ptr<AudioNetworkAdaptor>(const std::string&,
RtcEventLog*,
@@ -89,9 +94,14 @@ class AudioEncoderOpus final : public AudioEncoder {
std::unique_ptr<SmoothingFilter> bitrate_smoother = nullptr);
explicit AudioEncoderOpus(const CodecInst& codec_inst);
-
+ AudioEncoderOpus(int payload_type, const SdpAudioFormat& format);
~AudioEncoderOpus() override;
+ // Static interface for use by BuiltinAudioEncoderFactory.
+ static constexpr const char* GetPayloadName() { return "opus"; }
+ static rtc::Optional<AudioCodecInfo> QueryAudioEncoder(
+ const SdpAudioFormat& format);
+
int SampleRateHz() const override;
size_t NumChannels() const override;
size_t Num10MsFramesInNextPacket() const override;

Powered by Google App Engine
This is Rietveld 408576698