chromium/media/gpu/chromeos/oop_video_decoder.h

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

#ifndef MEDIA_GPU_CHROMEOS_OOP_VIDEO_DECODER_H_
#define MEDIA_GPU_CHROMEOS_OOP_VIDEO_DECODER_H_

#include "base/containers/lru_cache.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/time.h"
#include "media/base/media_log.h"
#include "media/gpu/chromeos/video_decoder_pipeline.h"
#include "media/gpu/media_gpu_export.h"
#include "media/mojo/mojom/stable/stable_video_decoder.mojom.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/remote.h"

#if BUILDFLAG(IS_CHROMEOS)
namespace chromeos {
class StableCdmContextImpl;
}  // namespace chromeos
#endif  // BUILDFLAG(IS_CHROMEOS)

namespace media {

class MojoDecoderBufferWriter;

// Proxy video decoder that connects with an out-of-process
// video decoder via Mojo. This class should be operated and
// destroyed on |decoder_task_runner_|.
//
// Note: MEDIA_GPU_EXPORT is necessary to expose the OOPVideoDecoder to the
// MojoStableVideoDecoder.
//
// TODO(b/195769334): this class (or most of it) would be unnecessary if the
// MailboxVideoFrameConverter lived together with the remote decoder in the same
// process. Then, clients can communicate with that process without the GPU
// process acting as a proxy.
class MEDIA_GPU_EXPORT OOPVideoDecoder
    : public VideoDecoderMixin,
      public stable::mojom::VideoDecoderClient,
      public stable::mojom::MediaLog {};

}  // namespace media

#endif  // MEDIA_GPU_CHROMEOS_OOP_VIDEO_DECODER_H_