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

Side by Side Diff: webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h

Issue 1942193002: AudioEncoderOpus: Default to 32 kbit/s for mono, 64 kbit/s for stereo (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_
12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_ 12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_
13 13
14 #include <vector> 14 #include <vector>
15 15
16 #include "webrtc/base/constructormagic.h" 16 #include "webrtc/base/constructormagic.h"
17 #include "webrtc/base/optional.h"
17 #include "webrtc/modules/audio_coding/codecs/opus/opus_interface.h" 18 #include "webrtc/modules/audio_coding/codecs/opus/opus_interface.h"
18 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" 19 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
19 20
20 namespace webrtc { 21 namespace webrtc {
21 22
22 struct CodecInst; 23 struct CodecInst;
23 24
24 class AudioEncoderOpus final : public AudioEncoder { 25 class AudioEncoderOpus final : public AudioEncoder {
25 public: 26 public:
26 enum ApplicationMode { 27 enum ApplicationMode {
27 kVoip = 0, 28 kVoip = 0,
28 kAudio = 1, 29 kAudio = 1,
29 }; 30 };
30 31
31 struct Config { 32 struct Config {
33 Config();
34 Config(const Config&);
35 ~Config();
36 Config& operator=(const Config&);
37
32 bool IsOk() const; 38 bool IsOk() const;
39 int GetBitrateBps() const;
40
33 int frame_size_ms = 20; 41 int frame_size_ms = 20;
34 size_t num_channels = 1; 42 size_t num_channels = 1;
35 int payload_type = 120; 43 int payload_type = 120;
36 ApplicationMode application = kVoip; 44 ApplicationMode application = kVoip;
37 int bitrate_bps = 64000; 45 rtc::Optional<int> bitrate_bps; // Unset means to use default value.
38 bool fec_enabled = false; 46 bool fec_enabled = false;
39 int max_playback_rate_hz = 48000; 47 int max_playback_rate_hz = 48000;
40 int complexity = kDefaultComplexity; 48 int complexity = kDefaultComplexity;
41 bool dtx_enabled = false; 49 bool dtx_enabled = false;
42 50
43 private: 51 private:
44 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) || defined(WEBRTC_ARCH_ARM) 52 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) || defined(WEBRTC_ARCH_ARM)
45 // If we are on Android, iOS and/or ARM, use a lower complexity setting as 53 // If we are on Android, iOS and/or ARM, use a lower complexity setting as
46 // default, to save encoder complexity. 54 // default, to save encoder complexity.
47 static const int kDefaultComplexity = 5; 55 static const int kDefaultComplexity = 5;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 double packet_loss_rate_; 101 double packet_loss_rate_;
94 std::vector<int16_t> input_buffer_; 102 std::vector<int16_t> input_buffer_;
95 OpusEncInst* inst_; 103 OpusEncInst* inst_;
96 uint32_t first_timestamp_in_buffer_; 104 uint32_t first_timestamp_in_buffer_;
97 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderOpus); 105 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderOpus);
98 }; 106 };
99 107
100 } // namespace webrtc 108 } // namespace webrtc
101 109
102 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_ 110 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698