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

Commit fd79e632 authored by Amy Zhang's avatar Amy Zhang Committed by Android (Google) Code Review
Browse files

Merge "Add startId in Filter Event to work with filter reconfiguration"

parents ab1e0ab9 ff82d7ca
Loading
Loading
Loading
Loading
+2 −0
Original line number 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
 * interface returned from the @1.0::IDemux openFilter into a v1.1 IFiler
 * 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 {
    /**
+2 −1
Original line number Diff line number Diff line
@@ -25,7 +25,8 @@ interface IFilterCallback extends @1.0::IFilterCallback {
     * Notify the client that a new filter event happened.
     *
     * @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);
};
+10 −2
Original line number Diff line number Diff line
@@ -131,6 +131,7 @@ Return<Result> Filter::configure(const DemuxFilterSettings& settings) {
            break;
    }

    mConfigured = true;
    return Result::SUCCESS;
}

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

    mFilterThreadRunning = false;

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

    return Result::SUCCESS;
}

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

        // After successfully write, send a callback and wait for the read to be done
        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);
            mFilterEventExt.events.resize(0);
        } else if (mCallback != nullptr) {
+3 −0
Original line number Diff line number Diff line
@@ -235,6 +235,9 @@ class Filter : public V1_1::IFilter {

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

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

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

        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