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

Commit 70ac073e authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6398428 from 01d9c845 to rvc-release

Change-Id: I9e09cab82e9ba4f9889e8617780fa7abcfc83a08
parents a60c52f1 01d9c845
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -215,6 +215,9 @@ aaudio_result_t AudioStreamTrack::open(const AudioStreamBuilder& builder)
            : (aaudio_session_id_t) mAudioTrack->getSessionId();
    setSessionId(actualSessionId);

    mInitialBufferCapacity = getBufferCapacity();
    mInitialFramesPerBurst = getFramesPerBurst();

    mAudioTrack->addAudioDeviceCallback(mDeviceCallback);

    // Update performance mode based on the actual stream flags.
@@ -265,7 +268,16 @@ void AudioStreamTrack::processCallback(int event, void *info) {

            // Stream got rerouted so we disconnect.
        case AudioTrack::EVENT_NEW_IAUDIOTRACK:
            // request stream disconnect if the restored AudioTrack has properties not matching
            // what was requested initially
            if (mAudioTrack->channelCount() != getSamplesPerFrame()
                    || mAudioTrack->format() != getFormat()
                    || mAudioTrack->getSampleRate() != getSampleRate()
                    || mAudioTrack->getRoutedDeviceId() != getDeviceId()
                    || getBufferCapacity() != mInitialBufferCapacity
                    || getFramesPerBurst() != mInitialFramesPerBurst) {
                processCallbackCommon(AAUDIO_CALLBACK_OPERATION_DISCONNECTED, info);
            }
            break;

        default:
+4 −0
Original line number Diff line number Diff line
@@ -104,6 +104,10 @@ private:

    // TODO add 64-bit position reporting to AudioTrack and use it.
    aaudio_wrapping_frames_t         mPositionWhenPausing = 0;

    // initial AudioTrack frame count and notification period
    int32_t mInitialBufferCapacity = 0;
    int32_t mInitialFramesPerBurst = 0;
};

} /* namespace aaudio */
+6 −2
Original line number Diff line number Diff line
@@ -28,6 +28,10 @@
#undef HIDE
#define HIDE __attribute__((visibility("hidden")))

// The internals of AUnion cause problems with CFI
#undef  NO_CFI
#define NO_CFI __attribute__((no_sanitize("cfi")))

namespace android {

/**
@@ -93,7 +97,7 @@ struct HIDE _AUnion_impl {
     * \param args      arbitrary arguments for constructor
     */
    template<typename T, typename ...Args>
    inline static void emplace(size_t totalSize, T *addr, Args&&... args) {
    inline static void NO_CFI emplace(size_t totalSize, T *addr, Args&&... args) {
        new(addr)T(std::forward<Args>(args)...);
        // clear slack space - this is not technically required
        constexpr size_t size = sizeof(T);
@@ -160,7 +164,7 @@ public:
    template<
            typename T, typename ...Args,
            typename=typename std::enable_if<is_one_of<T, void, Ts...>::value>::type>
    inline void emplace(Args&&... args) {
    inline void NO_CFI emplace(Args&&... args) {
        _AUnion_impl::emplace(
                sizeof(_type), reinterpret_cast<T*>(&mValue), std::forward<Args>(args)...);
    }