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

Commit 76ca9a88 authored by Hongguang's avatar Hongguang
Browse files

Stop current tuning before starting a new tuning.

If a new tuning request comes before stop old tuning, there is race
condition that the Frontend loop thread may crash while terminate().

Bug: 202335601
Fix: 202335601
Test: atest android.media.tv.tuner.cts
Change-Id: Ic168b585f0a8fe36bd8eeceee3e0b4c83d5388aa
parent e613d20f
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -343,6 +343,10 @@ uint16_t Demux::getFilterTpid(int64_t filterId) {
}

void Demux::startFrontendInputLoop() {
    ALOGD("[Demux] start frontend on demux");
    // Stop current Frontend thread loop first, in case the user starts a new
    // tuning before stopping current tuning.
    stopFrontendInput();
    mFrontendInputThreadRunning = true;
    mFrontendInputThread = std::thread(&Demux::frontendInputThreadLoop, this);
}