Merge "Flush events before stopping filter."
diff --git a/tv/tuner/aidl/default/Filter.cpp b/tv/tuner/aidl/default/Filter.cpp
index 5b6debb..5f61c8d 100644
--- a/tv/tuner/aidl/default/Filter.cpp
+++ b/tv/tuner/aidl/default/Filter.cpp
@@ -60,6 +60,12 @@
}
}
+void FilterCallbackScheduler::flushEvents() {
+ std::unique_lock<std::mutex> lock(mLock);
+ mCallbackBuffer.clear();
+ mDataLength = 0;
+}
+
void FilterCallbackScheduler::setTimeDelayHint(int timeDelay) {
// updating the setTimeDelay does not go into effect until the condition
// variable times out or is notified.
@@ -335,6 +341,8 @@
mFilterThread.join();
}
+ mCallbackScheduler.flushEvents();
+
return ::ndk::ScopedAStatus::ok();
}
diff --git a/tv/tuner/aidl/default/Filter.h b/tv/tuner/aidl/default/Filter.h
index a5adf4c..7298561 100644
--- a/tv/tuner/aidl/default/Filter.h
+++ b/tv/tuner/aidl/default/Filter.h
@@ -68,6 +68,8 @@
bool hasCallbackRegistered() const;
+ void flushEvents();
+
private:
void start();
void stop();