Merge "av: change return value if effect is not processing" into main
diff --git a/media/codec2/sfplugin/CCodecBufferChannel.cpp b/media/codec2/sfplugin/CCodecBufferChannel.cpp
index 385912a..22c4aee 100644
--- a/media/codec2/sfplugin/CCodecBufferChannel.cpp
+++ b/media/codec2/sfplugin/CCodecBufferChannel.cpp
@@ -2128,8 +2128,15 @@
if (notifyClient && !buffer && !flags) {
if (mTunneled && drop && outputFormat) {
- ALOGV("[%s] onWorkDone: Keep tunneled, drop frame with format change (%lld)",
- mName, work->input.ordinal.frameIndex.peekull());
+ if (mOutputFormat != outputFormat) {
+ ALOGV("[%s] onWorkDone: Keep tunneled, drop frame with format change (%lld)",
+ mName, work->input.ordinal.frameIndex.peekull());
+ mOutputFormat = outputFormat;
+ } else {
+ ALOGV("[%s] onWorkDone: Not reporting output buffer without format change (%lld)",
+ mName, work->input.ordinal.frameIndex.peekull());
+ notifyClient = false;
+ }
} else {
ALOGV("[%s] onWorkDone: Not reporting output buffer (%lld)",
mName, work->input.ordinal.frameIndex.peekull());
diff --git a/media/codec2/sfplugin/CCodecBufferChannel.h b/media/codec2/sfplugin/CCodecBufferChannel.h
index 763eae9..a37c383 100644
--- a/media/codec2/sfplugin/CCodecBufferChannel.h
+++ b/media/codec2/sfplugin/CCodecBufferChannel.h
@@ -301,6 +301,7 @@
std::shared_ptr<C2BlockPool> mInputAllocator;
QueueSync mQueueSync;
std::vector<std::unique_ptr<C2Param>> mParamsToBeSet;
+ sp<AMessage> mOutputFormat;
struct Input {
Input();
diff --git a/media/libaudiohal/impl/EffectConversionHelperAidl.cpp b/media/libaudiohal/impl/EffectConversionHelperAidl.cpp
index ae73262..196b432 100644
--- a/media/libaudiohal/impl/EffectConversionHelperAidl.cpp
+++ b/media/libaudiohal/impl/EffectConversionHelperAidl.cpp
@@ -255,37 +255,37 @@
status_t EffectConversionHelperAidl::handleReset(uint32_t cmdSize __unused,
const void* pCmdData __unused, uint32_t* replySize,
void* pReplyData) {
- if (!replySize || !pReplyData) {
+ if (!replySize || *replySize != sizeof(int) || !pReplyData) {
ALOGE("%s parameter invalid, replySize %s pReplyData %p", __func__,
numericPointerToString(replySize).c_str(), pReplyData);
return BAD_VALUE;
}
- return statusTFromBinderStatus(mEffect->command(CommandId::RESET));
+ return *(int *)pReplyData = statusTFromBinderStatus(mEffect->command(CommandId::RESET));
}
status_t EffectConversionHelperAidl::handleEnable(uint32_t cmdSize __unused,
const void* pCmdData __unused,
uint32_t* replySize, void* pReplyData) {
- if (!replySize || !pReplyData) {
+ if (!replySize || *replySize != sizeof(int) || !pReplyData) {
ALOGE("%s parameter invalid, replySize %s pReplyData %p", __func__,
numericPointerToString(replySize).c_str(), pReplyData);
return BAD_VALUE;
}
- return statusTFromBinderStatus(mEffect->command(CommandId::START));
+ return *(int *)pReplyData = statusTFromBinderStatus(mEffect->command(CommandId::START));
}
status_t EffectConversionHelperAidl::handleDisable(uint32_t cmdSize __unused,
const void* pCmdData __unused,
uint32_t* replySize, void* pReplyData) {
- if (!replySize || !pReplyData) {
+ if (!replySize || *replySize != sizeof(int) || !pReplyData) {
ALOGE("%s parameter invalid, replySize %s pReplyData %p", __func__,
numericPointerToString(replySize).c_str(), pReplyData);
return BAD_VALUE;
}
- return statusTFromBinderStatus(mEffect->command(CommandId::STOP));
+ return *(int *)pReplyData = statusTFromBinderStatus(mEffect->command(CommandId::STOP));
}
status_t EffectConversionHelperAidl::handleSetAudioSource(uint32_t cmdSize, const void* pCmdData,
diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp
index bbfe763..dfe3157 100644
--- a/services/audioflinger/Effects.cpp
+++ b/services/audioflinger/Effects.cpp
@@ -825,7 +825,10 @@
if (mStatus != NO_ERROR || mEffectInterface == 0) {
return;
}
- mEffectInterface->command(EFFECT_CMD_RESET, 0, NULL, 0, NULL);
+
+ int reply = 0;
+ uint32_t replySize = sizeof(reply);
+ mEffectInterface->command(EFFECT_CMD_RESET, 0, NULL, &replySize, &reply);
}
status_t AudioFlinger::EffectModule::configure()