#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/modules/webcodecs/audio_decoder.h"
#include "base/metrics/histogram_functions.h"
#include "media/base/audio_codecs.h"
#include "media/base/audio_decoder.h"
#include "media/base/audio_decoder_config.h"
#include "media/base/channel_layout.h"
#include "media/base/encryption_scheme.h"
#include "media/base/media_util.h"
#include "media/base/mime_util.h"
#include "media/base/supported_types.h"
#include "media/base/waiting.h"
#include "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom-blink.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
#include "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_audio_decoder_config.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_audio_decoder_init.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_audio_decoder_support.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_encoded_audio_chunk.h"
#include "third_party/blink/renderer/modules/webaudio/base_audio_context.h"
#include "third_party/blink/renderer/modules/webcodecs/array_buffer_util.h"
#include "third_party/blink/renderer/modules/webcodecs/audio_data.h"
#include "third_party/blink/renderer/modules/webcodecs/audio_decoder_broker.h"
#include "third_party/blink/renderer/modules/webcodecs/decrypt_config_util.h"
#include "third_party/blink/renderer/modules/webcodecs/encoded_audio_chunk.h"
#include "third_party/blink/renderer/platform/audio/audio_utilities.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include <memory>
#include <vector>
namespace blink {
AudioDecoderConfig* CopyConfig(const AudioDecoderConfig& config) { … }
std::unique_ptr<AudioDecoderTraits::MediaDecoderType>
AudioDecoderTraits::CreateDecoder(
ExecutionContext& execution_context,
media::GpuVideoAcceleratorFactories* gpu_factories,
media::MediaLog* media_log) { … }
void AudioDecoderTraits::UpdateDecoderLog(const MediaDecoderType& decoder,
const MediaConfigType& media_config,
media::MediaLog* media_log) { … }
void AudioDecoderTraits::InitializeDecoder(
MediaDecoderType& decoder,
bool ,
const MediaConfigType& media_config,
MediaDecoderType::InitCB init_cb,
MediaDecoderType::OutputCB output_cb) { … }
int AudioDecoderTraits::GetMaxDecodeRequests(const MediaDecoderType& decoder) { … }
const char* AudioDecoderTraits::GetName() { … }
AudioDecoder* AudioDecoder::Create(ScriptState* script_state,
const AudioDecoderInit* init,
ExceptionState& exception_state) { … }
ScriptPromise<AudioDecoderSupport> AudioDecoder::isConfigSupported(
ScriptState* script_state,
const AudioDecoderConfig* config,
ExceptionState& exception_state) { … }
std::optional<media::AudioType> AudioDecoder::IsValidAudioDecoderConfig(
const AudioDecoderConfig& config,
String* js_error_message) { … }
std::optional<media::AudioDecoderConfig>
AudioDecoder::MakeMediaAudioDecoderConfig(const ConfigType& config,
String* js_error_message) { … }
AudioDecoder::AudioDecoder(ScriptState* script_state,
const AudioDecoderInit* init,
ExceptionState& exception_state)
: … { … }
bool AudioDecoder::IsValidConfig(const ConfigType& config,
String* js_error_message) { … }
std::optional<media::AudioDecoderConfig> AudioDecoder::MakeMediaConfig(
const ConfigType& config,
String* js_error_message) { … }
media::DecoderStatus::Or<scoped_refptr<media::DecoderBuffer>>
AudioDecoder::MakeInput(const InputType& chunk, bool verify_key_frame) { … }
media::DecoderStatus::Or<AudioDecoder::OutputType*> AudioDecoder::MakeOutput(
scoped_refptr<MediaOutputType> output,
ExecutionContext* context) { … }
const AtomicString& AudioDecoder::InterfaceName() const { … }
}