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

Commit a08f0411 authored by Glenn Kasten's avatar Glenn Kasten Committed by Android (Google) Code Review
Browse files

Merge "Configure policy of mediaserver threads"

parents 3463fa27 3acbd053
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ public:
     * frameCount:         Minimum size of track PCM buffer in frames. This defines the
     *                     latency of the track. The actual size selected by the AudioTrack could be
     *                     larger if the requested size is not compatible with current audio HAL
     *                     latency.
     *                     latency.  Zero means to use a default value.
     * flags:              See comments on audio_output_flags_t in <system/audio.h>.
     * cbf:                Callback function. If not null, this function is called periodically
     *                     to request new PCM data.
@@ -460,12 +460,24 @@ protected:
    {
    public:
        AudioTrackThread(AudioTrack& receiver, bool bCanCallJava = false);

        // Do not call Thread::requestExitAndWait() without first calling requestExit().
        // Thread::requestExitAndWait() is not virtual, and the implementation doesn't do enough.
        virtual void        requestExit();

                void        pause();    // suspend thread from execution at next loop boundary
                void        resume();   // allow thread to execute, if not requested to exit

    private:
        friend class AudioTrack;
        virtual bool        threadLoop();
        virtual status_t    readyToRun();
        virtual void        onFirstRef();
        AudioTrack& mReceiver;
        ~AudioTrackThread();
        Mutex               mMyLock;    // Thread::mLock is private
        Condition           mMyCond;    // Thread::mThreadExitedCondition is private
        bool                mPaused;    // whether thread is currently paused
    };

            // body of AudioTrackThread::threadLoop()
+1 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ public:
                                track_flags_t flags,
                                const sp<IMemory>& sharedBuffer,
                                audio_io_handle_t output,
                                pid_t tid,  // -1 means unused, otherwise must be valid non-0
                                int *sessionId,
                                status_t *status) = 0;

+2 −3
Original line number Diff line number Diff line
@@ -35,10 +35,9 @@ public:
    DECLARE_META_INTERFACE(AudioRecord);

    /* After it's created the track is not active. Call start() to
     * make it active. If set, the callback will start being called.
     * tid identifies the client callback thread, or 0 if not needed.
     * make it active.
     */
    virtual status_t    start(pid_t tid, int event, int triggerSession) = 0;
    virtual status_t    start(int event, int triggerSession) = 0;

    /* Stop a track. If set, the callback will cease being called and
     * obtainBuffer will return an error. Buffers that are already released
+2 −3
Original line number Diff line number Diff line
@@ -39,10 +39,9 @@ public:
    virtual sp<IMemory> getCblk() const = 0;

    /* After it's created the track is not active. Call start() to
     * make it active. If set, the callback will start being called.
     * tid identifies the client callback thread, or 0 if not needed.
     * make it active.
     */
    virtual status_t    start(pid_t tid) = 0;
    virtual status_t    start() = 0;

    /* Stop a track. If set, the callback will cease being called and
     * obtainBuffer will return an error. Buffers that are already released
+1 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ namespace android {
#define CBLK_RESTORED_MSK       0x0040
#define CBLK_RESTORED_ON        0x0040  // track has been restored after invalidation
#define CBLK_RESTORED_OFF       0x0040  // by AudioFlinger
#define CBLK_FAST               0x0080  // AudioFlinger successfully created a fast track

// Important: do not add any virtual methods, including ~
struct audio_track_cblk_t
Loading