chromium/third_party/blink/renderer/modules/webcodecs/audio_decoder_broker.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/modules/webcodecs/audio_decoder_broker.h"

#include <limits>
#include <memory>
#include <string>

#include "base/memory/weak_ptr.h"
#include "base/task/sequenced_task_runner.h"
#include "build/buildflag.h"
#include "media/base/audio_decoder_config.h"
#include "media/base/decoder_factory.h"
#include "media/base/media_log.h"
#include "media/mojo/buildflags.h"
#include "media/mojo/clients/mojo_decoder_factory.h"
#include "media/mojo/mojom/interface_factory.mojom.h"
#include "media/renderers/default_decoder_factory.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/modules/webcodecs/decoder_selector.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread.h"
#include "third_party/blink/renderer/platform/scheduler/public/worker_pool.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier_base.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier_mojo.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"

DecoderDetails;

namespace WTF {

template <>
struct CrossThreadCopier<media::AudioDecoderConfig>
    : public CrossThreadCopierPassThrough<media::AudioDecoderConfig> {};

template <>
struct CrossThreadCopier<media::DecoderStatus>
    : public CrossThreadCopierPassThrough<media::DecoderStatus> {};

template <>
struct CrossThreadCopier<std::optional<DecoderDetails>>
    : public CrossThreadCopierPassThrough<std::optional<DecoderDetails>> {};

}  // namespace WTF

namespace blink {

// Wrapper class for state and API calls that must be made from the
// |media_task_runner_|. Construction must happen on blink main thread to safely
// make use of ExecutionContext and Document. These GC blink types must not be
// stored/referenced by any other method.
class MediaAudioTaskWrapper {};

AudioDecoderBroker::AudioDecoderBroker(media::MediaLog* media_log,
                                       ExecutionContext& execution_context)
    // Use a worker task runner to avoid scheduling decoder
    // work on the main thread.
    :{}

AudioDecoderBroker::~AudioDecoderBroker() {}

media::AudioDecoderType AudioDecoderBroker::GetDecoderType() const {}

bool AudioDecoderBroker::IsPlatformDecoder() const {}

void AudioDecoderBroker::Initialize(const media::AudioDecoderConfig& config,
                                    media::CdmContext* cdm_context,
                                    InitCB init_cb,
                                    const OutputCB& output_cb,
                                    const media::WaitingCB& waiting_cb) {}

int AudioDecoderBroker::CreateCallbackId() {}

void AudioDecoderBroker::OnInitialize(media::DecoderStatus status,
                                      std::optional<DecoderDetails> details) {}

void AudioDecoderBroker::Decode(scoped_refptr<media::DecoderBuffer> buffer,
                                DecodeCB decode_cb) {}

void AudioDecoderBroker::OnDecodeDone(int cb_id, media::DecoderStatus status) {}

void AudioDecoderBroker::Reset(base::OnceClosure reset_cb) {}

bool AudioDecoderBroker::NeedsBitstreamConversion() const {}

void AudioDecoderBroker::OnReset(int cb_id) {}

void AudioDecoderBroker::OnDecodeOutput(
    scoped_refptr<media::AudioBuffer> buffer) {}

}  // namespace blink