AudioFlinger: Extract inner AudioStreamIn and Source classes

Ensure member variables are const.

Test: atest audiorecord_tests audiotrack_tests audiorouting_tests trackplayerbase_tests audiosystem_tests
Test: atest AudioTrackTest AudioRecordTest
Test: YouTube Camera
Bug: 288339104
Bug: 290269791
Merged-In: Idb7586437ce43ae1c8455bcef645a943ad2e79de
Change-Id: Idb7586437ce43ae1c8455bcef645a943ad2e79de
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index ebff932..8629429 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -98,6 +98,7 @@
 #include <timing/SynchronizedRecordState.h>
 
 #include <datapath/AudioHwDevice.h>
+#include <datapath/AudioStreamIn.h>
 #include <datapath/AudioStreamOut.h>
 #include <datapath/SpdifStreamOut.h>
 #include <datapath/ThreadMetrics.h>
@@ -577,7 +578,6 @@
     class PatchPanel;
     class DeviceEffectManagerCallback;
 private:
-    struct AudioStreamIn;
     struct TeePatch;
 public:
     using TeePatches = std::vector<TeePatch>;
@@ -764,29 +764,6 @@
                         audio_io_handle_t upStream, const String8& keyValuePairs,
                         const std::function<bool(const sp<PlaybackThread>&)>& useThread = nullptr);
 
-    // AudioStreamIn is immutable, so their fields are const.
-    // For emphasis, we could also make all pointers to them be "const *",
-    // but that would clutter the code unnecessarily.
-
-    struct AudioStreamIn : public Source {
-        AudioHwDevice* const audioHwDev;
-        sp<StreamInHalInterface> stream;
-        audio_input_flags_t flags;
-
-        sp<DeviceHalInterface> hwDev() const { return audioHwDev->hwDevice(); }
-
-        AudioStreamIn(AudioHwDevice *dev, const sp<StreamInHalInterface>& in,
-                audio_input_flags_t flags) :
-            audioHwDev(dev), stream(in), flags(flags) {}
-        status_t read(void *buffer, size_t bytes, size_t *read) override {
-            return stream->read(buffer, bytes, read);
-        }
-        status_t getCapturePosition(int64_t *frames, int64_t *time) override {
-            return stream->getCapturePosition(frames, time);
-        }
-        status_t standby() override { return stream->standby(); }
-    };
-
     struct TeePatch {
         sp<IAfPatchRecord> patchRecord;
         sp<IAfPatchTrack> patchTrack;