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

Commit 60800208 authored by Zhijun He's avatar Zhijun He
Browse files

Camera2/3: Don't release recording buffer when stream is active

It is dangerous to release all recording buffers when recording stream is
actively sending buffer to encoder. This change only releases all buffers when
recording stream is idle and recording stream is about to start.

Bug: 15667833
Change-Id: Ia4a84cac84a2062c13333467c66698273ffb0e23
parent 7a4d7d66
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -430,10 +430,13 @@ status_t StreamingProcessor::startStream(StreamType type,

    Mutex::Autolock m(mMutex);

    // If a recording stream is being started up, free up any
    // outstanding buffers left from the previous recording session.
    // There should never be any, so if there are, warn about it.
    if (isStreamActive(outputStreams, mRecordingStreamId)) {
    // If a recording stream is being started up and no recording
    // stream is active yet, free up any outstanding buffers left
    // from the previous recording session. There should never be
    // any, so if there are, warn about it.
    bool isRecordingStreamIdle = !isStreamActive(mActiveStreamIds, mRecordingStreamId);
    bool startRecordingStream = isStreamActive(outputStreams, mRecordingStreamId);
    if (startRecordingStream && isRecordingStreamIdle) {
        releaseAllRecordingFramesLocked();
    }