aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--system/codecs/c2/decoders/hevcdec/C2GoldfishHevcDec.cpp10
-rw-r--r--system/codecs/c2/decoders/hevcdec/GoldfishHevcHelper.cpp6
-rw-r--r--system/codecs/c2/decoders/hevcdec/GoldfishHevcHelper.h6
-rw-r--r--system/vulkan_enc/ResourceTracker.cpp18
4 files changed, 29 insertions, 11 deletions
diff --git a/system/codecs/c2/decoders/hevcdec/C2GoldfishHevcDec.cpp b/system/codecs/c2/decoders/hevcdec/C2GoldfishHevcDec.cpp
index 990f4c2d..13e9515d 100644
--- a/system/codecs/c2/decoders/hevcdec/C2GoldfishHevcDec.cpp
+++ b/system/codecs/c2/decoders/hevcdec/C2GoldfishHevcDec.cpp
@@ -914,7 +914,15 @@ void C2GoldfishHevcDec::process(const std::unique_ptr<C2Work> &work,
bool whChanged = false;
if (GoldfishHevcHelper::isVpsFrame(mInPBuffer, mInPBufferSize)) {
mHevcHelper.reset(new GoldfishHevcHelper(mWidth, mHeight));
- whChanged = mHevcHelper->decodeHeader(mInPBuffer, mInPBufferSize);
+ bool headerStatus = true;
+ whChanged = mHevcHelper->decodeHeader(
+ mInPBuffer, mInPBufferSize, headerStatus);
+ if (!headerStatus) {
+ mSignalledError = true;
+ work->workletsProcessed = 1u;
+ work->result = C2_CORRUPTED;
+ return;
+ }
if (whChanged) {
DDD("w changed from old %d to new %d\n", mWidth, mHevcHelper->getWidth());
DDD("h changed from old %d to new %d\n", mHeight, mHevcHelper->getHeight());
diff --git a/system/codecs/c2/decoders/hevcdec/GoldfishHevcHelper.cpp b/system/codecs/c2/decoders/hevcdec/GoldfishHevcHelper.cpp
index 1b93a0d9..d3117a78 100644
--- a/system/codecs/c2/decoders/hevcdec/GoldfishHevcHelper.cpp
+++ b/system/codecs/c2/decoders/hevcdec/GoldfishHevcHelper.cpp
@@ -188,7 +188,9 @@ bool GoldfishHevcHelper::isVpsFrame(const uint8_t* frame, int inSize) {
}
}
-bool GoldfishHevcHelper::decodeHeader(const uint8_t *frame, int inSize) {
+bool GoldfishHevcHelper::decodeHeader(const uint8_t *frame, int inSize,
+ bool &helperstatus) {
+ helperstatus = true;
// should we check the header for vps/sps/pps frame ? otherwise
// there is no point calling decoder
if (!isVpsFrame(frame, inSize)) {
@@ -220,6 +222,8 @@ bool GoldfishHevcHelper::decodeHeader(const uint8_t *frame, int inSize) {
ALOGE("failed to call decoder function for header\n");
ALOGE("error in %s: 0x%x", __func__,
ps_decode_op->u4_error_code);
+ helperstatus = false;
+ return false;
}
if (IVD_RES_CHANGED == (ps_decode_op->u4_error_code & IVD_ERROR_MASK)) {
diff --git a/system/codecs/c2/decoders/hevcdec/GoldfishHevcHelper.h b/system/codecs/c2/decoders/hevcdec/GoldfishHevcHelper.h
index 09de8301..36a496b7 100644
--- a/system/codecs/c2/decoders/hevcdec/GoldfishHevcHelper.h
+++ b/system/codecs/c2/decoders/hevcdec/GoldfishHevcHelper.h
@@ -37,9 +37,9 @@ class GoldfishHevcHelper {
public:
// return true if decoding finds out w/h changed;
// otherwise false
- bool decodeHeader(const uint8_t *frame, int inSize);
- int getWidth() const { return mWidth; }
- int getHeight() const { return mHeight; }
+ bool decodeHeader(const uint8_t *frame, int inSize, bool &status);
+ int getWidth() const { return mWidth; }
+ int getHeight() const { return mHeight; }
private:
void createDecoder();
diff --git a/system/vulkan_enc/ResourceTracker.cpp b/system/vulkan_enc/ResourceTracker.cpp
index 6cc7010d..c9a1606c 100644
--- a/system/vulkan_enc/ResourceTracker.cpp
+++ b/system/vulkan_enc/ResourceTracker.cpp
@@ -6690,7 +6690,7 @@ public:
}
#endif
#if defined(VK_USE_PLATFORM_ANDROID_KHR) || defined(__linux__)
- if (semInfo.syncFd >= 0) {
+ if (semInfo.syncFd != 0) {
pre_signal_sync_fds.push_back(semInfo.syncFd);
pre_signal_semaphores.push_back(pSubmits[i].pWaitSemaphores[j]);
}
@@ -6755,13 +6755,19 @@ public:
#endif
#if defined(VK_USE_PLATFORM_ANDROID_KHR) || defined(__linux__)
for (auto fd : pre_signal_sync_fds) {
- preSignalTasks.push_back([fd] {
- sync_wait(fd, 3000);
- });
+ // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkImportSemaphoreFdInfoKHR.html
+ // fd == -1 is treated as already signaled
+ if (fd != -1) {
+ preSignalTasks.push_back([fd] {
+ sync_wait(fd, 3000);
+ });
+ }
}
#endif
- auto waitGroupHandle = mWorkPool.schedule(preSignalTasks);
- mWorkPool.waitAll(waitGroupHandle);
+ if (!preSignalTasks.empty()) {
+ auto waitGroupHandle = mWorkPool.schedule(preSignalTasks);
+ mWorkPool.waitAll(waitGroupHandle);
+ }
VkSubmitInfo submit_info = {
.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,