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

Commit 08cae816 authored by sadiqsada's avatar sadiqsada Committed by Sadiq Sada
Browse files

Add reference counter for Filter

Filters should start demux reading thread for IPTV when start()
is called and they should PAUSE the thread when stop() is called.
They should only be paused when all associated filters of the
demux are closed. This CL adds reference counters for filters to
track that.

Bug: 288170590
Test: manual
Change-Id: I087175a685a4559918ceaa511971b79e7fcb0a51
parent 52b7f34a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -326,6 +326,8 @@ Filter::~Filter() {
    ALOGV("%s", __FUNCTION__);
    mFilterThreadRunning = true;
    std::vector<DemuxFilterEvent> events;

    mFilterCount += 1;
    // All the filter event callbacks in start are for testing purpose.
    switch (mType.mainType) {
        case DemuxFilterMainType::TS:
@@ -362,6 +364,8 @@ Filter::~Filter() {
::ndk::ScopedAStatus Filter::stop() {
    ALOGV("%s", __FUNCTION__);

    mFilterCount -= 1;

    mFilterThreadRunning = false;
    if (mFilterThread.joinable()) {
        mFilterThread.join();
+1 −0
Original line number Diff line number Diff line
@@ -289,6 +289,7 @@ class Filter : public BnFilter {
    uint8_t mIpCidMonitored = 0;

    PlaybackStatus mIptvDvrPlaybackStatus;
    std::atomic<int> mFilterCount = 0;
};

}  // namespace tuner