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

Commit 8b4a2b3a authored by Sharad Sangle's avatar Sharad Sangle Committed by Linux Build Service Account
Browse files

audiopolicy: make audio policy extensible

make function virtual or protected so that
they can be extended in custom audio policy.

audio policy: move output handle to AudioOutputDescriptor base class
Change-Id: I96ef9fd1c5a94874acb897245501ba2f9c9ab0c0

Conflicts:
	services/audiopolicy/managerdefault/AudioPolicyManager.h

Change-Id: Ida7992f6b327491fab1f4ea376e85e8eb34b89ca
parent 309e2fa3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ public:

    sp<AudioPort>       mPort;
    audio_devices_t mDevice;                   // current device this output is routed to
    audio_io_handle_t mIoHandle;           // output handle
    uint32_t mRefCount[AUDIO_STREAM_CNT]; // number of streams of each type using this output
    nsecs_t mStopTime[AUDIO_STREAM_CNT];
    float mCurVolume[AUDIO_STREAM_CNT];   // current stream volume in dB
@@ -121,7 +122,6 @@ public:
    virtual void toAudioPort(struct audio_port *port) const;

    const sp<IOProfile> mProfile;          // I/O profile this output derives from
    audio_io_handle_t mIoHandle;           // output handle
    uint32_t mLatency;                  //
    audio_output_flags_t mFlags;   //
    AudioMix *mPolicyMix;             // non NULL when used by a dynamic policy
+2 −2
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ namespace android {

AudioOutputDescriptor::AudioOutputDescriptor(const sp<AudioPort>& port,
                                             AudioPolicyClientInterface *clientInterface)
    : mPort(port), mDevice(AUDIO_DEVICE_NONE),
    : mPort(port), mDevice(AUDIO_DEVICE_NONE),mIoHandle(0),
      mClientInterface(clientInterface), mPatchHandle(AUDIO_PATCH_HANDLE_NONE), mId(0)
{
    // clear usage count for all stream types
@@ -221,7 +221,7 @@ void AudioOutputDescriptor::log(const char* indent)
SwAudioOutputDescriptor::SwAudioOutputDescriptor(const sp<IOProfile>& profile,
                                                 AudioPolicyClientInterface *clientInterface)
    : AudioOutputDescriptor(profile, clientInterface),
    mProfile(profile), mIoHandle(0), mLatency(0),
    mProfile(profile), mLatency(0),
    mFlags((audio_output_flags_t)0), mPolicyMix(NULL),
    mOutput1(0), mOutput2(0), mDirectOpenCount(0), mGlobalRefCount(0)
{
+6 −6
Original line number Diff line number Diff line
@@ -394,7 +394,7 @@ protected:
        // must be called every time a condition that affects the device choice for a given output is
        // changed: connected device, phone state, force use, output start, output stop..
        // see getDeviceForStrategy() for the use of fromCache parameter
        audio_devices_t getNewOutputDevice(const sp<AudioOutputDescriptor>& outputDesc,
        virtual audio_devices_t getNewOutputDevice(const sp<AudioOutputDescriptor>& outputDesc,
                                           bool fromCache);

        // updates cache of device used by all strategies (mDeviceForStrategy[])
@@ -481,12 +481,12 @@ protected:

        // if argument "device" is different from AUDIO_DEVICE_NONE,  startSource() will force
        // the re-evaluation of the output device.
        status_t startSource(sp<AudioOutputDescriptor> outputDesc,
        virtual status_t startSource(sp<AudioOutputDescriptor> outputDesc,
                             audio_stream_type_t stream,
                             audio_devices_t device,
                             const char *address,
                             uint32_t *delayMs);
        status_t stopSource(sp<AudioOutputDescriptor> outputDesc,
        virtual status_t stopSource(sp<AudioOutputDescriptor> outputDesc,
                            audio_stream_type_t stream,
                            bool forceDeviceUpdate);

@@ -593,7 +593,7 @@ private:
        // If any, resolve any "dynamic" fields of an Audio Profiles collection
        void updateAudioProfiles(audio_devices_t device, audio_io_handle_t ioHandle,
                AudioProfileVector &profiles);

protected:
        // updates device caching and output for streams that can influence the
        //    routing of notifications
        void handleNotificationRoutingForStream(audio_stream_type_t stream);
@@ -608,7 +608,7 @@ private:
                SortedVector<audio_io_handle_t>& outputs /*out*/);
        uint32_t curAudioPortGeneration() const { return mAudioPortGeneration; }
        // internal method to return the output handle for the given device and format
        audio_io_handle_t getOutputForDevice(
        virtual audio_io_handle_t getOutputForDevice(
                audio_devices_t device,
                audio_session_t session,
                audio_stream_type_t stream,
@@ -644,7 +644,7 @@ private:
                                                        AudioMix **policyMix = NULL);

        // Called by setDeviceConnectionState().
        status_t setDeviceConnectionStateInt(audio_devices_t device,
        virtual status_t setDeviceConnectionStateInt(audio_devices_t device,
                                                          audio_policy_dev_state_t state,
                                                          const char *device_address,
                                                          const char *device_name);