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

Commit 2e2e8265 authored by Sharad Sangle's avatar Sharad Sangle Committed by Sam Mortimer
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

Change-Id: Ida7992f6b327491fab1f4ea376e85e8eb34b89ca
parent 60ba815e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -78,6 +78,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
@@ -123,7 +124,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),
    mDirectClientSession(AUDIO_SESSION_NONE), mGlobalRefCount(0)
+5 −5
Original line number Diff line number Diff line
@@ -482,12 +482,12 @@ protected:

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

@@ -592,7 +592,7 @@ protected:

        // Audio Policy Engine Interface.
        AudioPolicyManagerInterface *mEngine;
private:
protected:
        // Add or remove AC3 DTS encodings based on user preferences.
        void filterSurroundFormats(FormatVector *formatsPtr);
        void filterSurroundChannelMasks(ChannelsVector *channelMasksPtr);
@@ -624,7 +624,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,
@@ -660,7 +660,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);