Loading services/audioflinger/AudioFlinger.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -3919,7 +3919,7 @@ void AudioFlinger::updateSecondaryOutputsForTrack_l( track->setTeePatches(std::move(teePatches)); track->setTeePatches(std::move(teePatches)); } } sp<AudioFlinger::SyncEvent> AudioFlinger::createSyncEvent(AudioSystem::sync_event_t type, sp<SyncEvent> AudioFlinger::createSyncEvent(AudioSystem::sync_event_t type, audio_session_t triggerSession, audio_session_t triggerSession, audio_session_t listenerSession, audio_session_t listenerSession, sync_event_callback_t callBack, sync_event_callback_t callBack, Loading services/audioflinger/AudioFlinger.h +1 −37 Original line number Original line Diff line number Diff line Loading @@ -85,6 +85,7 @@ #include <audio_utils/TimestampVerifier.h> #include <audio_utils/TimestampVerifier.h> #include <timing/MonotonicFrameCounter.h> #include <timing/MonotonicFrameCounter.h> #include <timing/SyncEvent.h> #include "FastCapture.h" #include "FastCapture.h" #include "FastMixer.h" #include "FastMixer.h" Loading Loading @@ -374,43 +375,6 @@ public: static inline std::atomic<AudioFlinger *> gAudioFlinger = nullptr; static inline std::atomic<AudioFlinger *> gAudioFlinger = nullptr; class SyncEvent; typedef void (*sync_event_callback_t)(const wp<SyncEvent>& event) ; class SyncEvent : public RefBase { public: SyncEvent(AudioSystem::sync_event_t type, audio_session_t triggerSession, audio_session_t listenerSession, sync_event_callback_t callBack, const wp<RefBase>& cookie) : mType(type), mTriggerSession(triggerSession), mListenerSession(listenerSession), mCallback(callBack), mCookie(cookie) {} virtual ~SyncEvent() {} void trigger() { Mutex::Autolock _l(mLock); if (mCallback) mCallback(wp<SyncEvent>(this)); } bool isCancelled() const { Mutex::Autolock _l(mLock); return (mCallback == NULL); } void cancel() { Mutex::Autolock _l(mLock); mCallback = NULL; } AudioSystem::sync_event_t type() const { return mType; } audio_session_t triggerSession() const { return mTriggerSession; } audio_session_t listenerSession() const { return mListenerSession; } wp<RefBase> cookie() const { return mCookie; } private: const AudioSystem::sync_event_t mType; const audio_session_t mTriggerSession; const audio_session_t mListenerSession; sync_event_callback_t mCallback; const wp<RefBase> mCookie; mutable Mutex mLock; }; sp<SyncEvent> createSyncEvent(AudioSystem::sync_event_t type, sp<SyncEvent> createSyncEvent(AudioSystem::sync_event_t type, audio_session_t triggerSession, audio_session_t triggerSession, audio_session_t listenerSession, audio_session_t listenerSession, Loading services/audioflinger/timing/SyncEvent.h 0 → 100644 +58 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once namespace android { class SyncEvent; typedef void (*sync_event_callback_t)(const wp<SyncEvent>& event) ; class SyncEvent : public RefBase { public: SyncEvent(AudioSystem::sync_event_t type, audio_session_t triggerSession, audio_session_t listenerSession, sync_event_callback_t callBack, const wp<RefBase>& cookie) : mType(type), mTriggerSession(triggerSession), mListenerSession(listenerSession), mCallback(callBack), mCookie(cookie) {} virtual ~SyncEvent() {} void trigger() { Mutex::Autolock _l(mLock); if (mCallback) mCallback(wp<SyncEvent>(this)); } bool isCancelled() const { Mutex::Autolock _l(mLock); return (mCallback == NULL); } void cancel() { Mutex::Autolock _l(mLock); mCallback = NULL; } AudioSystem::sync_event_t type() const { return mType; } audio_session_t triggerSession() const { return mTriggerSession; } audio_session_t listenerSession() const { return mListenerSession; } wp<RefBase> cookie() const { return mCookie; } private: const AudioSystem::sync_event_t mType; const audio_session_t mTriggerSession; const audio_session_t mListenerSession; sync_event_callback_t mCallback; const wp<RefBase> mCookie; mutable Mutex mLock; }; } // namespace android Loading
services/audioflinger/AudioFlinger.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -3919,7 +3919,7 @@ void AudioFlinger::updateSecondaryOutputsForTrack_l( track->setTeePatches(std::move(teePatches)); track->setTeePatches(std::move(teePatches)); } } sp<AudioFlinger::SyncEvent> AudioFlinger::createSyncEvent(AudioSystem::sync_event_t type, sp<SyncEvent> AudioFlinger::createSyncEvent(AudioSystem::sync_event_t type, audio_session_t triggerSession, audio_session_t triggerSession, audio_session_t listenerSession, audio_session_t listenerSession, sync_event_callback_t callBack, sync_event_callback_t callBack, Loading
services/audioflinger/AudioFlinger.h +1 −37 Original line number Original line Diff line number Diff line Loading @@ -85,6 +85,7 @@ #include <audio_utils/TimestampVerifier.h> #include <audio_utils/TimestampVerifier.h> #include <timing/MonotonicFrameCounter.h> #include <timing/MonotonicFrameCounter.h> #include <timing/SyncEvent.h> #include "FastCapture.h" #include "FastCapture.h" #include "FastMixer.h" #include "FastMixer.h" Loading Loading @@ -374,43 +375,6 @@ public: static inline std::atomic<AudioFlinger *> gAudioFlinger = nullptr; static inline std::atomic<AudioFlinger *> gAudioFlinger = nullptr; class SyncEvent; typedef void (*sync_event_callback_t)(const wp<SyncEvent>& event) ; class SyncEvent : public RefBase { public: SyncEvent(AudioSystem::sync_event_t type, audio_session_t triggerSession, audio_session_t listenerSession, sync_event_callback_t callBack, const wp<RefBase>& cookie) : mType(type), mTriggerSession(triggerSession), mListenerSession(listenerSession), mCallback(callBack), mCookie(cookie) {} virtual ~SyncEvent() {} void trigger() { Mutex::Autolock _l(mLock); if (mCallback) mCallback(wp<SyncEvent>(this)); } bool isCancelled() const { Mutex::Autolock _l(mLock); return (mCallback == NULL); } void cancel() { Mutex::Autolock _l(mLock); mCallback = NULL; } AudioSystem::sync_event_t type() const { return mType; } audio_session_t triggerSession() const { return mTriggerSession; } audio_session_t listenerSession() const { return mListenerSession; } wp<RefBase> cookie() const { return mCookie; } private: const AudioSystem::sync_event_t mType; const audio_session_t mTriggerSession; const audio_session_t mListenerSession; sync_event_callback_t mCallback; const wp<RefBase> mCookie; mutable Mutex mLock; }; sp<SyncEvent> createSyncEvent(AudioSystem::sync_event_t type, sp<SyncEvent> createSyncEvent(AudioSystem::sync_event_t type, audio_session_t triggerSession, audio_session_t triggerSession, audio_session_t listenerSession, audio_session_t listenerSession, Loading
services/audioflinger/timing/SyncEvent.h 0 → 100644 +58 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once namespace android { class SyncEvent; typedef void (*sync_event_callback_t)(const wp<SyncEvent>& event) ; class SyncEvent : public RefBase { public: SyncEvent(AudioSystem::sync_event_t type, audio_session_t triggerSession, audio_session_t listenerSession, sync_event_callback_t callBack, const wp<RefBase>& cookie) : mType(type), mTriggerSession(triggerSession), mListenerSession(listenerSession), mCallback(callBack), mCookie(cookie) {} virtual ~SyncEvent() {} void trigger() { Mutex::Autolock _l(mLock); if (mCallback) mCallback(wp<SyncEvent>(this)); } bool isCancelled() const { Mutex::Autolock _l(mLock); return (mCallback == NULL); } void cancel() { Mutex::Autolock _l(mLock); mCallback = NULL; } AudioSystem::sync_event_t type() const { return mType; } audio_session_t triggerSession() const { return mTriggerSession; } audio_session_t listenerSession() const { return mListenerSession; } wp<RefBase> cookie() const { return mCookie; } private: const AudioSystem::sync_event_t mType; const audio_session_t mTriggerSession; const audio_session_t mListenerSession; sync_event_callback_t mCallback; const wp<RefBase> mCookie; mutable Mutex mLock; }; } // namespace android