Add IPTV default implementation
Frontend::tune(): create a streamer using plugin interface to
read a byte and return LOCKED event if byte is read
Demux::setFrontendDataSource():open a new stream to read data
from the socket and push the data read to DVR FMQ.
Test: atest VtsHalTvTunerTargetTest
Bug: 288170590
Change-Id: Iaf2eae7b4dc9e7d69b1f7b3a367d24f6acdd68be
diff --git a/tv/tuner/aidl/default/Dvr.h b/tv/tuner/aidl/default/Dvr.h
index 293c533..4af187b 100644
--- a/tv/tuner/aidl/default/Dvr.h
+++ b/tv/tuner/aidl/default/Dvr.h
@@ -43,6 +43,19 @@
using DvrMQ = AidlMessageQueue<int8_t, SynchronizedReadWrite>;
+const int DVR_WRITE_SUCCESS = 0;
+const int DVR_WRITE_FAILURE_REASON_FMQ_FULL = 1;
+const int DVR_WRITE_FAILURE_REASON_UNKNOWN = 2;
+
+const int TS_SIZE = 188;
+const int IPTV_BUFFER_SIZE = TS_SIZE * 7 * 8; // defined in service_streamer_udp in cbs v3 project
+
+// Thresholds are defined to indicate how full the buffers are.
+const double HIGH_THRESHOLD_PERCENT = 0.90;
+const double LOW_THRESHOLD_PERCENT = 0.15;
+const int IPTV_PLAYBACK_STATUS_THRESHOLD_HIGH = IPTV_BUFFER_SIZE * HIGH_THRESHOLD_PERCENT;
+const int IPTV_PLAYBACK_STATUS_THRESHOLD_LOW = IPTV_BUFFER_SIZE * LOW_THRESHOLD_PERCENT;
+
struct MediaEsMetaData {
bool isAudio;
int startIndex;
@@ -80,6 +93,7 @@
* Return false is any of the above processes fails.
*/
bool createDvrMQ();
+ int writePlaybackFMQ(void* buf, size_t size);
bool writeRecordFMQ(const std::vector<int8_t>& data);
bool addPlaybackFilter(int64_t filterId, std::shared_ptr<IFilter> filter);
bool removePlaybackFilter(int64_t filterId);
@@ -102,6 +116,7 @@
bool readDataFromMQ();
void getMetaDataValue(int& index, int8_t* dataOutputBuffer, int& value);
void maySendPlaybackStatusCallback();
+ void maySendIptvPlaybackStatusCallback();
void maySendRecordStatusCallback();
PlaybackStatus checkPlaybackStatusChange(uint32_t availableToWrite, uint32_t availableToRead,
int64_t highThreshold, int64_t lowThreshold);