69 lines
2.5 KiB
Diff
69 lines
2.5 KiB
Diff
From 3e4bfa2b9f1516d70f117c16abfa7bb7b085faf5 Mon Sep 17 00:00:00 2001
|
|
From: Wonsik Kim <wonsik@google.com>
|
|
Date: Thu, 12 Nov 2020 11:14:42 -0800
|
|
Subject: [PATCH 25/30] C2OMXNode: read delay from component to determine
|
|
buffer count
|
|
|
|
Bug: 169398817
|
|
Test: atest CtsMediaTestCases -- --module-arg CtsMediaTestCases:size:small
|
|
Test: atest CtsMediaTestCases:VideoEncoderTest
|
|
Change-Id: I76a3411addd83108d2da2c8f74df55acab03a365
|
|
(cherry picked from commit 414eb15c3c6cd7e1677245508fd23899bef01feb)
|
|
---
|
|
media/codec2/sfplugin/C2OMXNode.cpp | 21 ++++++++++++++++++++-
|
|
1 file changed, 20 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/media/codec2/sfplugin/C2OMXNode.cpp b/media/codec2/sfplugin/C2OMXNode.cpp
|
|
index c7588e9a51..dd1f4858a5 100644
|
|
--- a/media/codec2/sfplugin/C2OMXNode.cpp
|
|
+++ b/media/codec2/sfplugin/C2OMXNode.cpp
|
|
@@ -25,6 +25,7 @@
|
|
#include <C2AllocatorGralloc.h>
|
|
#include <C2BlockInternal.h>
|
|
#include <C2Component.h>
|
|
+#include <C2Config.h>
|
|
#include <C2PlatformSupport.h>
|
|
|
|
#include <OMX_Component.h>
|
|
@@ -44,6 +45,8 @@ namespace android {
|
|
|
|
namespace {
|
|
|
|
+constexpr OMX_U32 kPortIndexInput = 0;
|
|
+
|
|
class Buffer2D : public C2Buffer {
|
|
public:
|
|
explicit Buffer2D(C2ConstGraphicBlock block) : C2Buffer({ block }) {}
|
|
@@ -200,11 +203,27 @@ status_t C2OMXNode::getParameter(OMX_INDEXTYPE index, void *params, size_t size)
|
|
return BAD_VALUE;
|
|
}
|
|
OMX_PARAM_PORTDEFINITIONTYPE *pDef = (OMX_PARAM_PORTDEFINITIONTYPE *)params;
|
|
- // TODO: read these from intf()
|
|
+ if (pDef->nPortIndex != kPortIndexInput) {
|
|
+ break;
|
|
+ }
|
|
+
|
|
pDef->nBufferCountActual = 16;
|
|
+
|
|
+ std::shared_ptr<Codec2Client::Component> comp = mComp.lock();
|
|
+ C2PortActualDelayTuning::input inputDelay(0);
|
|
+ C2ActualPipelineDelayTuning pipelineDelay(0);
|
|
+ c2_status_t c2err = comp->query(
|
|
+ {&inputDelay, &pipelineDelay}, {}, C2_DONT_BLOCK, nullptr);
|
|
+ if (c2err == C2_OK || c2err == C2_BAD_INDEX) {
|
|
+ pDef->nBufferCountActual = 4;
|
|
+ pDef->nBufferCountActual += (inputDelay ? inputDelay.value : 0u);
|
|
+ pDef->nBufferCountActual += (pipelineDelay ? pipelineDelay.value : 0u);
|
|
+ }
|
|
+
|
|
pDef->eDomain = OMX_PortDomainVideo;
|
|
pDef->format.video.nFrameWidth = mWidth;
|
|
pDef->format.video.nFrameHeight = mHeight;
|
|
+ pDef->format.video.eColorFormat = OMX_COLOR_FormatAndroidOpaque;
|
|
err = OK;
|
|
break;
|
|
}
|
|
--
|
|
2.25.1
|
|
|