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

Unified Diff: webrtc/api/audio_codecs/opus/audio_encoder_opus.cc

Issue 2930243003: Opus implementation of the AudioEncoderFactoryTemplate API (Closed)
Patch Set: rebase Created 3 years, 6 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/api/audio_codecs/opus/audio_encoder_opus.cc
diff --git a/webrtc/api/audio_codecs/opus/audio_encoder_opus.cc b/webrtc/api/audio_codecs/opus/audio_encoder_opus.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0969561ed14f8afca21106d9aaaea19ac60fc74f
--- /dev/null
+++ b/webrtc/api/audio_codecs/opus/audio_encoder_opus.cc
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017 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 "webrtc/api/audio_codecs/opus/audio_encoder_opus.h"
+
+#include <memory>
+#include <vector>
+
+#include "webrtc/base/ptr_util.h"
+#include "webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h"
+
+namespace webrtc {
+
+rtc::Optional<AudioEncoderOpusConfig> AudioEncoderOpus::SdpToConfig(
+ const SdpAudioFormat& format) {
+ return AudioEncoderOpusImpl::SdpToConfig(format);
+}
+
+void AudioEncoderOpus::AppendSupportedEncoders(
+ std::vector<AudioCodecSpec>* specs) {
+ const SdpAudioFormat fmt = {
+ "opus", 48000, 2, {{"minptime", "10"}, {"useinbandfec", "1"}}};
the sun 2017/06/16 12:44:10 stereo?
+ const AudioCodecInfo info = QueryAudioEncoder(*SdpToConfig(fmt));
+ specs->push_back({fmt, info});
+}
+
+AudioCodecInfo AudioEncoderOpus::QueryAudioEncoder(
+ const AudioEncoderOpusConfig& config) {
+ RTC_DCHECK(config.IsOk());
+ AudioCodecInfo info(48000, config.num_channels, config.bitrate_bps,
+ AudioEncoderOpusConfig::kMinBitrateBps,
+ AudioEncoderOpusConfig::kMaxBitrateBps);
+ info.allow_comfort_noise = false;
+ info.supports_network_adaption = true;
+ return info;
+}
+
+std::unique_ptr<AudioEncoder> AudioEncoderOpus::MakeAudioEncoder(
+ const AudioEncoderOpusConfig& config,
+ int payload_type) {
+ RTC_DCHECK(config.IsOk());
+ return rtc::MakeUnique<AudioEncoderOpusImpl>(config, payload_type);
+}
+
+} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698