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

Commit 3f19aa45 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 11931036 from b71ca7f7 to 24Q3-release

Change-Id: I2483601b26e473df419a9ced17d72a7a1d2fd4d4
parents 1939ea55 b71ca7f7
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -67,6 +67,14 @@ flag {

}

flag {
    name: "replace_stream_bt_sco"
    namespace: "media_audio"
    description:
        "Replace internally STREAM_BLUETOOTH_SCO with STREAM_VOICE_CALL"
    bug: "345024266"
}

flag {
    name: "ringer_mode_affects_alarm"
    namespace: "media_audio"
+24 −0
Original line number Diff line number Diff line
@@ -465,6 +465,7 @@ C2SoftVpxEnc::C2SoftVpxEnc(const char* name, c2_node_id_t id,
      mTemporalPatternIdx(0),
      mLastTimestamp(0x7FFFFFFFFFFFFFFFull),
      mSignalledOutputEos(false),
      mHeaderGenerated(false),
      mSignalledError(false) {
    for (int i = 0; i < MAXTEMPORALLAYERS; i++) {
        mTemporalLayerBitrateRatio[i] = 1.0f;
@@ -494,6 +495,7 @@ void C2SoftVpxEnc::onRelease() {

    // this one is not allocated by us
    mCodecInterface = nullptr;
    mHeaderGenerated = false;
}

c2_status_t C2SoftVpxEnc::onStop() {
@@ -558,6 +560,7 @@ status_t C2SoftVpxEnc::initEncoder() {
          (uint32_t)mBitrateControlMode, mTemporalLayers, mIntf->getSyncFramePeriod(),
          mMinQuantizer, mMaxQuantizer);

    mHeaderGenerated = false;
    mCodecConfiguration = new vpx_codec_enc_cfg_t;
    if (!mCodecConfiguration) goto CleanUp;
    codec_return = vpx_codec_enc_config_default(mCodecInterface,
@@ -873,6 +876,27 @@ void C2SoftVpxEnc::process(
        return;
    }

    // Header generation is limited to Android V and above, as MediaMuxer did not handle
    // CSD for VP9 correctly in Android U and before.
    if (isAtLeastV() && !mHeaderGenerated) {
        vpx_fixed_buf_t* codec_private_data = vpx_codec_get_global_headers(mCodecContext);
        if (codec_private_data) {
            std::unique_ptr<C2StreamInitDataInfo::output> csd =
                    C2StreamInitDataInfo::output::AllocUnique(codec_private_data->sz, 0u);
            if (!csd) {
                ALOGE("CSD allocation failed");
                mSignalledError = true;
                work->result = C2_NO_MEMORY;
                work->workletsProcessed = 1u;
                return;
            }
            memcpy(csd->m.value, codec_private_data->buf, codec_private_data->sz);
            work->worklets.front()->output.configUpdate.push_back(std::move(csd));
            ALOGV("CSD Produced of size %zu bytes", codec_private_data->sz);
        }
        mHeaderGenerated = true;
    }

    const C2ConstGraphicBlock inBuffer =
        inputBuffer->data().graphicBlocks().front();
    if (inBuffer.width() < mSize->width ||
+3 −0
Original line number Diff line number Diff line
@@ -207,6 +207,9 @@ struct C2SoftVpxEnc : public SimpleC2Component {
     // Signalled EOS
     bool mSignalledOutputEos;

     // Header generated
     bool mHeaderGenerated;

     // Signalled Error
     bool mSignalledError;

+22 −7
Original line number Diff line number Diff line
@@ -125,10 +125,18 @@ ScopedAStatus VirtualCameraTestInstance::onStreamConfigured(
  ALOGV("%s: streamId %d, %dx%d pixFmt=%s", __func__, streamId, width, height,
        toString(pixelFormat).c_str());

  std::lock_guard<std::mutex> lock(mLock);
  mRenderer = std::make_shared<TestPatternRenderer>(
  auto renderer = std::make_shared<TestPatternRenderer>(
      nativeWindowFromSurface(surface), mFps);
  mRenderer->start();

  std::lock_guard<std::mutex> lock(mLock);
  if (mInputRenderers.try_emplace(streamId, renderer).second) {
    renderer->start();
  } else {
    ALOGE(
        "%s: Input stream with id %d is already active, ignoring "
        "onStreamConfigured call",
        __func__, streamId);
  }

  return ScopedAStatus::ok();
}
@@ -141,10 +149,17 @@ ScopedAStatus VirtualCameraTestInstance::onProcessCaptureRequest(
ScopedAStatus VirtualCameraTestInstance::onStreamClosed(const int32_t streamId) {
  ALOGV("%s: streamId %d", __func__, streamId);

  std::shared_ptr<TestPatternRenderer> renderer;
  {
    std::lock_guard<std::mutex> lock(mLock);
  if (mRenderer != nullptr) {
    mRenderer->stop();
    mRenderer.reset();
    auto it = mInputRenderers.find(streamId);
    if (it != mInputRenderers.end()) {
      renderer = std::move(it->second);
      mInputRenderers.erase(it);
    }
  }
  if (renderer != nullptr) {
    renderer->stop();
  }
  return ScopedAStatus::ok();
}
+5 −2
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
#define ANDROID_COMPANION_VIRTUALCAMERA_VIRTUALCAMERATESTINSTANCE_H

#include <atomic>
#include <condition_variable>
#include <map>
#include <memory>
#include <thread>

@@ -80,7 +80,10 @@ class VirtualCameraTestInstance
  const int mFps;

  std::mutex mLock;
  std::shared_ptr<TestPatternRenderer> mRenderer GUARDED_BY(mLock);
  // Map maintaining streamId -> TestPatternRenderer mapping for active
  // input streams.
  std::map<int, std::shared_ptr<TestPatternRenderer>> mInputRenderers
      GUARDED_BY(mLock);
};

}  // namespace virtualcamera