Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f8bdea4 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "C2SoftGav1Dec: Add support for configuring threads using setprop" into main

parents 7455677a 48003b52
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#define LOG_TAG "C2SoftGav1Dec"
#include "C2SoftGav1Dec.h"

#include <android-base/properties.h>
#include <C2Debug.h>
#include <C2PlatformSupport.h>
#include <Codec2BufferUtils.h>
@@ -39,6 +40,9 @@

namespace android {

// Property used to control the number of threads used in the gav1 decoder.
constexpr char kNumThreadsProperty[] = "debug.c2.gav1.numthreads";

// codecname set and passed in as a compile flag from Android.bp
constexpr char COMPONENT_NAME[] = CODECNAME;

@@ -506,6 +510,10 @@ bool C2SoftGav1Dec::initDecoder() {

  libgav1::DecoderSettings settings = {};
  settings.threads = GetCPUCoreCount();
  int32_t numThreads = android::base::GetIntProperty(kNumThreadsProperty, 0);
  if (numThreads > 0 && numThreads < settings.threads) {
    settings.threads = numThreads;
  }

  ALOGV("Using libgav1 AV1 software decoder.");
  Libgav1StatusCode status = mCodecCtx->Init(&settings);