1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65

media / mojo / mojom / media_foundation_service.mojom [blame]

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

module media.mojom;

import "gpu/ipc/common/gpu_info.mojom";
import "media/mojo/mojom/frame_interface_factory.mojom";
import "media/mojo/mojom/interface_factory.mojom";
import "media/mojo/mojom/key_system_support.mojom";
import "media/mojo/mojom/media_types.mojom";
import "mojo/public/mojom/base/file_path.mojom";
import "sandbox/policy/mojom/sandbox.mojom";

// An observer on GpuInfo updates.
interface GpuInfoObserver {
  // Notifies that a new GpuInfo update is available.
  OnGpuInfoUpdate(gpu.mojom.GpuInfo gpu_info);
};

// A service to provide Windows MediaFoundation-based InterfaceFactory and
// KeySystemCapability. See comments on MediaFoundationServiceBroker for the
// process/sandbox model.
interface MediaFoundationService {
  // Queries the capabilities of the MediaFoundation-based CDM. The client lives
  // in the browser process. `key_system_capability.sw_capability_query_status`
  // or `key_system_capability.hw_capability_query_status` can be used to
  // inspect the reason when no capability reported.
  IsKeySystemSupported(string key_system)
    => (bool is_supported, KeySystemCapability key_system_capability);

  // Requests an InterfaceFactory. `frame_interfaces` can optionally be used to
  // provide interfaces hosted by the caller to the remote InterfaceFactory
  // implementation.  The remote `InterfaceFactory` lives in the render process
  // to support media playback. The interface implementations provided by
  // the `frame_interfaces` live in the browser process so they are trusted.
  CreateInterfaceFactory(
      pending_receiver<InterfaceFactory> factory,
      pending_remote<FrameInterfaceFactory> frame_interfaces);
};

// A broker service to get the `MediaFoundationService`, needed to pass
// parameters to preload the CDM before creating the `MediaFoundationService`.
// It runs in the MediaFoundationCdm (utility) process and is connected from the
// browser process (see content/browser/media/service_factory.cc). In the
// process there should only be one `MediaFoundationServiceBroker` and one
// `MediaFoundationService` instance running. As such `GetService()` should only
// be called once and the subsequent calls will simply fail. When
// `MediaFoundationServiceBroker` is connected the process was not sandboxed to
// allow CDM preloading. After `GetService()` the process is fully sandboxed.
[ServiceSandbox=sandbox.mojom.Sandbox.kMediaFoundationCdm]
interface MediaFoundationServiceBroker {
  // Updates `GpuInfo` stored in the `MediaFoundationService` process. The
  // service will also provide a `gpu_info_observer` to get notified of any
  // future `GpuInfo` updates. This info will be used for crash reporting and
  // other purposes.
  UpdateGpuInfo(gpu.mojom.GpuInfo gpu_info)
    => (pending_remote<GpuInfoObserver> gpu_info_observer);

  // Loads the CDM at `cdm_path` into the process and returns the
  // `MediaFoundationService`.
  GetService(
      mojo_base.mojom.FilePath cdm_path,
      pending_receiver<MediaFoundationService> receiver);
};