summaryrefslogtreecommitdiff
path: root/audio/device_port_source.h
diff options
context:
space:
mode:
authorRoman Kiryanov <rkir@google.com>2020-07-21 23:31:18 -0700
committerRoman Kiryanov <rkir@google.com>2020-07-30 17:23:06 -0700
commit966270794c1e2f029b94f4ebdb51471caf563f58 (patch)
treee38191e366a1e96c8ea42dbcddcf03bacde5bdba /audio/device_port_source.h
parent2ab979a1c51b3f4440382cc05f2b477b62582731 (diff)
downloadgoldfish-966270794c1e2f029b94f4ebdb51471caf563f58.tar.gz
Add a reader and writer API around DataMQ
This allows producers and consumers to write and read data directly to their buffers (e.g. to a ring buffer that will be introduced for the tinyalsa source). Bug: 157158109 Test: atest VtsHalAudioV6_0TargetTest Signed-off-by: Roman Kiryanov <rkir@google.com> Change-Id: I3d94a7fca9905947b13e70b66e8b5ef134d82c16 Merged-In: I3d94a7fca9905947b13e70b66e8b5ef134d82c16
Diffstat (limited to 'audio/device_port_source.h')
-rw-r--r--audio/device_port_source.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/audio/device_port_source.h b/audio/device_port_source.h
index 3cc39ffe..16b5d27c 100644
--- a/audio/device_port_source.h
+++ b/audio/device_port_source.h
@@ -18,6 +18,7 @@
#include <memory>
#include <android/hardware/audio/common/6.0/types.h>
#include <android/hardware/audio/6.0/types.h>
+#include "iwriter.h"
namespace android {
namespace hardware {
@@ -31,9 +32,10 @@ using namespace ::android::hardware::audio::V6_0;
struct DevicePortSource {
virtual ~DevicePortSource() {}
virtual Result getCapturePosition(uint64_t &frames, uint64_t &time) = 0;
- virtual int read(void *data, size_t nBytes) = 0;
+ virtual size_t read(float volume, size_t bytesToRead, IWriter &) = 0;
- static std::unique_ptr<DevicePortSource> create(const DeviceAddress &,
+ static std::unique_ptr<DevicePortSource> create(size_t writerBufferSizeHint,
+ const DeviceAddress &,
const AudioConfig &,
const hidl_bitfield<AudioOutputFlag> &,
uint64_t &frames);