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

media / mojo / mojom / dcomp_surface_registry.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 "mojo/public/mojom/base/unguessable_token.mojom";

// For Windows MediaFoundation playback, we need to send a DirectComposition
// (DCOMP) surface handle from the MediaFoundationService (utility) process to
// the GPU process which can be later retrieved and set in
// DCompSurfaceImageBacking. This interface is used to send the handle to
// DCOMPSurfaceRegistryBroker in the browser process, which then uses GpuService
// to send it the GPU process. The client is MediaFoundationRendererWrapper in
// the utility process, and the implementation is the DCOMPSurfaceRegistryBroker
// in the browser process.
interface DCOMPSurfaceRegistry {
  // Registers a DCOMP surface handle and returns a token. The token will then
  // be used by MediaFoundationRendererClient to call DCOMPTexture to set the
  // surface in DCompSurfaceImageBacking. Null token will be returned upon
  // failure.
  RegisterDCOMPSurfaceHandle(handle<platform> surface_handle)
      => (mojo_base.mojom.UnguessableToken? token);

  // Unregisters the DCOMP surface handle associated with `token`. This is to
  // avoid handle leak in case the handle is not taken during a playback, e.g.
  // user closes tab immediately after playback start. No-op if the handle has
  // already been taken.
  UnregisterDCOMPSurfaceHandle(mojo_base.mojom.UnguessableToken token);
};