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

Commit 47d0a926 authored by Eric Laurent's avatar Eric Laurent
Browse files

Issue 2071329: audio track is shorter than video track for video capture on sholes

Add API to retrieve number of frames dropped by audio input kernel driver.

Submitted on behalf of Masaki Sato <masaki.sato@motorola.com>
parent 04218254
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -294,6 +294,13 @@ public:
     */
            ssize_t     read(void* buffer, size_t size);

    /* Return the amount of input frames lost in the audio driver since the last call of this function.
     * Audio driver is expected to reset the value to 0 and restart counting upon returning the current value by this function call.
     * Such loss typically occurs when the user space process is blocked longer than the capacity of audio driver buffers.
     * Unit: the number of input audio frames
     */
            unsigned int  getInputFramesLost();

private:
    /* copying audio tracks is not allowed */
                        AudioRecord(const AudioRecord& other);
@@ -348,6 +355,7 @@ private:
    uint32_t                mUpdatePeriod;
    uint32_t                mFlags;
    uint32_t                mChannels;
    audio_io_handle_t       mInput;
};

}; // namespace android
+1 −0
Original line number Diff line number Diff line
@@ -233,6 +233,7 @@ public:
    // necessary to check returned status before using the returned values.
    static status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int stream = DEFAULT);

    static unsigned int  getInputFramesLost(audio_io_handle_t ioHandle);
    //
    // AudioPolicyService interface
    //
+3 −0
Original line number Diff line number Diff line
@@ -130,7 +130,10 @@ public:
    virtual status_t setStreamOutput(uint32_t stream, int output) = 0;

    virtual status_t setVoiceVolume(float volume) = 0;

    virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int output) = 0;

    virtual unsigned int  getInputFramesLost(int ioHandle) = 0;
};


+6 −0
Original line number Diff line number Diff line
@@ -509,6 +509,12 @@ String8 AudioStreamInDump::getParameters(const String8& keys)
    return param.toString();
}

unsigned int AudioStreamInDump::getInputFramesLost() const
{
    if (mFinalStream != 0 ) return mFinalStream->getInputFramesLost();
    return 0;
}

status_t AudioStreamInDump::dump(int fd, const Vector<String16>& args)
{
    if (mFinalStream != 0 ) return mFinalStream->dump(fd, args);
+1 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ public:
    virtual status_t    standby();
    virtual status_t    setParameters(const String8& keyValuePairs);
    virtual String8     getParameters(const String8& keys);
    virtual unsigned int  getInputFramesLost() const;
    virtual status_t    dump(int fd, const Vector<String16>& args);
    void                Close(void);
    AudioStreamIn*     finalStream() { return mFinalStream; }
Loading