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

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

Issue 2503443002: Let Opus increase complexity for low bitrates (Closed)
Patch Set: Fixing a typo Created 4 years, 1 month 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
« no previous file with comments | « webrtc/modules/audio_coding/BUILD.gn ('k') | webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 81ca17f7e08bf14d4577de9332f49f9871eb0cf5..f30d657d133358eb20d84afec5a4e98c0062138f 100644
--- a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h
+++ b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h
@@ -12,6 +12,8 @@
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_
#include <functional>
+#include <memory>
+#include <string>
#include <vector>
#include "webrtc/base/constructormagic.h"
@@ -39,6 +41,11 @@ class AudioEncoderOpus final : public AudioEncoder {
bool IsOk() const;
int GetBitrateBps() const;
+ // Returns empty if the current bitrate falls within the hysteresis window,
+ // defined by complexity_threshold_bps +/- complexity_threshold_window_bps.
+ // Otherwise, returns the current complexity depending on whether the
+ // current bitrate is above or below complexity_threshold_bps.
+ rtc::Optional<int> GetNewComplexity() const;
int frame_size_ms = 20;
size_t num_channels = 1;
@@ -48,6 +55,11 @@ class AudioEncoderOpus final : public AudioEncoder {
bool fec_enabled = false;
int max_playback_rate_hz = 48000;
int complexity = kDefaultComplexity;
+ // This value may change in the struct's constructor.
+ int low_rate_complexity = kDefaultComplexity;
+ // low_rate_complexity is used when the bitrate is below this threshold.
+ int complexity_threshold_bps = 12500;
+ int complexity_threshold_window_bps = 1500;
bool dtx_enabled = false;
std::vector<int> supported_frame_lengths_ms;
const Clock* clock = nullptr;
@@ -140,6 +152,7 @@ class AudioEncoderOpus final : public AudioEncoder {
uint32_t first_timestamp_in_buffer_;
size_t num_channels_to_encode_;
int next_frame_length_ms_;
+ int complexity_;
std::unique_ptr<PacketLossFractionSmoother> packet_loss_fraction_smoother_;
AudioNetworkAdaptorCreator audio_network_adaptor_creator_;
std::unique_ptr<AudioNetworkAdaptor> audio_network_adaptor_;
« no previous file with comments | « webrtc/modules/audio_coding/BUILD.gn ('k') | webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698