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

Commit 0085832d authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6388139 from 433ccf7d to rvc-release

Change-Id: I4071c48d761c40775b7c17c74a7c56b67440b9e6
parents 500be512 433ccf7d
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -411,6 +411,9 @@ status_t AudioRecord::start(AudioSystem::sync_event_t event, audio_session_t tri
    mFramesReadServerOffset -= mFramesRead + framesFlushed;
    mFramesRead = 0;
    mProxy->clearTimestamp();  // timestamp is invalid until next server push
    mPreviousTimestamp.clear();
    mTimestampRetrogradePositionReported = false;
    mTimestampRetrogradeTimeReported = false;

    // reset current position as seen by client to 0
    mProxy->setEpoch(mProxy->getEpoch() - mProxy->getPosition());
@@ -600,6 +603,39 @@ status_t AudioRecord::getTimestamp(ExtendedTimestamp *timestamp)
                timestamp->mPosition[i] += mFramesReadServerOffset;
            }
        }

        bool timestampRetrogradeTimeReported = false;
        bool timestampRetrogradePositionReported = false;
        for (int i = 0; i < ExtendedTimestamp::LOCATION_MAX; ++i) {
            if (timestamp->mTimeNs[i] >= 0 && mPreviousTimestamp.mTimeNs[i] >= 0) {
                if (timestamp->mTimeNs[i] < mPreviousTimestamp.mTimeNs[i]) {
                    if (!mTimestampRetrogradeTimeReported) {
                        ALOGD("%s: retrograde time adjusting [%d] current:%lld to previous:%lld",
                                __func__, i, (long long)timestamp->mTimeNs[i],
                                (long long)mPreviousTimestamp.mTimeNs[i]);
                        timestampRetrogradeTimeReported = true;
                    }
                    timestamp->mTimeNs[i] = mPreviousTimestamp.mTimeNs[i];
                }
                if (timestamp->mPosition[i] < mPreviousTimestamp.mPosition[i]) {
                    if (!mTimestampRetrogradePositionReported) {
                        ALOGD("%s: retrograde position"
                                " adjusting [%d] current:%lld to previous:%lld",
                                __func__, i, (long long)timestamp->mPosition[i],
                                (long long)mPreviousTimestamp.mPosition[i]);
                        timestampRetrogradePositionReported = true;
                    }
                    timestamp->mPosition[i] = mPreviousTimestamp.mPosition[i];
                }
            }
        }
        mPreviousTimestamp = *timestamp;
        if (timestampRetrogradeTimeReported) {
            mTimestampRetrogradeTimeReported = true;
        }
        if (timestampRetrogradePositionReported) {
            mTimestampRetrogradePositionReported = true;
        }
    }
    return status;
}
+4 −0
Original line number Diff line number Diff line
@@ -711,6 +711,10 @@ private:

    bool                    mInOverrun;         // whether recorder is currently in overrun state

    ExtendedTimestamp       mPreviousTimestamp{}; // used to detect retrograde motion
    bool                    mTimestampRetrogradePositionReported = false; // reduce log spam
    bool                    mTimestampRetrogradeTimeReported = false;     // reduce log spam

private:
    class DeathNotifier : public IBinder::DeathRecipient {
    public:
+8 −0
Original line number Diff line number Diff line
@@ -203,6 +203,14 @@ struct AUHeader {
    unsigned mSerial;
};

bool AMPEG4ElementaryAssembler::initCheck() {
    if(mSizeLength == 0 || mIndexLength == 0 || mIndexDeltaLength == 0) {
        android_errorWriteLog(0x534e4554, "124777537");
        return false;
    }
    return true;
}

ARTPAssembler::AssemblyStatus AMPEG4ElementaryAssembler::addPacket(
        const sp<ARTPSource> &source) {
    List<sp<ABuffer> > *queue = source->queue();
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ struct AMPEG4ElementaryAssembler : public ARTPAssembler {
    AMPEG4ElementaryAssembler(
            const sp<AMessage> &notify, const AString &desc,
            const AString &params);
    virtual bool initCheck();

protected:
    virtual ~AMPEG4ElementaryAssembler();
+1 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ struct ARTPAssembler : public RefBase {

    void onPacketReceived(const sp<ARTPSource> &source);
    virtual void onByeReceived() = 0;
    virtual bool initCheck() { return true; }

protected:
    virtual AssemblyStatus assembleMore(const sp<ARTPSource> &source) = 0;
Loading