AudioFlinger: Add Track interfaces
Add new interfaces
IAfTrackBase
IAfTrack
IAfOutputTrack
IAfMmapTrack
IAfRecordTrack
Test: atest audiorecord_tests audiotrack_tests audiorouting_tests trackplayerbase_tests audiosystem_tests
Test: atest AudioTrackTest AudioRecordTest
Test: YouTube Camera
Bug: 288339104
Bug: 288468076
Merged-In: Iee8fd68fcd1c430da09b11d68a57fc62ba4c6f75
Change-Id: Iee8fd68fcd1c430da09b11d68a57fc62ba4c6f75
(cherry picked from commit d29af631bd879ee4e477da265288211339fa2ee8)
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index af15cfc..07f0373 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -7481,7 +7481,8 @@
if (numTracks > 0) {
ss << ":";
for (const auto &track : mOutputTracks) {
- const sp<ThreadBase> thread = track->thread().promote();
+ // TODO(b/288339104) type
+ const auto thread = sp<ThreadBase>::cast(track->thread().promote());
ss << " (" << track->id() << " : ";
if (thread.get() != nullptr) {
ss << thread.get() << ", " << thread->id();
@@ -7565,7 +7566,8 @@
{
mWaitTimeMs = UINT_MAX;
for (size_t i = 0; i < mOutputTracks.size(); i++) {
- sp<ThreadBase> strong = mOutputTracks[i]->thread().promote();
+ // TODO(b/288339104) type
+ const auto strong = sp<ThreadBase>::cast(mOutputTracks[i]->thread().promote());
if (strong != 0) {
uint32_t waitTimeMs = (strong->frameCount() * 2 * 1000) / strong->sampleRate();
if (waitTimeMs < mWaitTimeMs) {
@@ -7578,7 +7580,8 @@
bool AudioFlinger::DuplicatingThread::outputsReady()
{
for (size_t i = 0; i < outputTracks.size(); i++) {
- sp<ThreadBase> thread = outputTracks[i]->thread().promote();
+ // TODO(b/288339104) type
+ const auto thread = sp<ThreadBase>::cast(outputTracks[i]->thread().promote());
if (thread == 0) {
ALOGW("DuplicatingThread::outputsReady() could not promote thread on output track %p",
outputTracks[i].get());
@@ -8856,10 +8859,11 @@
sp<audioflinger::SyncEvent> strongEvent = event.promote();
if (strongEvent != 0) {
- sp<RefBase> ptr = std::any_cast<const wp<RefBase>>(strongEvent->cookie()).promote();
- if (ptr != 0) {
- RecordTrack *recordTrack = (RecordTrack *)ptr.get();
- recordTrack->handleSyncStartEvent(strongEvent);
+ sp<IAfTrackBase> ptr =
+ std::any_cast<const wp<IAfTrackBase>>(strongEvent->cookie()).promote();
+ if (ptr != nullptr) {
+ // TODO(b/288339104) handleSyncStartEvent is in IAfTrackBase not IAfRecordTrack.
+ ptr->handleSyncStartEvent(strongEvent);
}
}
}