tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

audio_encoder_opus.cc (1770B)


      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 "api/audio_codecs/opus/audio_encoder_opus.h"
     12 
     13 #include <memory>
     14 #include <optional>
     15 #include <vector>
     16 
     17 #include "api/audio_codecs/audio_encoder.h"
     18 #include "api/audio_codecs/audio_encoder_factory.h"
     19 #include "api/audio_codecs/audio_format.h"
     20 #include "api/audio_codecs/opus/audio_encoder_opus_config.h"
     21 #include "api/environment/environment.h"
     22 #include "modules/audio_coding/codecs/opus/audio_encoder_opus.h"
     23 #include "rtc_base/checks.h"
     24 
     25 namespace webrtc {
     26 
     27 std::optional<AudioEncoderOpusConfig> AudioEncoderOpus::SdpToConfig(
     28    const SdpAudioFormat& format) {
     29  return AudioEncoderOpusImpl::SdpToConfig(format);
     30 }
     31 
     32 void AudioEncoderOpus::AppendSupportedEncoders(
     33    std::vector<AudioCodecSpec>* specs) {
     34  AudioEncoderOpusImpl::AppendSupportedEncoders(specs);
     35 }
     36 
     37 AudioCodecInfo AudioEncoderOpus::QueryAudioEncoder(
     38    const AudioEncoderOpusConfig& config) {
     39  return AudioEncoderOpusImpl::QueryAudioEncoder(config);
     40 }
     41 
     42 std::unique_ptr<AudioEncoder> AudioEncoderOpus::MakeAudioEncoder(
     43    const Environment& env,
     44    const AudioEncoderOpusConfig& config,
     45    const AudioEncoderFactory::Options& options) {
     46  if (!config.IsOk()) {
     47    RTC_DCHECK_NOTREACHED();
     48    return nullptr;
     49  }
     50  return std::make_unique<AudioEncoderOpusImpl>(env, config,
     51                                                options.payload_type);
     52 }
     53 
     54 }  // namespace webrtc