Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | |
| 3 * | |
| 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 | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #include "webrtc/api/audio_codecs/opus/audio_encoder_opus.h" | |
| 12 | |
| 13 #include <memory> | |
| 14 #include <vector> | |
| 15 | |
| 16 #include "webrtc/base/ptr_util.h" | |
| 17 #include "webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h" | |
| 18 | |
| 19 namespace webrtc { | |
| 20 | |
| 21 rtc::Optional<AudioEncoderOpusConfig> AudioEncoderOpus::SdpToConfig( | |
| 22 const SdpAudioFormat& format) { | |
| 23 return AudioEncoderOpusImpl::SdpToConfig(format); | |
| 24 } | |
| 25 | |
| 26 void AudioEncoderOpus::AppendSupportedEncoders( | |
| 27 std::vector<AudioCodecSpec>* specs) { | |
| 28 const SdpAudioFormat fmt = { | |
| 29 "opus", 48000, 2, {{"minptime", "10"}, {"useinbandfec", "1"}}}; | |
|
the sun
2017/06/16 12:44:10
stereo?
| |
| 30 const AudioCodecInfo info = QueryAudioEncoder(*SdpToConfig(fmt)); | |
| 31 specs->push_back({fmt, info}); | |
| 32 } | |
| 33 | |
| 34 AudioCodecInfo AudioEncoderOpus::QueryAudioEncoder( | |
| 35 const AudioEncoderOpusConfig& config) { | |
| 36 RTC_DCHECK(config.IsOk()); | |
| 37 AudioCodecInfo info(48000, config.num_channels, config.bitrate_bps, | |
| 38 AudioEncoderOpusConfig::kMinBitrateBps, | |
| 39 AudioEncoderOpusConfig::kMaxBitrateBps); | |
| 40 info.allow_comfort_noise = false; | |
| 41 info.supports_network_adaption = true; | |
| 42 return info; | |
| 43 } | |
| 44 | |
| 45 std::unique_ptr<AudioEncoder> AudioEncoderOpus::MakeAudioEncoder( | |
| 46 const AudioEncoderOpusConfig& config, | |
| 47 int payload_type) { | |
| 48 RTC_DCHECK(config.IsOk()); | |
| 49 return rtc::MakeUnique<AudioEncoderOpusImpl>(config, payload_type); | |
| 50 } | |
| 51 | |
| 52 } // namespace webrtc | |
| OLD | NEW |