Terminate IPTV read thread on demux close

IPTV reading thread doesn't have a termination condition. This CL
adds a flag mIsIptvReadThreadTerminated which tracks whether the
thread resources should be cleaned up.

Bug: 288170590
Test: atest VtsHalTvTunerTargetTest
Change-Id: I3a19e1045ee67dac2d95457d217adb1375674ed4
diff --git a/tv/tuner/aidl/default/Demux.h b/tv/tuner/aidl/default/Demux.h
index b8d57df..af040d4 100644
--- a/tv/tuner/aidl/default/Demux.h
+++ b/tv/tuner/aidl/default/Demux.h
@@ -106,7 +106,7 @@
     void setIsRecording(bool isRecording);
     bool isRecording();
     void startFrontendInputLoop();
-    void frontendIptvInputThreadLoop(dtv_plugin* interface, dtv_streamer* streamer);
+    void frontendIptvInputThreadLoop(dtv_plugin* interface, dtv_streamer* streamer, void* buf);
 
     /**
      * A dispatcher to read and dispatch input data to all the started filters.
@@ -130,6 +130,10 @@
      * Setter for IPTV Reading thread
      */
     void setIptvThreadRunning(bool isIptvThreadRunning);
+    /**
+     * Stops IPTV playback reading thread.
+     */
+    void stopIptvFrontendInput();
 
   private:
     // Tuner service
@@ -208,7 +212,8 @@
     /**
      * Controls IPTV reading thread status
      */
-    bool mIsIptvReadThreadRunning;
+    bool mIsIptvReadThreadRunning = false;
+    std::atomic<bool> mIsIptvReadThreadTerminated = false;
     std::mutex mIsIptvThreadRunningMutex;
     std::condition_variable mIsIptvThreadRunningCv;