Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 681f909b authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 10853649 from d8b7e361 to udc-qpr1-release

Change-Id: I8ee8e18f43fc076890953aa13a508d2a12520fdf
parents 0c84b7e0 d8b7e361
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ status_t EffectHalAidl::process() {
              mConversion->isBypassing()
                      ? "bypassing"
                      : aidl::android::hardware::audio::effect::toString(state).c_str());
        return OK;
        return -ENODATA;
    }

    auto statusQ = mConversion->getStatusMQ();
+52 −0
Original line number Diff line number Diff line
@@ -664,6 +664,7 @@ enum {
    kWhatOutputBuffersChanged = 'outC',
    kWhatFirstTunnelFrameReady = 'ftfR',
    kWhatPollForRenderedBuffers = 'plrb',
    kWhatMetricsUpdated      = 'mtru',
};

class CryptoAsyncCallback : public CryptoAsync::CryptoAsyncCallback {
@@ -761,6 +762,7 @@ public:
    virtual void onOutputFramesRendered(const std::list<RenderedFrameInfo> &done) override;
    virtual void onOutputBuffersChanged() override;
    virtual void onFirstTunnelFrameReady() override;
    virtual void onMetricsUpdated(const sp<AMessage> &updatedMetrics) override;
private:
    const sp<AMessage> mNotify;
};
@@ -887,6 +889,13 @@ void CodecCallback::onFirstTunnelFrameReady() {
    notify->post();
}

void CodecCallback::onMetricsUpdated(const sp<AMessage> &updatedMetrics) {
    sp<AMessage> notify(mNotify->dup());
    notify->setInt32("what", kWhatMetricsUpdated);
    notify->setMessage("updated-metrics", updatedMetrics);
    notify->post();
}

static MediaResourceSubType toMediaResourceSubType(MediaCodec::Domain domain) {
    switch (domain) {
        case MediaCodec::DOMAIN_VIDEO: return MediaResourceSubType::kVideoCodec;
@@ -4257,6 +4266,49 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
                    break;
                }

                case kWhatMetricsUpdated:
                {
                    sp<AMessage> updatedMetrics;
                    CHECK(msg->findMessage("updated-metrics", &updatedMetrics));

                    size_t numEntries = updatedMetrics->countEntries();
                    AMessage::Type type;
                    for (size_t i = 0; i < numEntries; ++i) {
                        const char *name = updatedMetrics->getEntryNameAt(i, &type);
                        AMessage::ItemData itemData = updatedMetrics->getEntryAt(i);
                        switch (type) {
                            case AMessage::kTypeInt32: {
                                int32_t metricValue;
                                itemData.find(&metricValue);
                                mediametrics_setInt32(mMetricsHandle, name, metricValue);
                                break;
                            }
                            case AMessage::kTypeInt64: {
                                int64_t metricValue;
                                itemData.find(&metricValue);
                                mediametrics_setInt64(mMetricsHandle, name, metricValue);
                                break;
                            }
                            case AMessage::kTypeDouble: {
                                double metricValue;
                                itemData.find(&metricValue);
                                mediametrics_setDouble(mMetricsHandle, name, metricValue);
                                break;
                            }
                            case AMessage::kTypeString: {
                                AString metricValue;
                                itemData.find(&metricValue);
                                mediametrics_setCString(mMetricsHandle, name, metricValue.c_str());
                                break;
                            }
                            // ToDo: add support for other types
                            default:
                                ALOGW("Updated metrics type not supported.");
                        }
                    }
                    break;
                }

                case kWhatEOS:
                {
                    // We already notify the client of this by using the
+6 −0
Original line number Diff line number Diff line
@@ -182,6 +182,12 @@ struct CodecBase : public AHandler, /* static */ ColorUtils {
         * Notify MediaCodec that the first tunnel frame is ready.
         */
        virtual void onFirstTunnelFrameReady() = 0;
        /**
         * Notify MediaCodec that there are metrics to be updated.
         *
         * @param updatedMetrics metrics need to be updated.
         */
        virtual void onMetricsUpdated(const sp<AMessage> &updatedMetrics) = 0;
    };

    /**