Revert "Codec2Client: use IProducerListener for Codec2 hidl1.2"

This reverts commit 7fefd5695cc24ebe9b9fb03be86a159682382a66.

Reason for revert: breakage bug b/312580991

Change-Id: Ibbf9d085afb664fbdfcc4a435d93ff89ba06acce
diff --git a/media/codec2/hal/client/client.cpp b/media/codec2/hal/client/client.cpp
index e8e7cb2..597852a 100644
--- a/media/codec2/hal/client/client.cpp
+++ b/media/codec2/hal/client/client.cpp
@@ -2372,7 +2372,7 @@
 
 void Codec2Client::Component::onBufferReleasedFromOutputSurface(
         uint32_t generation) {
-    mOutputBufferQueue->onBufferReleased(generation);
+    (void) generation;
 }
 
 c2_status_t Codec2Client::Component::connectToInputSurface(
diff --git a/media/codec2/hal/client/include/codec2/hidl/output.h b/media/codec2/hal/client/include/codec2/hidl/output.h
index fda34a8..2e89c3b 100644
--- a/media/codec2/hal/client/include/codec2/hidl/output.h
+++ b/media/codec2/hal/client/include/codec2/hidl/output.h
@@ -65,10 +65,6 @@
             const BnGraphicBufferProducer::QueueBufferInput& input,
             BnGraphicBufferProducer::QueueBufferOutput* output);
 
-    // Nofify a buffer is released from the output surface. If HAL ver is 1.2
-    // update the number of dequeueable/allocatable buffers.
-    void onBufferReleased(uint32_t generation);
-
     // Retrieve frame event history from the output surface.
     void pollForRenderedFrames(FrameEventHistoryDelta* delta);
 
diff --git a/media/codec2/hal/client/output.cpp b/media/codec2/hal/client/output.cpp
index 5a4ed95..7f4f86b 100644
--- a/media/codec2/hal/client/output.cpp
+++ b/media/codec2/hal/client/output.cpp
@@ -441,11 +441,9 @@
             status = outputIgbp->queueBuffer(static_cast<int>(bqSlot),
                                          input, output);
             if (status == OK) {
-                if (output->bufferReplaced) {
-                    syncVar->lock();
-                    syncVar->notifyQueuedLocked();
-                    syncVar->unlock();
-                }
+                syncVar->lock();
+                syncVar->notifyQueuedLocked();
+                syncVar->unlock();
             }
         } else {
             status = outputIgbp->queueBuffer(static_cast<int>(bqSlot),
@@ -498,11 +496,9 @@
         status = outputIgbp->queueBuffer(static_cast<int>(bqSlot),
                                                   input, output);
         if (status == OK) {
-            if (output->bufferReplaced) {
-                syncVar->lock();
-                syncVar->notifyQueuedLocked();
-                syncVar->unlock();
-            }
+            syncVar->lock();
+            syncVar->notifyQueuedLocked();
+            syncVar->unlock();
         }
     } else {
         status = outputIgbp->queueBuffer(static_cast<int>(bqSlot),
@@ -518,27 +514,6 @@
     return OK;
 }
 
-void OutputBufferQueue::onBufferReleased(uint32_t generation) {
-    std::shared_ptr<C2SurfaceSyncMemory> syncMem;
-    mMutex.lock();
-    if (mStopped) {
-        return;
-    }
-    sp<IGraphicBufferProducer> outputIgbp = mIgbp;
-    uint32_t outputGeneration = mGeneration;
-    syncMem = mSyncMem;
-    mMutex.unlock();
-
-    if (outputIgbp && generation == outputGeneration) {
-        auto syncVar = syncMem ? syncMem->mem() : nullptr;
-        if (syncVar) {
-            syncVar->lock();
-            syncVar->notifyQueuedLocked();
-            syncVar->unlock();
-        }
-    }
-}
-
 void OutputBufferQueue::pollForRenderedFrames(FrameEventHistoryDelta* delta) {
     if (mIgbp) {
         mIgbp->getFrameTimestamps(delta);