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

Commit 4e7c74b2 authored by Andy Hung's avatar Andy Hung Committed by Android (Google) Code Review
Browse files

Merge "AudioFlinger: Do not dereference a nullptr for a reference" into main

parents cc841344 4fd69011
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -391,7 +391,7 @@ class PatchTrackBase : public PatchProxyBufferProvider, public virtual IAfPatchT
{
public:
                        PatchTrackBase(const sp<ClientProxy>& proxy,
                                       const IAfThreadBase& thread,
                                       IAfThreadBase* thread,
                                       const Timeout& timeout);
            void setPeerTimeout(std::chrono::nanoseconds timeout) final;
            void setPeerProxy(const sp<IAfPatchTrackBase>& proxy, bool holdReference) final {
+5 −5
Original line number Diff line number Diff line
@@ -315,15 +315,15 @@ status_t TrackBase::setSyncEvent(
}

PatchTrackBase::PatchTrackBase(const sp<ClientProxy>& proxy,
        const IAfThreadBase& thread, const Timeout& timeout)
        IAfThreadBase* thread, const Timeout& timeout)
    : mProxy(proxy)
{
    if (timeout) {
        setPeerTimeout(*timeout);
    } else {
        // Double buffer mixer
        uint64_t mixBufferNs = ((uint64_t)2 * thread.frameCount() * 1000000000) /
                                              thread.sampleRate();
        uint64_t mixBufferNs = ((uint64_t)2 * thread->frameCount() * 1000000000) /
                                              thread->sampleRate();
        setPeerTimeout(std::chrono::nanoseconds{mixBufferNs});
    }
}
@@ -2450,7 +2450,7 @@ PatchTrack::PatchTrack(IAfPlaybackThread* playbackThread,
              TYPE_PATCH, AUDIO_PORT_HANDLE_NONE, frameCountToBeReady),
        PatchTrackBase(mCblk ? new ClientProxy(mCblk, mBuffer, frameCount, mFrameSize, true, true)
                        : nullptr,
                       *playbackThread, timeout)
                       playbackThread, timeout)
{
    ALOGV("%s(%d): sampleRate %d mPeerTimeout %d.%03d sec",
                                      __func__, mId, sampleRate,
@@ -3123,7 +3123,7 @@ PatchRecord::PatchRecord(IAfRecordThread* recordThread,
                audioServerAttributionSource(getpid()), flags, TYPE_PATCH),
        PatchTrackBase(mCblk ? new ClientProxy(mCblk, mBuffer, frameCount, mFrameSize, false, true)
                        : nullptr,
                       *recordThread, timeout)
                       recordThread, timeout)
{
    ALOGV("%s(%d): sampleRate %d mPeerTimeout %d.%03d sec",
                                      __func__, mId, sampleRate,