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

Commit 87e95973 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Gerrit Code Review
Browse files

Merge "ST_ERICSSON: support for latency" into ics

parents 6dcc59e5 ceb8b69d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -46,6 +46,9 @@ public:
    static const char *keyChannels;
    static const char *keyFrameCount;
    static const char *keyInputSource;
#ifdef STE_HARDWARE
    static const char *keyLatency;
#endif

    String8 toString();

+19 −0
Original line number Diff line number Diff line
@@ -31,6 +31,9 @@ namespace android {

typedef void (*audio_error_callback)(status_t err);

#ifdef STE_HARDWARE
typedef void (*latency_update_callback)(void *cookie, audio_io_handle_t output, uint32_t latency);
#endif
class IAudioPolicyService;
class String8;

@@ -110,6 +113,10 @@ public:
    static int newAudioSessionId();
    static void acquireAudioSessionId(int audioSession);
    static void releaseAudioSessionId(int audioSession);
#ifdef STE_HARDWARE
    static int registerLatencyNotificationClient(latency_update_callback cb, void *cookie);
    static void unregisterLatencyNotificationClient(int clientId);
#endif

    // types of io configuration change events received with ioConfigChanged()
    enum io_config_event {
@@ -239,6 +246,13 @@ private:
        virtual void binderDied(const wp<IBinder>& who);
    };

#ifdef STE_HARDWARE
    struct NotificationClient : public RefBase {
        latency_update_callback mCb;
        void * mCookie;
    };
#endif

    static sp<AudioFlingerClient> gAudioFlingerClient;
    static sp<AudioPolicyServiceClient> gAudioPolicyServiceClient;
    friend class AudioFlingerClient;
@@ -261,6 +275,11 @@ private:
    // list of output descriptors containing cached parameters
    // (sampling rate, framecount, channel count...)
    static DefaultKeyedVector<audio_io_handle_t, OutputDescriptor *> gOutputs;
#ifdef STE_HARDWARE
    static Mutex gLatencyLock;
    static int gNextUniqueLatencyId;
    static DefaultKeyedVector<int, sp<AudioSystem::NotificationClient> > gLatencyNotificationClients;
#endif
};

};  // namespace android
+12 −0
Original line number Diff line number Diff line
@@ -55,7 +55,12 @@ public:
        EVENT_LOOP_END = 2,         // Sample loop end was reached; playback restarted from loop start if loop count was not 0.
        EVENT_MARKER = 3,           // Playback head is at the specified marker position (See setMarkerPosition()).
        EVENT_NEW_POS = 4,          // Playback head is at a new position (See setPositionUpdatePeriod()).
#ifdef STE_HARDWARE
        EVENT_BUFFER_END = 5,       // Playback head is at the end of the buffer.
        EVENT_LATENCY_CHANGED = 6   // Audio output has been reconfigured and latency has changed.
#else
        EVENT_BUFFER_END = 5        // Playback head is at the end of the buffer.
#endif
    };

    /* Create Buffer on the stack and pass it to obtainBuffer()
@@ -480,6 +485,10 @@ private:
            status_t setLoop_l(uint32_t loopStart, uint32_t loopEnd, int loopCount);
            audio_io_handle_t getOutput_l();
            status_t restoreTrack_l(audio_track_cblk_t*& cblk, bool fromStart);
#ifdef STE_HARDWARE
    static void LatencyCallbackWrapper(void *cookie, audio_io_handle_t output, uint32_t latency);
    void latencyCallback(audio_io_handle_t output, uint32_t latency);
#endif

    sp<IAudioTrack>         mAudioTrack;
    sp<IMemory>             mCblkMemory;
@@ -521,6 +530,9 @@ private:
    int                     mAuxEffectId;
    Mutex                   mLock;
    status_t                mRestoreStatus;
#ifdef STE_HARDWARE
    int                     mLatencyClientId;
#endif
};


+8 −0
Original line number Diff line number Diff line
@@ -68,6 +68,9 @@ public:
        // Callback returns the number of bytes actually written to the buffer.
        typedef size_t (*AudioCallback)(
                AudioSink *audioSink, void *buffer, size_t size, void *cookie);
#ifdef STE_HARDWARE
        typedef void (*LatencyCallback)(uint32_t latency, void *cookie);
#endif

        virtual             ~AudioSink() {}
        virtual bool        ready() const = 0; // audio output is open and ready
@@ -88,7 +91,12 @@ public:
                int format=AUDIO_FORMAT_PCM_16_BIT,
                int bufferCount=DEFAULT_AUDIOSINK_BUFFERCOUNT,
                AudioCallback cb = NULL,
#ifdef STE_HARDWARE
                void *cookie = NULL,
                LatencyCallback latencyCb = NULL) = 0;
#else
                void *cookie = NULL) = 0;
#endif

#ifdef WITH_QCOM_LPA
        // API to open a routing session for tunneled audio playback
+4 −0
Original line number Diff line number Diff line
@@ -104,6 +104,10 @@ private:
            MediaPlayerBase::AudioSink *audioSink,
            void *data, size_t size, void *me);

#ifdef STE_HARDWARE
    static void LatencyCallback(uint32_t latency, void *cookie);
#endif

    size_t fillBuffer(void *data, size_t size);

    int64_t getRealTimeUsLocked() const;
Loading