Merge "Fix VideoRenderQualityTracker_test after default is disabled" into main
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index 870ebdf..c110f05 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -2991,12 +2991,6 @@
ALOGE("retrying start: failed to reset codec");
break;
}
- sp<AMessage> response;
- err = PostAndAwaitResponse(mConfigureMsg, &response);
- if (err != OK) {
- ALOGE("retrying start: failed to configure codec");
- break;
- }
if (callback != nullptr) {
err = setCallback(callback);
if (err != OK) {
@@ -3005,6 +2999,12 @@
}
ALOGD("succeed to set callback for reclaim");
}
+ sp<AMessage> response;
+ err = PostAndAwaitResponse(mConfigureMsg, &response);
+ if (err != OK) {
+ ALOGE("retrying start: failed to configure codec");
+ break;
+ }
}
// Keep callback message after the first iteration if necessary.
diff --git a/media/libstagefright/SurfaceUtils.cpp b/media/libstagefright/SurfaceUtils.cpp
index 291b892..827052d 100644
--- a/media/libstagefright/SurfaceUtils.cpp
+++ b/media/libstagefright/SurfaceUtils.cpp
@@ -225,6 +225,13 @@
return err;
};
+ // We need to set sidebandStream to nullptr before pushing blank buffers
+ err = native_window_set_sideband_stream(nativeWindow, nullptr);
+ if (err != NO_ERROR) {
+ ALOGE("error setting sidebandStream to nullptr: %s (%d)", strerror(-err), -err);
+ return err;
+ }
+
// We need to reconnect to the ANativeWindow as a CPU client to ensure that
// no frames get dropped by SurfaceFlinger assuming that these are video
// frames.
diff --git a/media/libstagefright/httplive/fuzzer/Android.bp b/media/libstagefright/httplive/fuzzer/Android.bp
index dd49714..cb2f4ee 100644
--- a/media/libstagefright/httplive/fuzzer/Android.bp
+++ b/media/libstagefright/httplive/fuzzer/Android.bp
@@ -48,6 +48,7 @@
"libstagefright_httplive_headers",
],
shared_libs: [
+ "libbase",
"libcrypto",
"libstagefright_foundation",
"libhidlbase",
diff --git a/media/module/mpeg2ts/ATSParser.cpp b/media/module/mpeg2ts/ATSParser.cpp
index 6aeea3b..86187bd 100644
--- a/media/module/mpeg2ts/ATSParser.cpp
+++ b/media/module/mpeg2ts/ATSParser.cpp
@@ -23,8 +23,8 @@
#include "ESQueue.h"
#include <android/hardware/cas/native/1.0/IDescrambler.h>
-#include <android/hidl/allocator/1.0/IAllocator.h>
#include <android/hidl/memory/1.0/IMemory.h>
+#include <cutils/ashmem.h>
#include <cutils/native_handle.h>
#include <hidlmemory/mapping.h>
#include <media/cas/DescramblerAPI.h>
@@ -46,12 +46,12 @@
#include <inttypes.h>
namespace android {
+using hardware::hidl_handle;
using hardware::hidl_string;
using hardware::hidl_vec;
using hardware::hidl_memory;
using namespace hardware::cas::V1_0;
using namespace hardware::cas::native::V1_0;
-typedef hidl::allocator::V1_0::IAllocator TAllocator;
typedef hidl::memory::V1_0::IMemory TMemory;
// I want the expression "y" evaluated even if verbose logging is off.
@@ -210,7 +210,6 @@
bool mSampleEncrypted;
sp<AMessage> mSampleAesKeyItem;
sp<TMemory> mHidlMemory;
- sp<TAllocator> mHidlAllocator;
hardware::cas::native::V1_0::SharedBuffer mDescramblerSrcBuffer;
sp<ABuffer> mDescrambledBuffer;
List<SubSampleInfo> mSubSamples;
@@ -1006,34 +1005,29 @@
sp<ABuffer> newBuffer, newScrambledBuffer;
sp<TMemory> newMem;
if (mScrambled) {
- if (mHidlAllocator == nullptr) {
- mHidlAllocator = TAllocator::getService("ashmem");
- if (mHidlAllocator == nullptr) {
- ALOGE("[stream %d] can't get hidl allocator", mElementaryPID);
- return false;
+ int fd = ashmem_create_region("mediaATS", neededSize);
+ if (fd < 0) {
+ ALOGE("[stream %d] create_ashmem_region failed for size %zu. FD returned: %d",
+ mElementaryPID, neededSize, fd);
+ return false;
+ }
+
+ native_handle_t* handle = native_handle_create(1 /*numFds*/, 0/*numInts*/);
+ if (handle == nullptr) {
+ ALOGE("[stream %d] failed to create a native_handle_t", mElementaryPID);
+ if (close(fd)) {
+ ALOGE("[stream %d] failed to close ashmem fd. errno: %s", mElementaryPID,
+ strerror(errno));
}
- }
- hidl_memory hidlMemToken;
- bool success;
- auto transStatus = mHidlAllocator->allocate(
- neededSize,
- [&success, &hidlMemToken](
- bool s,
- hidl_memory const& m) {
- success = s;
- hidlMemToken = m;
- });
-
- if (!transStatus.isOk()) {
- ALOGE("[stream %d] hidl allocator failed at the transport: %s",
- mElementaryPID, transStatus.description().c_str());
return false;
}
- if (!success) {
- ALOGE("[stream %d] hidl allocator failed", mElementaryPID);
- return false;
- }
+
+ handle->data[0] = fd;
+ hidl_handle memHandle;
+ memHandle.setTo(handle, true /*shouldOwn*/);
+ hidl_memory hidlMemToken("ashmem", memHandle, neededSize);
+
newMem = mapMemory(hidlMemToken);
if (newMem == nullptr || newMem->getPointer() == nullptr) {
ALOGE("[stream %d] hidl failed to map memory", mElementaryPID);
diff --git a/media/module/mpeg2ts/Android.bp b/media/module/mpeg2ts/Android.bp
index bf762c6..c710ffb 100644
--- a/media/module/mpeg2ts/Android.bp
+++ b/media/module/mpeg2ts/Android.bp
@@ -44,7 +44,6 @@
"libhidlmemory",
"android.hardware.cas.native@1.0",
"android.hidl.memory@1.0",
- "android.hidl.allocator@1.0",
],
header_libs: [
diff --git a/media/module/mpeg2ts/test/Android.bp b/media/module/mpeg2ts/test/Android.bp
index 34a8d3e..cccefac 100644
--- a/media/module/mpeg2ts/test/Android.bp
+++ b/media/module/mpeg2ts/test/Android.bp
@@ -37,9 +37,8 @@
shared_libs: [
"android.hardware.cas@1.0",
"android.hardware.cas.native@1.0",
- "android.hidl.token@1.0-utils",
- "android.hidl.allocator@1.0",
"libcrypto",
+ "libcutils",
"libhidlbase",
"libhidlmemory",
"liblog",