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

media / gpu / chromeos / frame_resource.cc [blame]

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

#include "media/gpu/chromeos/frame_resource.h"

namespace media {

namespace {
FrameResource::ID GetNextID() {
  static std::atomic_uint64_t counter(1u);
  return FrameResource::ID::FromUnsafeValue(
      counter.fetch_add(1u, std::memory_order_relaxed));
}

}  // namespace

FrameResource::FrameResource() : unique_id_(GetNextID()) {}

const base::UnguessableToken& FrameResource::tracking_token() const {
  CHECK(metadata().tracking_token.has_value());
  CHECK(!metadata().tracking_token->is_empty());
  return *metadata().tracking_token;
}

VideoFrameResource* FrameResource::AsVideoFrameResource() {
  return nullptr;
}

const NativePixmapFrameResource* FrameResource::AsNativePixmapFrameResource()
    const {
  return nullptr;
}

FrameResource::ID FrameResource::unique_id() const {
  return unique_id_;
}
}  // namespace media