tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

frame_dependencies_calculator.h (1514B)


      1 /*
      2 *  Copyright (c) 2020 The WebRTC project authors. All Rights Reserved.
      3 *
      4 *  Use of this source code is governed by a BSD-style license
      5 *  that can be found in the LICENSE file in the root of the source
      6 *  tree. An additional intellectual property rights grant can be found
      7 *  in the file PATENTS.  All contributing project authors may
      8 *  be found in the AUTHORS file in the root of the source tree.
      9 */
     10 
     11 #ifndef MODULES_VIDEO_CODING_FRAME_DEPENDENCIES_CALCULATOR_H_
     12 #define MODULES_VIDEO_CODING_FRAME_DEPENDENCIES_CALCULATOR_H_
     13 
     14 #include <stdint.h>
     15 
     16 #include <optional>
     17 
     18 #include "absl/container/inlined_vector.h"
     19 #include "api/array_view.h"
     20 #include "common_video/generic_frame_descriptor/generic_frame_info.h"
     21 
     22 namespace webrtc {
     23 
     24 // This class is thread compatible.
     25 class FrameDependenciesCalculator {
     26 public:
     27  FrameDependenciesCalculator() = default;
     28  FrameDependenciesCalculator(const FrameDependenciesCalculator&) = default;
     29  FrameDependenciesCalculator& operator=(const FrameDependenciesCalculator&) =
     30      default;
     31 
     32  // Calculates frame dependencies based on previous encoder buffer usage.
     33  absl::InlinedVector<int64_t, 5> FromBuffersUsage(
     34      int64_t frame_id,
     35      ArrayView<const CodecBufferUsage> buffers_usage);
     36 
     37 private:
     38  struct BufferUsage {
     39    std::optional<int64_t> frame_id;
     40    absl::InlinedVector<int64_t, 4> dependencies;
     41  };
     42 
     43  absl::InlinedVector<BufferUsage, 4> buffers_;
     44 };
     45 
     46 }  // namespace webrtc
     47 
     48 #endif  // MODULES_VIDEO_CODING_FRAME_DEPENDENCIES_CALCULATOR_H_