Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff6900d8 authored by Ivan Lozano's avatar Ivan Lozano
Browse files

Generate IAudioRecord with AIDL.

Use AIDL to generate the IAudioRecord interface rather than using
a manually implemented interface.

Bug: 64223827
Test: Ran the AudioNativeTest and CtsMediaTestCases CTS tests.

Change-Id: Iade23c73253a97c358050bbd697ebe592b89a4c0
parent ce10f65f
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -3,7 +3,8 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_SRC_FILES := \
	main_audioserver.cpp
	main_audioserver.cpp \
	../libaudioclient/aidl/android/media/IAudioRecord.aidl

LOCAL_SHARED_LIBRARIES := \
	libaaudioservice \
@@ -36,6 +37,9 @@ LOCAL_C_INCLUDES := \
	$(call include-path-for, audio-utils) \
	external/sonic \

LOCAL_AIDL_INCLUDES := \
        frameworks/av/media/libaudioclient/aidl

# If AUDIOSERVER_MULTILIB in device.mk is non-empty then it is used to control
# the LOCAL_MULTILIB for all audioserver exclusive libraries.
# This is relevant for 64 bit architectures where either or both
+4 −1
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ LOCAL_C_INCLUDES := \
    $(LOCAL_PATH)/legacy \
    $(LOCAL_PATH)/utility

LOCAL_AIDL_INCLUDES := frameworks/av/media/libaudioclient/aidl

# If you add a file here then also add it below in the SHARED target
LOCAL_SRC_FILES = \
    core/AudioStream.cpp \
@@ -57,7 +59,8 @@ LOCAL_SRC_FILES = \
    binding/IAAudioService.cpp \
    binding/RingBufferParcelable.cpp \
    binding/SharedMemoryParcelable.cpp \
    binding/SharedRegionParcelable.cpp
    binding/SharedRegionParcelable.cpp \
    ../../libaudioclient/aidl/android/media/IAudioRecord.aidl

LOCAL_CFLAGS += -Wno-unused-parameter -Wall -Werror

+14 −1
Original line number Diff line number Diff line
@@ -6,7 +6,21 @@ cc_library_headers {

cc_library_shared {
    name: "libaudioclient",

    aidl: {
        export_aidl_headers: true,
        local_include_dirs: ["aidl"],
        include_dirs: [
            "frameworks/av/media/libaudioclient/aidl",
        ],
    },

    srcs: [
        // AIDL files for audioclient interfaces
        // The headers for these interfaces will be available to any modules that
        // include libaudioclient, at the path "aidl/package/path/BnFoo.h"
        "aidl/android/media/IAudioRecord.aidl",

        "AudioEffect.cpp",
        "AudioPolicy.cpp",
        "AudioRecord.cpp",
@@ -17,7 +31,6 @@ cc_library_shared {
        "IAudioFlingerClient.cpp",
        "IAudioPolicyService.cpp",
        "IAudioPolicyServiceClient.cpp",
        "IAudioRecord.cpp",
        "IAudioTrack.cpp",
        "IEffect.cpp",
        "IEffectClient.cpp",
+19 −18
Original line number Diff line number Diff line
@@ -323,7 +323,7 @@ status_t AudioRecord::start(AudioSystem::sync_event_t event, audio_session_t tri

    status_t status = NO_ERROR;
    if (!(flags & CBLK_INVALID)) {
        status = mAudioRecord->start(event, triggerSession);
        status = mAudioRecord->start(event, triggerSession).transactionError();
        if (status == DEAD_OBJECT) {
            flags |= CBLK_INVALID;
        }
@@ -652,7 +652,7 @@ status_t AudioRecord::openRecord_l(const Modulo<uint32_t> &epoch, const String16

    sp<IMemory> iMem;           // for cblk
    sp<IMemory> bufferMem;
    sp<IAudioRecord> record = audioFlinger->openRecord(input,
    sp<media::IAudioRecord> record = audioFlinger->openRecord(input,
                                                              mSampleRate,
                                                              mFormat,
                                                              mChannelMask,
@@ -1219,7 +1219,8 @@ status_t AudioRecord::restoreRecord_l(const char *from)
        if (mActive) {
            // callback thread or sync event hasn't changed
            // FIXME this fails if we have a new AudioFlinger instance
            result = mAudioRecord->start(AudioSystem::SYNC_EVENT_SAME, AUDIO_SESSION_NONE);
            result = mAudioRecord->start(
                AudioSystem::SYNC_EVENT_SAME, AUDIO_SESSION_NONE).transactionError();
        }
        mFramesReadServerOffset = mFramesRead; // server resets to zero so we need an offset.
    }
+4 −4
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ public:
        return track;
    }

    virtual sp<IAudioRecord> openRecord(
    virtual sp<media::IAudioRecord> openRecord(
                                audio_io_handle_t input,
                                uint32_t sampleRate,
                                audio_format_t format,
@@ -194,7 +194,7 @@ public:
                                audio_port_handle_t portId)
    {
        Parcel data, reply;
        sp<IAudioRecord> record;
        sp<media::IAudioRecord> record;
        data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
        data.writeInt32((int32_t) input);
        data.writeInt32(sampleRate);
@@ -238,7 +238,7 @@ public:
                *notificationFrames = lNotificationFrames;
            }
            lStatus = reply.readInt32();
            record = interface_cast<IAudioRecord>(reply.readStrongBinder());
            record = interface_cast<media::IAudioRecord>(reply.readStrongBinder());
            cblk = interface_cast<IMemory>(reply.readStrongBinder());
            if (cblk != 0 && cblk->pointer() == NULL) {
                cblk.clear();
@@ -1025,7 +1025,7 @@ status_t BnAudioFlinger::onTransact(
            sp<IMemory> cblk;
            sp<IMemory> buffers;
            status_t status = NO_ERROR;
            sp<IAudioRecord> record = openRecord(input,
            sp<media::IAudioRecord> record = openRecord(input,
                    sampleRate, format, channelMask, opPackageName, &frameCount, &flags,
                    pid, tid, clientUid, &sessionId, &notificationFrames, cblk, buffers,
                    &status, portId);
Loading