chromium/content/browser/media/media_internals.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/342213636): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include "content/browser/media/media_internals.h"

#include <stddef.h>

#include <list>
#include <string>
#include <string_view>
#include <tuple>
#include <utility>

#include "base/containers/adapters.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "build/build_config.h"
#include "content/browser/media/session/media_session_impl.h"
#include "content/browser/renderer_host/media/media_stream_manager.h"
#include "content/public/browser/audio_service.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_features.h"
#include "media/audio/audio_features.h"
#include "media/base/audio_parameters.h"
#include "media/base/media_log_record.h"
#include "media/base/media_switches.h"
#include "media/webrtc/webrtc_features.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "sandbox/policy/features.h"
#include "sandbox/policy/sandbox_type.h"

#if !BUILDFLAG(IS_ANDROID)
#include "media/filters/decrypting_video_decoder.h"
#endif

namespace content {

namespace {

std::u16string SerializeUpdate(std::string_view function,
                               const base::ValueView value) {}

std::string EffectsToString(int effects) {}

std::string FormatToString(media::AudioParameters::Format format) {}

const char kAudioLogStatusKey[] =;
const char kAudioLogUpdateFunction[] =;

}  // namespace

// This class works as a receiver of logs of events occurring in the
// media pipeline. Media logs send by the renderer process to the
// browser process is handled by the below implementation in the
// browser side.
class MediaInternals::MediaInternalLogRecordsImpl
    : public content::mojom::MediaInternalLogRecords {};

MediaInternals::MediaInternalLogRecordsImpl::MediaInternalLogRecordsImpl(
    content::MediaInternals* media_internals,
    int render_process_id)
    :{}

void MediaInternals::MediaInternalLogRecordsImpl::Log(
    const std::vector<::media::MediaLogRecord>& events) {}

class MediaInternals::AudioLogImpl : public media::mojom::AudioLog,
                                     public media::AudioLog {};

MediaInternals::AudioLogImpl::AudioLogImpl(
    int owner_id,
    media::AudioLogFactory::AudioComponent component,
    content::MediaInternals* media_internals,
    int component_id,
    int render_process_id,
    int render_frame_id)
    :{}

MediaInternals::AudioLogImpl::~AudioLogImpl() {}

void MediaInternals::AudioLogImpl::OnCreated(
    const media::AudioParameters& params,
    const std::string& device_id) {}

void MediaInternals::AudioLogImpl::OnStarted() {}

void MediaInternals::AudioLogImpl::OnStopped() {}

void MediaInternals::AudioLogImpl::OnClosed() {}

void MediaInternals::AudioLogImpl::OnError() {}

void MediaInternals::AudioLogImpl::OnSetVolume(double volume) {}

void MediaInternals::AudioLogImpl::OnProcessingStateChanged(
    const std::string& message) {}

void MediaInternals::AudioLogImpl::OnLogMessage(const std::string& message) {}

void MediaInternals::AudioLogImpl::SetWebContentsTitle() {}

std::string MediaInternals::AudioLogImpl::FormatCacheKey() {}

// static
void MediaInternals::AudioLogImpl::SendWebContentsTitleHelper(
    const std::string& cache_key,
    base::Value::Dict dict,
    int render_process_id,
    int render_frame_id) {}

void MediaInternals::AudioLogImpl::SendSingleStringUpdate(
    const std::string& key,
    const std::string& value) {}

void MediaInternals::AudioLogImpl::StoreComponentMetadata(
    base::Value::Dict* dict) {}

MediaInternals* MediaInternals::GetInstance() {}

MediaInternals::MediaInternals() = default;

MediaInternals::~MediaInternals() {}

void MediaInternals::OnRenderProcessHostCreated(
    content::RenderProcessHost* host) {}

void MediaInternals::RenderProcessExited(
    RenderProcessHost* host,
    const ChildProcessTerminationInfo& info) {}

void MediaInternals::RenderProcessHostDestroyed(RenderProcessHost* host) {}

// Converts the |event| to a |update|. Returns whether the conversion succeeded.
static bool ConvertEventToUpdate(int render_process_id,
                                 const media::MediaLogRecord& event,
                                 std::u16string* update) {}

void MediaInternals::OnMediaEvents(
    int render_process_id,
    const std::vector<media::MediaLogRecord>& events) {}

void MediaInternals::AddUpdateCallback(UpdateCallback callback) {}

void MediaInternals::RemoveUpdateCallback(const UpdateCallback& callback) {}

bool MediaInternals::CanUpdate() {}

void MediaInternals::SendHistoricalMediaEvents() {}

void MediaInternals::SendGeneralAudioInformation() {}

void MediaInternals::SendAudioStreamData() {}

void MediaInternals::SendVideoCaptureDeviceCapabilities() {}

void MediaInternals::SendAudioFocusState() {}

void MediaInternals::GetRegisteredCdms() {}

void MediaInternals::UpdateVideoCaptureDeviceCapabilities(
    const std::vector<std::tuple<media::VideoCaptureDeviceDescriptor,
                                 media::VideoCaptureFormats>>&
        descriptors_and_formats) {}

std::unique_ptr<media::AudioLog> MediaInternals::CreateAudioLog(
    AudioComponent component,
    int component_id) {}

mojo::PendingRemote<media::mojom::AudioLog> MediaInternals::CreateMojoAudioLog(
    media::AudioLogFactory::AudioComponent component,
    int component_id,
    int render_process_id,
    int render_frame_id) {}

void MediaInternals::CreateMojoAudioLog(
    media::AudioLogFactory::AudioComponent component,
    int component_id,
    mojo::PendingReceiver<media::mojom::AudioLog> receiver,
    int render_process_id,
    int render_frame_id) {}

// static
void MediaInternals::CreateMediaLogRecords(
    int render_process_id,
    mojo::PendingReceiver<content::mojom::MediaInternalLogRecords> receiver) {}

std::unique_ptr<MediaInternals::AudioLogImpl>
MediaInternals::CreateAudioLogImpl(
    media::AudioLogFactory::AudioComponent component,
    int component_id,
    int render_process_id,
    int render_frame_id) {}

void MediaInternals::SendUpdate(const std::u16string& update) {}

void MediaInternals::SaveEvent(int process_id,
                               const media::MediaLogRecord& event) {}

void MediaInternals::EraseSavedEvents(RenderProcessHost* host) {}

void MediaInternals::UpdateAudioLog(AudioLogUpdateType type,
                                    std::string_view cache_key,
                                    std::string_view function,
                                    const base::Value::Dict& value) {}

}  // namespace content