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

Commit 48003b52 authored by Harish Mahendrakar's avatar Harish Mahendrakar
Browse files

C2SoftGav1Dec: Add support for configuring threads using setprop

This helps in running some experiments to find decoder performance
for different number of threads.

Bug: 309029947
Test: adb root && adb shell setprop debug.c2.gav1.numthreads 4
Test: adb shell stagefright -s file.webm -N c2.android.av1.decoder

Change-Id: I7b4106981134355fe07ebc444d39fbac5afe41da
parent 6101cf0c
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);