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

Commit c50ddb0d authored by Houxiang Dai's avatar Houxiang Dai Committed by Cherrypicker Worker
Browse files

Fix no tunning param case

If tuning param is NULL, no need setParameters in MediaCodec any more

Test:
DTV playback OK

Bug: 234105296
Change-Id: Ib0ab1f2996be57e2adbbabf04a8b4cd091abf57a
(cherry picked from commit 560fa767)
Merged-In: Ib0ab1f2996be57e2adbbabf04a8b4cd091abf57a
parent ad44d135
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -2622,7 +2622,9 @@ status_t MediaCodec::queueBuffer(
    msg->setObject("c2buffer", obj);
    msg->setInt64("timeUs", presentationTimeUs);
    msg->setInt32("flags", flags);
    if (tunings && tunings->countEntries() > 0) {
        msg->setMessage("tunings", tunings);
    }
    msg->setPointer("errorDetailMsg", errorDetailMsg);

    sp<AMessage> response;
@@ -2664,7 +2666,9 @@ status_t MediaCodec::queueEncryptedBuffer(
    msg->setInt32("skipBlocks", pattern.mSkipBlocks);
    msg->setInt64("timeUs", presentationTimeUs);
    msg->setInt32("flags", flags);
    if (tunings && tunings->countEntries() > 0) {
        msg->setMessage("tunings", tunings);
    }
    msg->setPointer("errorDetailMsg", errorDetailMsg);

    sp<AMessage> response;
@@ -4864,12 +4868,10 @@ status_t MediaCodec::queueCSDInputBuffer(size_t bufferIndex) {
        sp<WrapperObject<std::shared_ptr<C2Buffer>>> obj{
            new WrapperObject<std::shared_ptr<C2Buffer>>{c2Buffer}};
        msg->setObject("c2buffer", obj);
        msg->setMessage("tunings", new AMessage);
    } else if (memory) {
        sp<WrapperObject<sp<hardware::HidlMemory>>> obj{
            new WrapperObject<sp<hardware::HidlMemory>>{memory}};
        msg->setObject("memory", obj);
        msg->setMessage("tunings", new AMessage);
    }

    return onQueueInputBuffer(msg);
@@ -5049,9 +5051,10 @@ status_t MediaCodec::onQueueInputBuffer(const sp<AMessage> &msg) {
    sp<MediaCodecBuffer> buffer = info->mData;

    if (c2Buffer || memory) {
        sp<AMessage> tunings;
        CHECK(msg->findMessage("tunings", &tunings));
        sp<AMessage> tunings = NULL;
        if (msg->findMessage("tunings", &tunings) && tunings != NULL) {
            onSetParameters(tunings);
        }

        status_t err = OK;
        if (c2Buffer) {