CCodec: properly signal output format changed

MediaCodec signals a format change if the format pointer changes.

Test: cts-tradefed run singleCommand cts -m CtsMediaTestCases -t android.media.cts.DecoderTest\#testDecodeHeAacV2M4a
Bug: 80085975
Change-Id: I4b3afb7c51da4701fc35901a8342ba5d55570ef8
(cherry picked from commit 472c1df1cc04b7c31f768ab34e699a4c79dfb9ad)
diff --git a/media/sfplugin/CCodecConfig.cpp b/media/sfplugin/CCodecConfig.cpp
index f306826..8b53a51 100644
--- a/media/sfplugin/CCodecConfig.cpp
+++ b/media/sfplugin/CCodecConfig.cpp
@@ -679,19 +679,24 @@
     bool changed = false;
     if (domain & mInputDomain) {
         sp<AMessage> oldFormat = mInputFormat;
+        mInputFormat = mInputFormat->dup(); // trigger format changed
         mInputFormat->extend(getSdkFormatForDomain(reflected, mInputDomain));
         if (mInputFormat->countEntries() != oldFormat->countEntries()
                 || mInputFormat->changesFrom(oldFormat)->countEntries() > 0) {
             changed = true;
+        } else {
+            mInputFormat = oldFormat; // no change
         }
     }
     if (domain & mOutputDomain) {
         sp<AMessage> oldFormat = mOutputFormat;
+        mOutputFormat = mOutputFormat->dup(); // trigger output format changed
         mOutputFormat->extend(getSdkFormatForDomain(reflected, mOutputDomain));
-        if (!changed &&
-                (mOutputFormat->countEntries() != oldFormat->countEntries()
-                        || mOutputFormat->changesFrom(oldFormat)->countEntries() > 0)) {
+        if (mOutputFormat->countEntries() != oldFormat->countEntries()
+                || mOutputFormat->changesFrom(oldFormat)->countEntries() > 0) {
             changed = true;
+        } else {
+            mOutputFormat = oldFormat; // no change
         }
     }
     ALOGV_IF(changed, "format(s) changed");