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

Commit ff82d7ca authored by Amy Zhang's avatar Amy Zhang
Browse files

Add startId in Filter Event to work with filter reconfiguration

Test: atest VtsHalTvTunerV1_1TargetTest
Bug: 172593389
Change-Id: I77e45366b737068aa0aa20c2b384f2e3160c7398
parent 52d9d086
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -26,6 +26,8 @@ import @1.0::Result;
 * To access the v1.1 IFilter APIs, the implementation can cast the IFilter
 * To access the v1.1 IFilter APIs, the implementation can cast the IFilter
 * interface returned from the @1.0::IDemux openFilter into a v1.1 IFiler
 * interface returned from the @1.0::IDemux openFilter into a v1.1 IFiler
 * using V1_1::IFilter::castFrom(V1_0::IFilter).
 * using V1_1::IFilter::castFrom(V1_0::IFilter).
 *
 * Note that reconfiguring Filter must happen after the Filter is stopped.
 */
 */
interface IFilter extends @1.0::IFilter {
interface IFilter extends @1.0::IFilter {
    /**
    /**
+2 −1
Original line number Original line Diff line number Diff line
@@ -25,7 +25,8 @@ interface IFilterCallback extends @1.0::IFilterCallback {
     * Notify the client that a new filter event happened.
     * Notify the client that a new filter event happened.
     *
     *
     * @param filterEvent a v1_0 filter event.
     * @param filterEvent a v1_0 filter event.
     * @param filterEventExt a v1_1 extended filter event.
     * @param filterEventExt a v1_1 extended filter event. Send an empty filterEvent along with
     *                       startId or scramblingStatus filterEventExt
     */
     */
    oneway onFilterEvent_1_1(DemuxFilterEvent filterEvent, DemuxFilterEventExt filterEventExt);
    oneway onFilterEvent_1_1(DemuxFilterEvent filterEvent, DemuxFilterEventExt filterEventExt);
};
};
+10 −2
Original line number Original line Diff line number Diff line
@@ -131,6 +131,7 @@ Return<Result> Filter::configure(const DemuxFilterSettings& settings) {
            break;
            break;
    }
    }


    mConfigured = true;
    return Result::SUCCESS;
    return Result::SUCCESS;
}
}


@@ -145,8 +146,6 @@ Return<Result> Filter::stop() {


    mFilterThreadRunning = false;
    mFilterThreadRunning = false;


    std::lock_guard<std::mutex> lock(mFilterThreadLock);

    return Result::SUCCESS;
    return Result::SUCCESS;
}
}


@@ -321,8 +320,17 @@ void Filter::filterThreadLoop() {
            usleep(1000 * 1000);
            usleep(1000 * 1000);
            continue;
            continue;
        }
        }

        // After successfully write, send a callback and wait for the read to be done
        // After successfully write, send a callback and wait for the read to be done
        if (mCallback_1_1 != nullptr) {
        if (mCallback_1_1 != nullptr) {
            if (mConfigured) {
                DemuxFilterEvent emptyEvent;
                V1_1::DemuxFilterEventExt startEvent;
                startEvent.events.resize(1);
                startEvent.events[0].startId(mStartId++);
                mCallback_1_1->onFilterEvent_1_1(emptyEvent, startEvent);
                mConfigured = false;
            }
            mCallback_1_1->onFilterEvent_1_1(mFilterEvent, mFilterEventExt);
            mCallback_1_1->onFilterEvent_1_1(mFilterEvent, mFilterEventExt);
            mFilterEventExt.events.resize(0);
            mFilterEventExt.events.resize(0);
        } else if (mCallback != nullptr) {
        } else if (mCallback != nullptr) {
+3 −0
Original line number Original line Diff line number Diff line
@@ -235,6 +235,9 @@ class Filter : public V1_1::IFilter {


    // Scrambling status to be monitored
    // Scrambling status to be monitored
    uint32_t mStatuses = 0;
    uint32_t mStatuses = 0;

    bool mConfigured = false;
    int mStartId = 0;
};
};


}  // namespace implementation
}  // namespace implementation
+8 −0
Original line number Original line Diff line number Diff line
@@ -161,6 +161,14 @@ struct DemuxFilterEventExt {
        DemuxFilterMmtpRecordEventExt mmtpRecord;
        DemuxFilterMmtpRecordEventExt mmtpRecord;


        ScramblingStatus scramblingStatus;
        ScramblingStatus scramblingStatus;

        /**
         * An unique ID to mark the start point of receiving the valid filter events after
         * reconfiguring the filter. It must be sent at least once in the first event after the
         * filter is restarted. 0 is reserved for the newly opened filter's first start, which is
         * optional for HAL to send.
         */
        uint32_t startId;
    };
    };


    /**
    /**
Loading