tor-browser

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

audio_decoder_factory.h (2119B)


      1 /*
      2 *  Copyright (c) 2016 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 #ifndef API_AUDIO_CODECS_AUDIO_DECODER_FACTORY_H_
     12 #define API_AUDIO_CODECS_AUDIO_DECODER_FACTORY_H_
     13 
     14 #include <memory>
     15 #include <optional>
     16 #include <vector>
     17 
     18 #include "absl/base/nullability.h"
     19 #include "api/audio_codecs/audio_codec_pair_id.h"
     20 #include "api/audio_codecs/audio_decoder.h"
     21 #include "api/audio_codecs/audio_format.h"
     22 #include "api/environment/environment.h"
     23 #include "api/ref_count.h"
     24 
     25 namespace webrtc {
     26 
     27 // A factory that creates AudioDecoders.
     28 class AudioDecoderFactory : public RefCountInterface {
     29 public:
     30  virtual std::vector<AudioCodecSpec> GetSupportedDecoders() = 0;
     31 
     32  virtual bool IsSupportedDecoder(const SdpAudioFormat& format) = 0;
     33 
     34  // Create a new decoder instance. The `codec_pair_id` argument is used to link
     35  // encoders and decoders that talk to the same remote entity: if a
     36  // AudioEncoderFactory::Create() and a AudioDecoderFactory::Create() call
     37  // receive non-null IDs that compare equal, the factory implementations may
     38  // assume that the encoder and decoder form a pair. (The intended use case for
     39  // this is to set up communication between the AudioEncoder and AudioDecoder
     40  // instances, which is needed for some codecs with built-in bandwidth
     41  // adaptation.)
     42  //
     43  // Returns null if the format isn't supported.
     44  //
     45  // Note: Implementations need to be robust against combinations other than
     46  // one encoder, one decoder getting the same ID; such decoders must still
     47  // work.
     48  virtual absl_nullable std::unique_ptr<AudioDecoder> Create(
     49      const Environment& env,
     50      const SdpAudioFormat& format,
     51      std::optional<AudioCodecPairId> codec_pair_id) = 0;
     52 };
     53 
     54 }  // namespace webrtc
     55 
     56 #endif  // API_AUDIO_CODECS_AUDIO_DECODER_FACTORY_H_